From f7099825a53c7c50090f79b9bfeada2ef3e3876d Mon Sep 17 00:00:00 2001 From: Baz Utsahajit Date: Mon, 11 Mar 2024 10:44:55 +0000 Subject: [PATCH 1/8] Fix: NavBar not highlighting selected version --- docusaurus.config.js | 4 ++-- scripts/update-global-version-configs.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docusaurus.config.js b/docusaurus.config.js index d513c679a..e22624cc5 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -51,8 +51,8 @@ const config = { }, current: { - label: 'v8.x (Latest)', - path: '', + label: 'v8.x', + path: '8.x', banner: 'none', badge: false, }, diff --git a/scripts/update-global-version-configs.js b/scripts/update-global-version-configs.js index 0b0c22c51..07036bdd0 100644 --- a/scripts/update-global-version-configs.js +++ b/scripts/update-global-version-configs.js @@ -79,7 +79,7 @@ recast.visit(ast, { recast.types.builders.property( 'init', recast.types.builders.identifier('path'), - recast.types.builders.literal(version.isCurrent ? '' : key), + recast.types.builders.literal(key), ), recast.types.builders.property( 'init', From a964d74e54cebb0f3303d5a4098b851d83d584eb Mon Sep 17 00:00:00 2001 From: Baz Utsahajit Date: Mon, 11 Mar 2024 14:11:56 +0000 Subject: [PATCH 2/8] Prefix direct links with latest version --- blog/2024-03-05-pixi-v8-launches.md | 6 +++--- src/components/Homepage/ClosingSection/index.tsx | 2 +- src/components/Homepage/HeroHeader/index.tsx | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/blog/2024-03-05-pixi-v8-launches.md b/blog/2024-03-05-pixi-v8-launches.md index 02e2859db..4ab96cbac 100644 --- a/blog/2024-03-05-pixi-v8-launches.md +++ b/blog/2024-03-05-pixi-v8-launches.md @@ -39,8 +39,8 @@ We're incredibly proud of PixiJS v8 and eager to share the improvements and new ## 🔗 Quick links - The new Docs for v8 can be found [here](https://pixijs.download/v8.0.0/docs/index.html) -- [Migration](/guides/migrations/v8) -- [Examples](/examples) +- [Migration](8.x/guides/migrations/v8) +- [Examples](8.x/examples) - [Open Games](https://github.com/pixijs/open-games) --- @@ -197,7 +197,7 @@ myContainer.blendMode = 'color-burn` // easy! ``` -For more information on these graphics upgrades and guidance on how to adapt to the enhanced Graphics API, please refer to the [migration guide](/guides/migrations/v8), or why not jump in and play with some [examples](examples/graphics/simple). +For more information on these graphics upgrades and guidance on how to adapt to the enhanced Graphics API, please refer to the [migration guide](8.x/guides/migrations/v8), or why not jump in and play with some [examples](8.x/examples/graphics/simple). #### 📝 Text Upgrades diff --git a/src/components/Homepage/ClosingSection/index.tsx b/src/components/Homepage/ClosingSection/index.tsx index 0d39ab898..24bb0a5f8 100644 --- a/src/components/Homepage/ClosingSection/index.tsx +++ b/src/components/Homepage/ClosingSection/index.tsx @@ -37,7 +37,7 @@ export default function ClosingSection(): JSX.Element anim="short-up-anim" style={animShortUp(0.3, 0.7)} label="Get Started" - link="/tutorials" + link="8.x/tutorials" outline={true} /> diff --git a/src/components/Homepage/HeroHeader/index.tsx b/src/components/Homepage/HeroHeader/index.tsx index 67510a24d..0463a1e23 100644 --- a/src/components/Homepage/HeroHeader/index.tsx +++ b/src/components/Homepage/HeroHeader/index.tsx @@ -16,7 +16,7 @@ export default function HeroHeader(): JSX.Element
  - +
From 8ab1590b7062c2998671f9460f267dd6a75d2ccd Mon Sep 17 00:00:00 2001 From: Baz Utsahajit Date: Mon, 11 Mar 2024 14:38:15 +0000 Subject: [PATCH 3/8] Feat: Add Docs Redirection --- src/theme/NotFound.js | 61 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 src/theme/NotFound.js diff --git a/src/theme/NotFound.js b/src/theme/NotFound.js new file mode 100644 index 000000000..232863f5e --- /dev/null +++ b/src/theme/NotFound.js @@ -0,0 +1,61 @@ +import React, { useEffect, useState } from 'react'; +import NotFound from '@theme-original/NotFound'; +import { useHistory, useLocation } from '@docusaurus/router'; + +export default function NotFoundWrapper(props) +{ + const location = useLocation(); + const history = useHistory(); + + const [isRedirecting, setIsRedirecting] = useState( + location.pathname.startsWith('/tutorials') + || location.pathname.startsWith('/examples') + || location.pathname.startsWith('/guides') + || location.pathname.startsWith('/playground'), + ); + + useEffect(() => + { + if (isRedirecting) + { + history.replace(`/8.x${location.pathname}`); + } + }, [location, history, isRedirecting]); + + return isRedirecting ? ( + <> +
+
+ Redirecting... +
+ + + ) : ( + + ); +} From a92f1ea0ea929071468c066e2cc7cdffdf097d52 Mon Sep 17 00:00:00 2001 From: Zyie <24736175+Zyie@users.noreply.github.com> Date: Mon, 11 Mar 2024 15:54:24 +0000 Subject: [PATCH 4/8] Feat: redirect --- docusaurus.config.js | 39 +++++++++++++++++- package-lock.json | 93 ++++++++++++++++++++++++++----------------- package.json | 4 +- src/theme/NotFound.js | 61 ---------------------------- tsconfig.json | 2 +- 5 files changed, 96 insertions(+), 103 deletions(-) delete mode 100644 src/theme/NotFound.js diff --git a/docusaurus.config.js b/docusaurus.config.js index e22624cc5..e9521ae80 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -42,6 +42,7 @@ const config = { // Remove this to remove the "edit this page" links. editUrl: 'https://github.com/pixijs/pixijs.com/tree/main/', routeBasePath: '/', + lastVersion: 'current', versions: { '7.x': { label: 'v7.x', @@ -74,7 +75,31 @@ const config = { ], ], - plugins: ['docusaurus-plugin-sass'], + plugins: [ + 'docusaurus-plugin-sass', + [ + '@docusaurus/plugin-client-redirects', + { + // eslint-disable-next-line consistent-return + createRedirects(existingPath) + { + if (existingPath.includes('/v7.x')) return undefined; + + const pathsToRedirect = ['guides', 'examples', 'tutorials', 'playground']; + + for (let i = 0; i < pathsToRedirect.length; i++) + { + const path = pathsToRedirect[i]; + + if (existingPath.includes(`/${path}`)) + { + return [existingPath.replace(`/v8.x/${path}`, `/${path}`)]; + } + } + }, + }, + ], + ], themes: [ [ @@ -122,9 +147,19 @@ const config = { ], }, { + type: 'dropdown', label: 'API', position: 'left', - href: `https://pixijs.download/release/docs/index.html`, + items: [ + { + label: 'v8.x', + href: 'https://pixijs.download/release/docs/index.html', + }, + { + label: 'v7.x', + href: 'https://pixijs.download/v7.x/docs/index.html', + }, + ], }, { type: 'doc', diff --git a/package-lock.json b/package-lock.json index 21c6f7eb3..818857a9f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,10 +10,10 @@ "dependencies": { "@codesandbox/sandpack-react": "^1.18.4", "@docusaurus/core": "~2.3.1", + "@docusaurus/plugin-client-redirects": "~2.3.1", "@docusaurus/plugin-content-blog": "~2.3.1", "@docusaurus/plugin-google-analytics": "~2.3.1", "@docusaurus/preset-classic": "~2.3.1", - "@docusaurus/theme-search-algolia": "~2.3.1", "@easyops-cn/docusaurus-search-local": "^0.35.0", "@mdx-js/react": "^1.6.22", "@monaco-editor/react": "^4.4.6", @@ -2423,17 +2423,6 @@ "react-dom": "^16.8.4 || ^17.0.0" } }, - "node_modules/@docusaurus/core/node_modules/eta": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/eta/-/eta-2.0.0.tgz", - "integrity": "sha512-NqE7S2VmVwgMS8yBxsH4VgNQjNjLq1gfGU0u9I6Cjh468nPRMoDfGdK9n1p/3Dvsw3ebklDkZsFAnKJ9sefjBA==", - "engines": { - "node": ">=6.0.0" - }, - "funding": { - "url": "https://github.com/eta-dev/eta?sponsor=1" - } - }, "node_modules/@docusaurus/cssnano-preset": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/@docusaurus/cssnano-preset/-/cssnano-preset-2.3.1.tgz", @@ -2510,6 +2499,29 @@ "react-dom": "*" } }, + "node_modules/@docusaurus/plugin-client-redirects": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@docusaurus/plugin-client-redirects/-/plugin-client-redirects-2.3.1.tgz", + "integrity": "sha512-Ye0z36/L8685ni0DIxHqPPaHIXFXiSF90QYiYfpODBX6NxvvveUTyylsDBU1GQhPXPn1bd39QgaOuZ+j9gfaog==", + "dependencies": { + "@docusaurus/core": "2.3.1", + "@docusaurus/logger": "2.3.1", + "@docusaurus/utils": "2.3.1", + "@docusaurus/utils-common": "2.3.1", + "@docusaurus/utils-validation": "2.3.1", + "eta": "^2.0.0", + "fs-extra": "^10.1.0", + "lodash": "^4.17.21", + "tslib": "^2.4.0" + }, + "engines": { + "node": ">=16.14" + }, + "peerDependencies": { + "react": "^16.8.4 || ^17.0.0", + "react-dom": "^16.8.4 || ^17.0.0" + } + }, "node_modules/@docusaurus/plugin-content-blog": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/@docusaurus/plugin-content-blog/-/plugin-content-blog-2.3.1.tgz", @@ -2826,17 +2838,6 @@ "react-dom": "^16.8.4 || ^17.0.0" } }, - "node_modules/@docusaurus/theme-search-algolia/node_modules/eta": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/eta/-/eta-2.0.0.tgz", - "integrity": "sha512-NqE7S2VmVwgMS8yBxsH4VgNQjNjLq1gfGU0u9I6Cjh468nPRMoDfGdK9n1p/3Dvsw3ebklDkZsFAnKJ9sefjBA==", - "engines": { - "node": ">=6.0.0" - }, - "funding": { - "url": "https://github.com/eta-dev/eta?sponsor=1" - } - }, "node_modules/@docusaurus/theme-translations": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/@docusaurus/theme-translations/-/theme-translations-2.3.1.tgz", @@ -8810,6 +8811,17 @@ "node": ">=0.10.0" } }, + "node_modules/eta": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/eta/-/eta-2.2.0.tgz", + "integrity": "sha512-UVQ72Rqjy/ZKQalzV5dCCJP80GrmPrMxh6NlNf+erV6ObL0ZFkhCstWRawS85z3smdr3d2wXPsZEY7rDPfGd2g==", + "engines": { + "node": ">=6.0.0" + }, + "funding": { + "url": "https://github.com/eta-dev/eta?sponsor=1" + } + }, "node_modules/etag": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", @@ -20792,13 +20804,6 @@ "webpack-dev-server": "^4.9.3", "webpack-merge": "^5.8.0", "webpackbar": "^5.0.2" - }, - "dependencies": { - "eta": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/eta/-/eta-2.0.0.tgz", - "integrity": "sha512-NqE7S2VmVwgMS8yBxsH4VgNQjNjLq1gfGU0u9I6Cjh468nPRMoDfGdK9n1p/3Dvsw3ebklDkZsFAnKJ9sefjBA==" - } } }, "@docusaurus/cssnano-preset": { @@ -20860,6 +20865,22 @@ "react-loadable": "npm:@docusaurus/react-loadable@5.5.2" } }, + "@docusaurus/plugin-client-redirects": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@docusaurus/plugin-client-redirects/-/plugin-client-redirects-2.3.1.tgz", + "integrity": "sha512-Ye0z36/L8685ni0DIxHqPPaHIXFXiSF90QYiYfpODBX6NxvvveUTyylsDBU1GQhPXPn1bd39QgaOuZ+j9gfaog==", + "requires": { + "@docusaurus/core": "2.3.1", + "@docusaurus/logger": "2.3.1", + "@docusaurus/utils": "2.3.1", + "@docusaurus/utils-common": "2.3.1", + "@docusaurus/utils-validation": "2.3.1", + "eta": "^2.0.0", + "fs-extra": "^10.1.0", + "lodash": "^4.17.21", + "tslib": "^2.4.0" + } + }, "@docusaurus/plugin-content-blog": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/@docusaurus/plugin-content-blog/-/plugin-content-blog-2.3.1.tgz", @@ -21087,13 +21108,6 @@ "lodash": "^4.17.21", "tslib": "^2.4.0", "utility-types": "^3.10.0" - }, - "dependencies": { - "eta": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/eta/-/eta-2.0.0.tgz", - "integrity": "sha512-NqE7S2VmVwgMS8yBxsH4VgNQjNjLq1gfGU0u9I6Cjh468nPRMoDfGdK9n1p/3Dvsw3ebklDkZsFAnKJ9sefjBA==" - } } }, "@docusaurus/theme-translations": { @@ -25486,6 +25500,11 @@ "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==" }, + "eta": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/eta/-/eta-2.2.0.tgz", + "integrity": "sha512-UVQ72Rqjy/ZKQalzV5dCCJP80GrmPrMxh6NlNf+erV6ObL0ZFkhCstWRawS85z3smdr3d2wXPsZEY7rDPfGd2g==" + }, "etag": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", diff --git a/package.json b/package.json index f47ee3fd6..fafc587b4 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "0.0.0", "private": true, "scripts": { - "prebuild": "npm run update-pixi-version-configs && npm run generate-content", + "prebuild": "npm run generate-content", "build": "docusaurus build", "clear": "docusaurus clear", "predeploy": "npm run generate-content", @@ -61,7 +61,7 @@ "@docusaurus/plugin-content-blog": "~2.3.1", "@docusaurus/plugin-google-analytics": "~2.3.1", "@docusaurus/preset-classic": "~2.3.1", - "@docusaurus/theme-search-algolia": "~2.3.1", + "@docusaurus/plugin-client-redirects": "~2.3.1", "@easyops-cn/docusaurus-search-local": "^0.35.0", "@mdx-js/react": "^1.6.22", "@monaco-editor/react": "^4.4.6", diff --git a/src/theme/NotFound.js b/src/theme/NotFound.js deleted file mode 100644 index 232863f5e..000000000 --- a/src/theme/NotFound.js +++ /dev/null @@ -1,61 +0,0 @@ -import React, { useEffect, useState } from 'react'; -import NotFound from '@theme-original/NotFound'; -import { useHistory, useLocation } from '@docusaurus/router'; - -export default function NotFoundWrapper(props) -{ - const location = useLocation(); - const history = useHistory(); - - const [isRedirecting, setIsRedirecting] = useState( - location.pathname.startsWith('/tutorials') - || location.pathname.startsWith('/examples') - || location.pathname.startsWith('/guides') - || location.pathname.startsWith('/playground'), - ); - - useEffect(() => - { - if (isRedirecting) - { - history.replace(`/8.x${location.pathname}`); - } - }, [location, history, isRedirecting]); - - return isRedirecting ? ( - <> -
-
- Redirecting... -
- - - ) : ( - - ); -} diff --git a/tsconfig.json b/tsconfig.json index f549a341d..ba19b57e5 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -16,7 +16,7 @@ "strict": true, "target": "ESNext" }, - "exclude": ["build", "node_modules"], + "exclude": ["build", "node_modules", "*.js"], "ts-node": { "files": true, "compilerOptions": { From 170bc410c4760fc9b2e638bc42a283c64f24b8f0 Mon Sep 17 00:00:00 2001 From: Zyie <24736175+Zyie@users.noreply.github.com> Date: Mon, 11 Mar 2024 15:56:43 +0000 Subject: [PATCH 5/8] tidy config --- docusaurus.config.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/docusaurus.config.js b/docusaurus.config.js index e9521ae80..b8a7e7c0e 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -331,12 +331,6 @@ const config = { disableSwitch: false, respectPrefersColorScheme: true, }, - // algolia: { - // appId: 'JX6EBQCAGQ', - // apiKey: '2ac1220b913a281bcfeccdf628fa6e99', - // indexName: 'beta_pixijs', - // contextualSearch: false, - // }, }), }; From 53be93ec6dd19e25afb3b30c4ffc321b67264c57 Mon Sep 17 00:00:00 2001 From: Zyie <24736175+Zyie@users.noreply.github.com> Date: Mon, 11 Mar 2024 16:02:50 +0000 Subject: [PATCH 6/8] add badge --- docusaurus.config.js | 4 ++-- src/pages/team.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docusaurus.config.js b/docusaurus.config.js index b8a7e7c0e..a9979b1e5 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -48,14 +48,14 @@ const config = { label: 'v7.x', path: '7.x', banner: 'none', - badge: false, + badge: true, }, current: { label: 'v8.x', path: '8.x', banner: 'none', - badge: false, + badge: true, }, }, }, diff --git a/src/pages/team.json b/src/pages/team.json index dedaaf68b..2676f3764 100644 --- a/src/pages/team.json +++ b/src/pages/team.json @@ -133,6 +133,6 @@ "social": { "github": "https://github.com/baseten" }, - "active": true + "active": false } ] From 04a962a6d72c87ae6e2415cf602e7353e90fd8ab Mon Sep 17 00:00:00 2001 From: Zyie <24736175+Zyie@users.noreply.github.com> Date: Mon, 11 Mar 2024 16:06:21 +0000 Subject: [PATCH 7/8] fix --- docusaurus.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docusaurus.config.js b/docusaurus.config.js index a9979b1e5..8708c1365 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -93,7 +93,7 @@ const config = { if (existingPath.includes(`/${path}`)) { - return [existingPath.replace(`/v8.x/${path}`, `/${path}`)]; + return [existingPath.replace(`/8.x/${path}`, `/${path}`)]; } } }, From c6b269e21d8811fb0df09ee6d7dbda0cd599e196 Mon Sep 17 00:00:00 2001 From: Zyie <24736175+Zyie@users.noreply.github.com> Date: Mon, 11 Mar 2024 16:08:57 +0000 Subject: [PATCH 8/8] fix v7 link --- docusaurus.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docusaurus.config.js b/docusaurus.config.js index 8708c1365..8bad16771 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -83,7 +83,7 @@ const config = { // eslint-disable-next-line consistent-return createRedirects(existingPath) { - if (existingPath.includes('/v7.x')) return undefined; + if (existingPath.includes('/7.x')) return undefined; const pathsToRedirect = ['guides', 'examples', 'tutorials', 'playground'];