From 29da6251952e79094de13382671cdd93267193c1 Mon Sep 17 00:00:00 2001 From: Thomas Heartman Date: Mon, 14 Nov 2022 08:52:46 +0100 Subject: [PATCH] chore: update docusaurus/openapi integration to stable version (#2414) ## What This PR updates the version of the docusaurus-openapi plugin we depend on for openapi docs generation from canary version 0.0.0-514 to stable release 1.4.4. Also removes the manual file cleanup that was created as a workaround to solve the issues we were having. ## Why When we set the canary version before the weekend it was because it contained a fix of some of the issues we were having with our docs. That issue (and the one about file cleanup) have now been released in v1.4.4, so we can upgrade to a stable version and remove now-redundant cleanup code. --- website/clean-generated-docs.js | 26 -------------------------- website/package.json | 4 ++-- website/yarn.lock | 18 +++++++++--------- 3 files changed, 11 insertions(+), 37 deletions(-) diff --git a/website/clean-generated-docs.js b/website/clean-generated-docs.js index 4e739259c5..116a15ae60 100644 --- a/website/clean-generated-docs.js +++ b/website/clean-generated-docs.js @@ -28,29 +28,3 @@ const options = { }; replace(options); - -// remove unused tag files: https://github.com/Unleash/unleash/pull/2402 -const fs = require('fs'); - -const unleashOpenApiDirectory = './docs/reference/api/unleash'; -const unleashApiSidebar = require(`${unleashOpenApiDirectory}/sidebar.js`); - -const tagsInSidebar = new Set( - unleashApiSidebar - .map((item) => item.link?.id) - .filter(Boolean) - .map((link) => link.substring(link.lastIndexOf('/') + 1)), -); - -const tagsInFiles = fs - .readdirSync(unleashOpenApiDirectory) - .filter((file) => file.endsWith('.tag.mdx')) - .map((file) => file.substring(0, file.indexOf('.'))); - -const unusedTags = tagsInFiles.filter((tag) => !tagsInSidebar.has(tag)); - -for (const tag of unusedTags) { - const file = `${unleashOpenApiDirectory}/${tag}.tag.mdx`; - fs.rmSync(file); - console.info('Deleted unused OpenAPI tag file:', file); -} diff --git a/website/package.json b/website/package.json index 882841e39f..2372e73d5a 100644 --- a/website/package.json +++ b/website/package.json @@ -29,8 +29,8 @@ "@svgr/webpack": "6.5.1", "browserslist": "^4.16.5", "clsx": "1.2.1", - "docusaurus-plugin-openapi-docs": "0.0.0-514", - "docusaurus-theme-openapi-docs": "0.0.0-514", + "docusaurus-plugin-openapi-docs": "1.4.4", + "docusaurus-theme-openapi-docs": "1.4.4", "file-loader": "6.2.0", "immer": "^9.0.6", "react": "18.2.0", diff --git a/website/yarn.lock b/website/yarn.lock index 4b54274b50..203494e63e 100644 --- a/website/yarn.lock +++ b/website/yarn.lock @@ -6140,10 +6140,10 @@ doctrine@^3.0.0: dependencies: esutils "^2.0.2" -docusaurus-plugin-openapi-docs@0.0.0-514: - version "0.0.0-514" - resolved "https://registry.yarnpkg.com/docusaurus-plugin-openapi-docs/-/docusaurus-plugin-openapi-docs-0.0.0-514.tgz#2ea5a87bd1cd6829f74d8090479c25efa04872ec" - integrity sha512-HPGBMbcv7ibCHM+9l5aWp5VfW4UXAeMC3LtGqFYXqgvpzGPkDv1c+3DZXLEmEWotEWeHkzjP0b71GQq9L0YBnQ== +docusaurus-plugin-openapi-docs@1.4.4, docusaurus-plugin-openapi-docs@^1.4.4: + version "1.4.4" + resolved "https://registry.yarnpkg.com/docusaurus-plugin-openapi-docs/-/docusaurus-plugin-openapi-docs-1.4.4.tgz#eca4069649cc34c1c5ba96ebc8453674a4a978db" + integrity sha512-/qDuT9vVS0A1XUuXqYJyGpksZPvF15A8NtqAfLRXgC9HMJPhUyv84PqMK9WeqjzpIR4M3DdYEQRdqBTm+zaw3w== dependencies: "@apidevtools/json-schema-ref-parser" "^9.0.9" "@docusaurus/mdx-loader" "^2.0.1" @@ -6168,10 +6168,10 @@ docusaurus-plugin-openapi-docs@0.0.0-514: webpack "^5.61.0" xml-formatter "^2.6.1" -docusaurus-theme-openapi-docs@0.0.0-514: - version "0.0.0-514" - resolved "https://registry.yarnpkg.com/docusaurus-theme-openapi-docs/-/docusaurus-theme-openapi-docs-0.0.0-514.tgz#b359bf02353837f8553e5a2fe1eee1d09f39bb41" - integrity sha512-lM4GTYVZ99qmbw7llT8PWOZ7UHAJOfH3QwHqrPeWZOTlYBXaCl5C77vYWy71INCNaSICUHx7FdKgeenktglUpw== +docusaurus-theme-openapi-docs@1.4.4: + version "1.4.4" + resolved "https://registry.yarnpkg.com/docusaurus-theme-openapi-docs/-/docusaurus-theme-openapi-docs-1.4.4.tgz#caf793e0e379fbd4d32187e0909c7b347305a6f5" + integrity sha512-/sg1M0VhBzp0sCKGp8JuqX8ZjxbVFITkqLNfUPNAhhUvgQ8dzw88tAlGUVfcALmR9dVNM+Vw1Qsq1OXIAPVBow== dependencies: "@docusaurus/theme-common" "^2.0.1" "@mdx-js/react" "^1.6.21" @@ -6181,7 +6181,7 @@ docusaurus-theme-openapi-docs@0.0.0-514: buffer "^6.0.3" clsx "^1.1.1" crypto-js "^4.1.1" - docusaurus-plugin-openapi-docs "0.0.0-514" + docusaurus-plugin-openapi-docs "^1.4.4" file-saver "^2.0.5" immer "^9.0.7" lodash "^4.17.20"