diff --git a/.github/workflows/build-on-pr.yml b/.github/workflows/build-on-pr.yml index fa18da76db..87f71e8f06 100644 --- a/.github/workflows/build-on-pr.yml +++ b/.github/workflows/build-on-pr.yml @@ -18,14 +18,14 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '18' + node-version: '24' cache: 'npm' - name: Install dependencies run: npm ci - name: Build Docusaurus - run: npm run build + run: npx cross-env DOCUSAURUS_VERSIONS='6.2, 7.0, current' npm run build - name: Upload build artifacts uses: actions/upload-artifact@v4 diff --git a/docusaurus.config.ts b/docusaurus.config.ts index d30e368ae8..85f6333a0f 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -4,7 +4,15 @@ import type * as Preset from "@docusaurus/preset-classic"; // This runs in Node.js - Don't use client-side code here (browser APIs, JSX...) -const isStartOnlyCurrentVersion = process.env.DOCUSAURUS_START_VERSION_ENV === 'current'; +function getOnlyIncludeVersions(): string[] | undefined { + const versionsEnv = process.env.DOCUSAURUS_VERSIONS; + + if (!versionsEnv) { + return undefined; + } + + return versionsEnv.split(',').map(v => v.trim()); +} const config: Config = { title: "RavenDB Documentation", @@ -45,7 +53,7 @@ const config: Config = { path: "7.1" } }, - onlyIncludeVersions: isStartOnlyCurrentVersion ? ['current'] : undefined, + onlyIncludeVersions: getOnlyIncludeVersions(), //editUrl: // 'https://github.com/ravendb/docs/tree/main/' }, diff --git a/package-lock.json b/package-lock.json index 330f6a8a9c..f7b4894556 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,6 +29,7 @@ "@tailwindcss/postcss": "^4.1.11", "@typescript-eslint/eslint-plugin": "^8.39.0", "@typescript-eslint/parser": "^8.39.0", + "cross-env": "^10.1.0", "eslint": "^9.32.0", "eslint-plugin-react": "^7.37.5", "eslint-plugin-react-hooks": "^5.2.0", @@ -3752,6 +3753,13 @@ "tslib": "^2.4.0" } }, + "node_modules/@epic-web/invariant": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@epic-web/invariant/-/invariant-1.0.0.tgz", + "integrity": "sha512-lrTPqgvfFQtR/eY/qkIzp98OGdNJu0m5ji3q/nJI8v3SXkRKEnWiOxMmbvcSoAIzv/cGiuvRy57k4suKQSAdwA==", + "dev": true, + "license": "MIT" + }, "node_modules/@eslint-community/eslint-utils": { "version": "4.7.0", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.7.0.tgz", @@ -7608,6 +7616,24 @@ } } }, + "node_modules/cross-env": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-10.1.0.tgz", + "integrity": "sha512-GsYosgnACZTADcmEyJctkJIoqAhHjttw7RsFrVoJNXbsWWqaq6Ym+7kZjq6mS45O0jij6vtiReppKQEtqWy6Dw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@epic-web/invariant": "^1.0.0", + "cross-spawn": "^7.0.6" + }, + "bin": { + "cross-env": "dist/bin/cross-env.js", + "cross-env-shell": "dist/bin/cross-env-shell.js" + }, + "engines": { + "node": ">=20" + } + }, "node_modules/cross-spawn": { "version": "7.0.6", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", diff --git a/package.json b/package.json index b7415e03e3..240d533e2e 100644 --- a/package.json +++ b/package.json @@ -5,8 +5,9 @@ "scripts": { "docusaurus": "docusaurus", "start": "npm run generate-icon-types && docusaurus start --no-minify", - "start:current": "set \"DOCUSAURUS_START_VERSION_ENV=current\" && npm run generate-icon-types && docusaurus start --no-minify", + "start:current": "npm run generate-icon-types && cross-env DOCUSAURUS_VERSIONS='current' docusaurus start --no-minify", "build": "npm run generate-icon-types && docusaurus build", + "build:current": "npm run generate-icon-types && cross-env DOCUSAURUS_VERSIONS='current' docusaurus build", "swizzle": "docusaurus swizzle", "deploy": "docusaurus deploy", "clear": "docusaurus clear", @@ -40,6 +41,7 @@ "@tailwindcss/postcss": "^4.1.11", "@typescript-eslint/eslint-plugin": "^8.39.0", "@typescript-eslint/parser": "^8.39.0", + "cross-env": "^10.1.0", "eslint": "^9.32.0", "eslint-plugin-react": "^7.37.5", "eslint-plugin-react-hooks": "^5.2.0", diff --git a/src/components/LanguageStore.tsx b/src/components/LanguageStore.tsx index d7ce957abf..7f60584f58 100644 --- a/src/components/LanguageStore.tsx +++ b/src/components/LanguageStore.tsx @@ -26,6 +26,7 @@ export const useLanguage = (): { const language = useSyncExternalStore( subscribe, getLanguageFromLocalStorage, + () => DEFAULT_LANGUAGE, ); const setLanguage = useCallback((newLanguage: DocsLanguage) => { diff --git a/src/theme/DocItem/index.tsx b/src/theme/DocItem/index.tsx index f6bf385c30..d17602d9bc 100644 --- a/src/theme/DocItem/index.tsx +++ b/src/theme/DocItem/index.tsx @@ -16,7 +16,8 @@ export default function DocItemWrapper(props: Props): ReactNode { source?.startsWith("docs/") || source?.startsWith("versioned_docs/"); const fileName = source?.split("/").pop(); - const isExcluded = fileName === "home.mdx" || fileName === "whats-new.mdx"; + const isHomepage = fileName === "home.mdx"; + const isExcluded = isHomepage || fileName === "whats-new.mdx"; const supportedLanguages = (props.content as any)?.supportedLanguages || @@ -37,7 +38,7 @@ export default function DocItemWrapper(props: Props): ReactNode {