From 2f98f5fa4a991dde47d834c20daae71f72626787 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 21 Sep 2023 10:41:33 +0300 Subject: [PATCH 1/4] wip --- docusaurus.config.js | 209 +++++++++++++++++++++++++++++-------------- 1 file changed, 141 insertions(+), 68 deletions(-) diff --git a/docusaurus.config.js b/docusaurus.config.js index e00111896..e01def46f 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -1,11 +1,11 @@ // @ts-check // Note: type annotations allow type checking and IDEs autocompletion -const redirectVersions = ["main","v0.50","v0.47"] -const redirects = []; -redirectVersions.forEach((version) => { - redirects.push(...generateRedirects(version)); -}); +// const redirectVersions = ["main","v0.50","v0.47"] +// const redirects = []; +// redirectVersions.forEach((version) => { +// redirects.push(...generateRedirects(version)); +// }); const lightCodeTheme = require("prism-react-renderer/themes/github"); const darkCodeTheme = require("prism-react-renderer/themes/dracula"); @@ -241,7 +241,7 @@ const config = { { fromExtensions: ["html"], toExtensions: ["html"], - redirects: [...redirects, + redirects: [ { from: ["/master", "/v0.43", "/v0.44"], to: "/", @@ -419,71 +419,144 @@ const config = { to: "/main/build/modules/", }, ], + createRedirects(existingPath) { + if (existingPath.includes('/core')) { + return [ + existingPath.replace("/core", "/develop/advanced"), + ]; + } + return undefined; + if (existingPath.includes('/basics')) { + return [ + existingPath.replace("/basics", "/develop/beginner"), + ]; + } + if (existingPath.includes('/intro')) { + return [ + existingPath.replace("/intro", "/develop/intro"), + ]; + } + if (existingPath.includes('/architecture')) { + return [ + existingPath.replace("/architecture", "/build/architecture/"), + ]; + } + if (existingPath.includes('/building-apps')) { + return [ + existingPath.replace("/building-apps", "/build/building-apps"), + ] + } + if (existingPath.includes('/building-modules')) { + return [ + existingPath.replace("/building-modules", "/build/building-modules"), + ] + } + if (existingPath.includes('/tooling')) { + return [ + existingPath.replace("/tooling", "/build/libraries"), + ] + } + if (existingPath.includes('/migrations')) { + return [ + existingPath.replace("/migrations", "/build/libraries"), + ] + } + if (existingPath.includes('/modules')) { + return [ + existingPath.replace("/modules", "/build/modules"), + ] + } + if (existingPath.includes('/rfc')) { + return [ + existingPath.replace("/rfc", "/build/rfc"), + ] + } + if (existingPath.includes('/spec')) { + return [ + existingPath.replace("/spec", "/build/spec"), + ] + } + if (existingPath.includes('/tooling')) { + return [ + existingPath.replace("/tooling", "/build/tooling"), + ] + } + if (existingPath.includes('/run-node')) { + return [ + existingPath.replace("/run-node", "/user/run-node"), + ] + } + if (existingPath.includes('/validate')) { + return [ + existingPath.replace("/validate", "/user/validate"), + ]; + } + }, }, ], ], }; -function generateRedirects(version) { - const redirects = [ - { - from: `/${version}`, - to: `/`, - }, - { - from: `/${version}/core`, - to: `/${version}/develop/advanced/baseapp`, - }, - { - from: `/${version}/basics`, - to: `/${version}/develop/beginner/overview-app`, - }, - { - from: `/${version}/intro`, - to: `/${version}/develop/intro/what-is-sdk`, - }, - { - from: `/${version}/architecture`, - to: `/${version}/build/architecture/`, - }, - { - from: `/${version}/building-apps`, - to: `/${version}/build/building-apps/app-go`, - }, - { - from: `/${version}/building-modules`, - to: `/${version}/build/building-modules/intro`, - }, - { - from: `/${version}/modules`, - to: `/${version}/build/modules`, - }, - { - from: `/${version}/packages`, - to: `/${version}/build/packages`, - }, - { - from: `/${version}/tooling`, - to: `/${version}/build/tooling`, - }, - { - from: `/${version}/migrations`, - to: `/${version}/build/migrations/intro`, - }, - { - from: `/${version}/rfc`, - to: `/${version}/build/rfc`, - }, - { - from: `/${version}/spec`, - to: `/${version}/build/spec/addresses`, - }, - { - from: `/${version}/run-node`, - to: `/${version}/user/run-node/keyring`, - }, - ]; - - return redirects; -} +// function generateRedirects(version) { +// const redirects = [ +// { +// from: `/${version}`, +// to: `/`, +// }, +// { +// from: `/${version}/core`, +// to: `/${version}/develop/advanced/baseapp`, +// }, +// { +// from: `/${version}/basics`, +// to: `/${version}/develop/beginner/overview-app`, +// }, +// { +// from: `/${version}/intro`, +// to: `/${version}/develop/intro/what-is-sdk`, +// }, +// { +// from: `/${version}/architecture`, +// to: `/${version}/build/architecture/`, +// }, +// { +// from: `/${version}/building-apps`, +// to: `/${version}/build/building-apps/app-go`, +// }, +// { +// from: `/${version}/building-modules`, +// to: `/${version}/build/building-modules/intro`, +// }, +// { +// from: `/${version}/modules`, +// to: `/${version}/build/modules`, +// }, +// { +// from: `/${version}/packages`, +// to: `/${version}/build/packages`, +// }, +// { +// from: `/${version}/tooling`, +// to: `/${version}/build/tooling`, +// }, +// { +// from: `/${version}/migrations`, +// to: `/${version}/build/migrations/intro`, +// }, +// { +// from: `/${version}/rfc`, +// to: `/${version}/build/rfc`, +// }, +// { +// from: `/${version}/spec`, +// to: `/${version}/build/spec/addresses`, +// }, +// { +// from: `/${version}/run-node`, +// to: `/${version}/user/run-node/keyring`, +// }, +// ]; +// +// return redirects; +// } module.exports = config; From ee356d328e97576d3decfd4e4c692364a4a538cd Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 21 Sep 2023 11:00:35 +0300 Subject: [PATCH 2/4] wip --- docusaurus.config.js | 53 ++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/docusaurus.config.js b/docusaurus.config.js index e01def46f..c11e64b5f 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -420,25 +420,24 @@ const config = { }, ], createRedirects(existingPath) { - if (existingPath.includes('/core')) { + if (existingPath.includes('/develop/advanced')) { return [ - existingPath.replace("/core", "/develop/advanced"), + existingPath.replace("/develop/advanced", "/core"), ]; } - return undefined; - if (existingPath.includes('/basics')) { + if (existingPath.includes('/develop/beginner')) { return [ - existingPath.replace("/basics", "/develop/beginner"), + existingPath.replace("/develop/beginner", "/basics"), ]; } - if (existingPath.includes('/intro')) { + if (existingPath.includes('/develop/intro')) { return [ - existingPath.replace("/intro", "/develop/intro"), + existingPath.replace("/develop/intro", "/intro"), ]; } - if (existingPath.includes('/architecture')) { + if (existingPath.includes('build/architecture')) { return [ - existingPath.replace("/architecture", "/build/architecture/"), + existingPath.replace("/build/architecture", "/architecture/"), ]; } if (existingPath.includes('/building-apps')) { @@ -446,49 +445,49 @@ const config = { existingPath.replace("/building-apps", "/build/building-apps"), ] } - if (existingPath.includes('/building-modules')) { + if (existingPath.includes('/build/building-modules')) { return [ - existingPath.replace("/building-modules", "/build/building-modules"), + existingPath.replace("/build/building-modules", "/building-modules"), ] } - if (existingPath.includes('/tooling')) { + if (existingPath.includes('/build/libraries')) { return [ - existingPath.replace("/tooling", "/build/libraries"), + existingPath.replace("/build/libraries", "/tooling"), ] } - if (existingPath.includes('/migrations')) { + if (existingPath.includes('/build/libraries')) { return [ - existingPath.replace("/migrations", "/build/libraries"), + existingPath.replace("/build/libraries", "/migrations"), ] } - if (existingPath.includes('/modules')) { + if (existingPath.includes('/build/modules')) { return [ - existingPath.replace("/modules", "/build/modules"), + existingPath.replace("/build/modules", "/modules"), ] } - if (existingPath.includes('/rfc')) { + if (existingPath.includes('/build/rfc')) { return [ - existingPath.replace("/rfc", "/build/rfc"), + existingPath.replace("/build/rfc", "/rfc"), ] } - if (existingPath.includes('/spec')) { + if (existingPath.includes('/build/spec')) { return [ - existingPath.replace("/spec", "/build/spec"), + existingPath.replace("/build/spec", "/build/spec"), ] } - if (existingPath.includes('/tooling')) { + if (existingPath.includes('/build/tooling')) { return [ - existingPath.replace("/tooling", "/build/tooling"), + existingPath.replace("/build/tooling", "/tooling"), ] } - if (existingPath.includes('/run-node')) { + if (existingPath.includes('/user/run-node')) { return [ - existingPath.replace("/run-node", "/user/run-node"), + existingPath.replace("/user/run-node", "/run-node"), ] } - if (existingPath.includes('/validate')) { + if (existingPath.includes('/user/validate')) { return [ - existingPath.replace("/validate", "/user/validate"), + existingPath.replace("/user/validate", "/validate"), ]; } }, From d19fcc801f1e2f17ba41ff76f0d6cca8436d1eb5 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 21 Sep 2023 11:08:24 +0300 Subject: [PATCH 3/4] Update docusaurus.config.js --- docusaurus.config.js | 72 ++------------------------------------------ 1 file changed, 2 insertions(+), 70 deletions(-) diff --git a/docusaurus.config.js b/docusaurus.config.js index c11e64b5f..15a023280 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -1,12 +1,6 @@ // @ts-check // Note: type annotations allow type checking and IDEs autocompletion -// const redirectVersions = ["main","v0.50","v0.47"] -// const redirects = []; -// redirectVersions.forEach((version) => { -// redirects.push(...generateRedirects(version)); -// }); - const lightCodeTheme = require("prism-react-renderer/themes/github"); const darkCodeTheme = require("prism-react-renderer/themes/dracula"); @@ -440,9 +434,9 @@ const config = { existingPath.replace("/build/architecture", "/architecture/"), ]; } - if (existingPath.includes('/building-apps')) { + if (existingPath.includes('/build/building-apps')) { return [ - existingPath.replace("/building-apps", "/build/building-apps"), + existingPath.replace("/building-apps", "/building-apps"), ] } if (existingPath.includes('/build/building-modules')) { @@ -495,67 +489,5 @@ const config = { ], ], }; -// function generateRedirects(version) { -// const redirects = [ -// { -// from: `/${version}`, -// to: `/`, -// }, -// { -// from: `/${version}/core`, -// to: `/${version}/develop/advanced/baseapp`, -// }, -// { -// from: `/${version}/basics`, -// to: `/${version}/develop/beginner/overview-app`, -// }, -// { -// from: `/${version}/intro`, -// to: `/${version}/develop/intro/what-is-sdk`, -// }, -// { -// from: `/${version}/architecture`, -// to: `/${version}/build/architecture/`, -// }, -// { -// from: `/${version}/building-apps`, -// to: `/${version}/build/building-apps/app-go`, -// }, -// { -// from: `/${version}/building-modules`, -// to: `/${version}/build/building-modules/intro`, -// }, -// { -// from: `/${version}/modules`, -// to: `/${version}/build/modules`, -// }, -// { -// from: `/${version}/packages`, -// to: `/${version}/build/packages`, -// }, -// { -// from: `/${version}/tooling`, -// to: `/${version}/build/tooling`, -// }, -// { -// from: `/${version}/migrations`, -// to: `/${version}/build/migrations/intro`, -// }, -// { -// from: `/${version}/rfc`, -// to: `/${version}/build/rfc`, -// }, -// { -// from: `/${version}/spec`, -// to: `/${version}/build/spec/addresses`, -// }, -// { -// from: `/${version}/run-node`, -// to: `/${version}/user/run-node/keyring`, -// }, -// ]; -// -// return redirects; -// } module.exports = config; From dd280be85f0185b5a5c370a501b9453a765d653d Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 21 Sep 2023 11:25:51 +0300 Subject: [PATCH 4/4] Update docusaurus.config.js --- docusaurus.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/docusaurus.config.js b/docusaurus.config.js index 15a023280..ea0ab7c8d 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -484,6 +484,7 @@ const config = { existingPath.replace("/user/validate", "/validate"), ]; } + return undefined; }, }, ],