From 5b729652e2f1ac1c6a11a46a0832dd668dc05af4 Mon Sep 17 00:00:00 2001 From: Lucas Saldanha Date: Tue, 14 Nov 2023 19:27:23 +1300 Subject: [PATCH] Created versions-preset.json (#499) --- docusaurus.config.js | 28 ++++++++++------------------ versions-preset.json | 6 ++++++ 2 files changed, 16 insertions(+), 18 deletions(-) create mode 100644 versions-preset.json diff --git a/docusaurus.config.js b/docusaurus.config.js index bccc52db1..ee17163d6 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -1,3 +1,4 @@ +const fs = require("fs"); const lightCodeTheme = require("prism-react-renderer/themes/github"); const darkCodeTheme = require("prism-react-renderer/themes/dracula"); @@ -40,24 +41,7 @@ const config = { path: "./docs", includeCurrentVersion: true, lastVersion: "23.10.0", - versions: { - //defaults to the ./docs folder - // using 'development' instead of 'next' as path - current: { - label: "development", - path: "development", - }, - //the last stable release in the versioned_docs/version-stable - "23.10.0": { - label: "stable (23.10.0)", - }, - "23.9.1": { - label: "23.9.1", - }, - "23.8.0": { - label: "23.8.0", - }, - }, + versions: {}, // defined at ./versions-preset.json // @ts-ignore // eslint-disable-next-line global-require remarkPlugins: [require("remark-docusaurus-tabs")], @@ -452,4 +436,12 @@ const config = { ], }; +const data = fs.readFileSync("./versions-preset.json", { + encoding: "utf8", + flag: "r", +}); +let versions = JSON.parse(data); +// Injecting preset versions into config object +config.presets[0][1].docs.versions = versions; + module.exports = config; diff --git a/versions-preset.json b/versions-preset.json new file mode 100644 index 000000000..b650474b9 --- /dev/null +++ b/versions-preset.json @@ -0,0 +1,6 @@ +{ + "current": { "label": "development", "path": "development" }, + "23.10.0": { "label": "stable (23.10.0)" }, + "23.9.1": { "label": "stable (23.9.1)" }, + "23.8.0": { "label": "23.8.0" } +} \ No newline at end of file