1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
unleash.unleash/website/package.json

87 lines
2.5 KiB
JSON
Raw Normal View History

{
"name": "websitev-2",
"version": "0.0.0",
"private": true,
"engines": {
"node": ">=16.14"
},
"scripts": {
"docusaurus": "docusaurus",
"start": "docusaurus start",
2022-09-20 12:43:39 +02:00
"build": "yarn generate && docusaurus build",
"swizzle": "docusaurus swizzle",
2022-09-20 12:43:39 +02:00
"generate": "docusaurus gen-api-docs all && node clean-generated-docs.js",
"deploy": "yarn generate && docusaurus deploy",
"clear": "docusaurus clear",
"serve": "docusaurus serve",
"write-translations": "docusaurus write-translations",
2022-02-17 12:30:49 +01:00
"write-heading-ids": "docusaurus write-heading-ids",
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook"
},
"dependencies": {
chore: fix broken docs build / remove unused tag files (#2402) ## Issue So, we've got an issue with our docs build not working. When building for production, we get an error that looks a little bit like this: ``` $ docusaurus build [INFO] [en] Creating an optimized production build... ✔ Client ✖ Server Compiled with some errors in 40.85s TypeError: source_default(...).bold is not a function TypeError: source_default(...).bold is not a function [ERROR] Unable to build website for locale en. [ERROR] Error: Failed to compile with errors. at /Users/thomas/projects/work/unleash/website/node_modules/@docusaurus/core/lib/webpack/utils.js:180:24 at /Users/thomas/projects/work/unleash/website/node_modules/webpack/lib/MultiCompiler.js:554:14 at processQueueWorker (/Users/thomas/projects/work/unleash/website/node_modules/webpack/lib/MultiCompiler.js:491:6) at processTicksAndRejections (node:internal/process/task_queues:78:11) [INFO] Docusaurus version: 2.2.0 Node version: v16.14.0 error Command failed with exit code 1. ``` Which isn't very helpful at all. If you go into `/node_modules/@docusaurus/core/lib/client/serverEntry.js` and modify the `render` function to log the actual error and remove anything chalk-related, you get this instead: ``` $ docusaurus build [INFO] [en] Creating an optimized production build... ✔ Client ✖ Server Compiled with some errors in 44.62s Actual error: Error: Unexpected: cant find current sidebar in context at useCurrentSidebarCategory (main:11618:247) at MDXContent (main:38139:1593) at Fb (main:149154:44) at Ib (main:149156:254) at W (main:149162:89) at Jb (main:149165:98) at Ib (main:149157:145) at W (main:149162:89) at Jb (main:149165:98) at Ib (main:149157:145) Actual error: Error: Unexpected: cant find current sidebar in context at useCurrentSidebarCategory (main:11618:247) at MDXContent (main:38513:1469) at Fb (main:149154:44) at Ib (main:149156:254) at W (main:149162:89) at Jb (main:149165:98) at Ib (main:149157:145) at W (main:149162:89) at Jb (main:149165:98) at Ib (main:149157:145) Error: Unexpected: cant find current sidebar in context Error: Unexpected: cant find current sidebar in context [ERROR] Unable to build website for locale en. [ERROR] Error: Failed to compile with errors. at /Users/thomas/projects/work/unleash/website/node_modules/@docusaurus/core/lib/webpack/utils.js:180:24 at /Users/thomas/projects/work/unleash/website/node_modules/webpack/lib/MultiCompiler.js:554:14 at processQueueWorker (/Users/thomas/projects/work/unleash/website/node_modules/webpack/lib/MultiCompiler.js:491:6) at processTicksAndRejections (node:internal/process/task_queues:78:11) [INFO] Docusaurus version: 2.2.0 Node version: v16.14.0 error Command failed with exit code 1. ``` That's better, but it's still not very clear. ## Getting more info We've had problems with a similar error message before. Last time it was caused by an empty file that docusaurus couldn't process. A similar issue has also been described in [ this docusaurus GitHub issue ](https://github.com/facebook/docusaurus/issues/7686). That's also what gave me the idea of changing the logging in the dependency. I'm currently unsure whether this is caused by the openapi docs or something else. I've been in touch with the [openapi plugin maintainer](https://github.com/PaloAltoNetworks/docusaurus-openapi-docs/issues/323) and he has been able to see the same error when building for prod locally, but it was due to some old generated files. Worth noting: this only seems to affect the prod build. Building for dev (`yarn docusaurus start`) works just fine. It also fails locally **and** in CI, so it _is_ an issue. ## Updating the logging To get better logging, you can go into the `/node_modules/@docusaurus/core/lib/client/serverEntry.js` file and update the `render` function from ```js export default async function render(locals) { try { return await doRender(locals); } catch (err) { // We are not using logger in this file, because it seems to fail with some // compilers / some polyfill methods. This is very likely a bug, but in the // long term, when we output native ES modules in SSR, the bug will be gone. // prettier-ignore console.error(chalk.red(`${chalk.bold('[ERROR]')} Docusaurus server-side rendering could not render static page with path ${chalk.cyan.underline(locals.path)}.`)); const isNotDefinedErrorRegex = /(?:window|document|localStorage|navigator|alert|location|buffer|self) is not defined/i; if (isNotDefinedErrorRegex.test(err.message)) { // prettier-ignore console.info(`${chalk.cyan.bold('[INFO]')} It looks like you are using code that should run on the client-side only. To get around it, try using ${chalk.cyan('`<BrowserOnly>`')} (${chalk.cyan.underline('https://docusaurus.io/docs/docusaurus-core/#browseronly')}) or ${chalk.cyan('`ExecutionEnvironment`')} (${chalk.cyan.underline('https://docusaurus.io/docs/docusaurus-core/#executionenvironment')}). It might also require to wrap your client code in ${chalk.cyan('`useEffect`')} hook and/or import a third-party library dynamically (if any).`); } throw err; } } ``` to ```js export default async function render(locals) { try { return await doRender(locals); } catch (err) { console.error(err) throw err; } } ``` That'll yield the errors about the current sidebar in context. ## Root cause Found the issue! 🙋🏼 It's explained in [this comment on the openapi docs integration](https://github.com/PaloAltoNetworks/docusaurus-openapi-docs/issues/323#issuecomment-1311549864) for now, but in short: we have tags defined that we don't use. They're being picked up by docusaurus, but don't have the proper context. That's causing this. The previously mentioned comment is included here for easy finding in the future: ### Root cause explanation The OpenAPI spec we use to generate the docs has a number of tags listed at the root level. This is necessary for this plugin to pick up tag categories and is, as far as I can tell, also how it _should_ be done. However, not all of those tags are in use. Specifically, there's 2 tags that are not. When the plugin generates docs from the spec, it generates pages for all endpoints and all tags and groups them by tag. However, it seems likely that if a tag doesn't have any associated endpoints, then it won't get added to the sidebar because there's no endpoint that references it. But the doc files for these tags do end up lying around in the directory regardless, and when docusaurus tries to pick up the files in the generated directory, it also tries to pick up the unused tag files. But because they're not part of a sidebar, they end up throwing errors because they can't find the sidebar context. ### How I found it The fact that I got more instances of the error message without the sidebar ref than with it made me pay more attention to the number of errors. I decided to check how many files were in the generated directory and how many files were referenced from the generated sidebar. Turns out the difference there was **2**: there were two generated files in the directory that the sidebar didn't reference. At this point, it was easy enough to try and delete those files before rebuilding, and wouldn't you know: it worked! ### Our use case Now, why do we have tags that are unused in the root spec? Can't we just remove them? That's a good question with a bit of a complicated answer. Unleash uses an open core model and the OpenAPI integration is part of that open core. The closed-source parts of Unleash are located in another repo and extend the open-source distribution. Because the OpenAPI spec is configured in the open-source part, enterprise-only tags etc also need to be configured there. Then, when the changes are absorbed into enterprise, we can use the tags there. It gets more complicated because we use an enterprise instance to generate the docs (because we want enterprise-endpoints to be listed too). The instance uses the latest released instance of Unleash to have the docs most accurately reflect the current state of things. So, in this case, the tags have been added, but not yet used by any endpoints, which suddenly causes this build failure. We can add the tags to the enterprise-version, but the spec wouldn't be updated before the next release regardless, which will probably be in a week or so. This isn't an ideal setup, but .. it is what it is. ## Solutions and workarounds As mentioned in the previous section, the reason the build was failing was that there were unused tag files that docusaurus tried to include in the build. Because they don't belong to a sidebar, the compilation failed. I've reported the issue to the openapi plugin maintainers and am waiting for a response. However, it seems that having unused root tags declared is invalid according to the spec, so it's something we should look into fixing in the future. ### Current workaround: cleaning script The current workaround is to extend the api cleaning script to manually remove the unused tag files. ### Ideal solution: filter root-level tags Ideally, we shouldn't list unused OpenAPI tags on the root level at all. However, because of the way we add root-level tags (as a predefined, static lists, refer to `src/lib/openapi/index.ts`) and endpoints (dynamically added at runtime) today, we don't really have a clear way to filter the list of tags. This gets even more complicated when taking the enterprise functionality and the potential extra tags they must have. This is, however, something that should definitely be looked into. Working with OpenAPI across multipile repos is already troublesome, so this is just yet another thing to look into.
2022-11-11 14:01:54 +01:00
"@docusaurus/core": "2.2.0",
"@docusaurus/plugin-client-redirects": "2.2.0",
"@docusaurus/plugin-google-analytics": "2.2.0",
"@docusaurus/preset-classic": "2.2.0",
"@docusaurus/remark-plugin-npm2yarn": "2.2.0",
"@mdx-js/react": "1.6.22",
"@svgr/webpack": "6.5.1",
chore: fix broken docs build / remove unused tag files (#2402) ## Issue So, we've got an issue with our docs build not working. When building for production, we get an error that looks a little bit like this: ``` $ docusaurus build [INFO] [en] Creating an optimized production build... ✔ Client ✖ Server Compiled with some errors in 40.85s TypeError: source_default(...).bold is not a function TypeError: source_default(...).bold is not a function [ERROR] Unable to build website for locale en. [ERROR] Error: Failed to compile with errors. at /Users/thomas/projects/work/unleash/website/node_modules/@docusaurus/core/lib/webpack/utils.js:180:24 at /Users/thomas/projects/work/unleash/website/node_modules/webpack/lib/MultiCompiler.js:554:14 at processQueueWorker (/Users/thomas/projects/work/unleash/website/node_modules/webpack/lib/MultiCompiler.js:491:6) at processTicksAndRejections (node:internal/process/task_queues:78:11) [INFO] Docusaurus version: 2.2.0 Node version: v16.14.0 error Command failed with exit code 1. ``` Which isn't very helpful at all. If you go into `/node_modules/@docusaurus/core/lib/client/serverEntry.js` and modify the `render` function to log the actual error and remove anything chalk-related, you get this instead: ``` $ docusaurus build [INFO] [en] Creating an optimized production build... ✔ Client ✖ Server Compiled with some errors in 44.62s Actual error: Error: Unexpected: cant find current sidebar in context at useCurrentSidebarCategory (main:11618:247) at MDXContent (main:38139:1593) at Fb (main:149154:44) at Ib (main:149156:254) at W (main:149162:89) at Jb (main:149165:98) at Ib (main:149157:145) at W (main:149162:89) at Jb (main:149165:98) at Ib (main:149157:145) Actual error: Error: Unexpected: cant find current sidebar in context at useCurrentSidebarCategory (main:11618:247) at MDXContent (main:38513:1469) at Fb (main:149154:44) at Ib (main:149156:254) at W (main:149162:89) at Jb (main:149165:98) at Ib (main:149157:145) at W (main:149162:89) at Jb (main:149165:98) at Ib (main:149157:145) Error: Unexpected: cant find current sidebar in context Error: Unexpected: cant find current sidebar in context [ERROR] Unable to build website for locale en. [ERROR] Error: Failed to compile with errors. at /Users/thomas/projects/work/unleash/website/node_modules/@docusaurus/core/lib/webpack/utils.js:180:24 at /Users/thomas/projects/work/unleash/website/node_modules/webpack/lib/MultiCompiler.js:554:14 at processQueueWorker (/Users/thomas/projects/work/unleash/website/node_modules/webpack/lib/MultiCompiler.js:491:6) at processTicksAndRejections (node:internal/process/task_queues:78:11) [INFO] Docusaurus version: 2.2.0 Node version: v16.14.0 error Command failed with exit code 1. ``` That's better, but it's still not very clear. ## Getting more info We've had problems with a similar error message before. Last time it was caused by an empty file that docusaurus couldn't process. A similar issue has also been described in [ this docusaurus GitHub issue ](https://github.com/facebook/docusaurus/issues/7686). That's also what gave me the idea of changing the logging in the dependency. I'm currently unsure whether this is caused by the openapi docs or something else. I've been in touch with the [openapi plugin maintainer](https://github.com/PaloAltoNetworks/docusaurus-openapi-docs/issues/323) and he has been able to see the same error when building for prod locally, but it was due to some old generated files. Worth noting: this only seems to affect the prod build. Building for dev (`yarn docusaurus start`) works just fine. It also fails locally **and** in CI, so it _is_ an issue. ## Updating the logging To get better logging, you can go into the `/node_modules/@docusaurus/core/lib/client/serverEntry.js` file and update the `render` function from ```js export default async function render(locals) { try { return await doRender(locals); } catch (err) { // We are not using logger in this file, because it seems to fail with some // compilers / some polyfill methods. This is very likely a bug, but in the // long term, when we output native ES modules in SSR, the bug will be gone. // prettier-ignore console.error(chalk.red(`${chalk.bold('[ERROR]')} Docusaurus server-side rendering could not render static page with path ${chalk.cyan.underline(locals.path)}.`)); const isNotDefinedErrorRegex = /(?:window|document|localStorage|navigator|alert|location|buffer|self) is not defined/i; if (isNotDefinedErrorRegex.test(err.message)) { // prettier-ignore console.info(`${chalk.cyan.bold('[INFO]')} It looks like you are using code that should run on the client-side only. To get around it, try using ${chalk.cyan('`<BrowserOnly>`')} (${chalk.cyan.underline('https://docusaurus.io/docs/docusaurus-core/#browseronly')}) or ${chalk.cyan('`ExecutionEnvironment`')} (${chalk.cyan.underline('https://docusaurus.io/docs/docusaurus-core/#executionenvironment')}). It might also require to wrap your client code in ${chalk.cyan('`useEffect`')} hook and/or import a third-party library dynamically (if any).`); } throw err; } } ``` to ```js export default async function render(locals) { try { return await doRender(locals); } catch (err) { console.error(err) throw err; } } ``` That'll yield the errors about the current sidebar in context. ## Root cause Found the issue! 🙋🏼 It's explained in [this comment on the openapi docs integration](https://github.com/PaloAltoNetworks/docusaurus-openapi-docs/issues/323#issuecomment-1311549864) for now, but in short: we have tags defined that we don't use. They're being picked up by docusaurus, but don't have the proper context. That's causing this. The previously mentioned comment is included here for easy finding in the future: ### Root cause explanation The OpenAPI spec we use to generate the docs has a number of tags listed at the root level. This is necessary for this plugin to pick up tag categories and is, as far as I can tell, also how it _should_ be done. However, not all of those tags are in use. Specifically, there's 2 tags that are not. When the plugin generates docs from the spec, it generates pages for all endpoints and all tags and groups them by tag. However, it seems likely that if a tag doesn't have any associated endpoints, then it won't get added to the sidebar because there's no endpoint that references it. But the doc files for these tags do end up lying around in the directory regardless, and when docusaurus tries to pick up the files in the generated directory, it also tries to pick up the unused tag files. But because they're not part of a sidebar, they end up throwing errors because they can't find the sidebar context. ### How I found it The fact that I got more instances of the error message without the sidebar ref than with it made me pay more attention to the number of errors. I decided to check how many files were in the generated directory and how many files were referenced from the generated sidebar. Turns out the difference there was **2**: there were two generated files in the directory that the sidebar didn't reference. At this point, it was easy enough to try and delete those files before rebuilding, and wouldn't you know: it worked! ### Our use case Now, why do we have tags that are unused in the root spec? Can't we just remove them? That's a good question with a bit of a complicated answer. Unleash uses an open core model and the OpenAPI integration is part of that open core. The closed-source parts of Unleash are located in another repo and extend the open-source distribution. Because the OpenAPI spec is configured in the open-source part, enterprise-only tags etc also need to be configured there. Then, when the changes are absorbed into enterprise, we can use the tags there. It gets more complicated because we use an enterprise instance to generate the docs (because we want enterprise-endpoints to be listed too). The instance uses the latest released instance of Unleash to have the docs most accurately reflect the current state of things. So, in this case, the tags have been added, but not yet used by any endpoints, which suddenly causes this build failure. We can add the tags to the enterprise-version, but the spec wouldn't be updated before the next release regardless, which will probably be in a week or so. This isn't an ideal setup, but .. it is what it is. ## Solutions and workarounds As mentioned in the previous section, the reason the build was failing was that there were unused tag files that docusaurus tried to include in the build. Because they don't belong to a sidebar, the compilation failed. I've reported the issue to the openapi plugin maintainers and am waiting for a response. However, it seems that having unused root tags declared is invalid according to the spec, so it's something we should look into fixing in the future. ### Current workaround: cleaning script The current workaround is to extend the api cleaning script to manually remove the unused tag files. ### Ideal solution: filter root-level tags Ideally, we shouldn't list unused OpenAPI tags on the root level at all. However, because of the way we add root-level tags (as a predefined, static lists, refer to `src/lib/openapi/index.ts`) and endpoints (dynamically added at runtime) today, we don't really have a clear way to filter the list of tags. This gets even more complicated when taking the enterprise functionality and the potential extra tags they must have. This is, however, something that should definitely be looked into. Working with OpenAPI across multipile repos is already troublesome, so this is just yet another thing to look into.
2022-11-11 14:01:54 +01:00
"browserslist": "^4.16.5",
"clsx": "1.2.1",
fix(deps): update dependency docusaurus-plugin-openapi-docs to v1.4.7 (#2646) [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [docusaurus-plugin-openapi-docs](https://togithub.com/PaloAltoNetworks/docusaurus-openapi-docs) | [`1.4.5` -> `1.4.7`](https://renovatebot.com/diffs/npm/docusaurus-plugin-openapi-docs/1.4.5/1.4.7) | [![age](https://badges.renovateapi.com/packages/npm/docusaurus-plugin-openapi-docs/1.4.7/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/docusaurus-plugin-openapi-docs/1.4.7/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/docusaurus-plugin-openapi-docs/1.4.7/compatibility-slim/1.4.5)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/docusaurus-plugin-openapi-docs/1.4.7/confidence-slim/1.4.5)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>PaloAltoNetworks/docusaurus-openapi-docs</summary> ### [`v1.4.7`](https://togithub.com/PaloAltoNetworks/docusaurus-openapi-docs/blob/HEAD/CHANGELOG.md#&#8203;147-Dec-2-2022) [Compare Source](https://togithub.com/PaloAltoNetworks/docusaurus-openapi-docs/compare/v1.4.6...v1.4.7) High level enhancements - Emergency patch to address regression bug introdudced by [#&#8203;351](https://togithub.com/PaloAltoNetworks/docusaurus-openapi-docs/issues/351) Other enhancements and bug fixes - Import markdown utils from lib ([#&#8203;358](https://togithub.com/PaloAltoNetworks/docusaurus-openapi-docs/pull/358)) ### [`v1.4.6`](https://togithub.com/PaloAltoNetworks/docusaurus-openapi-docs/blob/HEAD/CHANGELOG.md#&#8203;146-Dec-2-2022) [Compare Source](https://togithub.com/PaloAltoNetworks/docusaurus-openapi-docs/compare/v1.4.5...v1.4.6) High level enhancements - Added support for swizzling `ApiItem` and `ApiDemoPanel` components! Other enhancements and bug fixes - Remove createProperties from items anyOneOf condition and add new condition for handling items.properties ([#&#8203;356](https://togithub.com/PaloAltoNetworks/docusaurus-openapi-docs/pull/356)) - \[Enhancement] Allow whitespace in key/token/password input ([#&#8203;354](https://togithub.com/PaloAltoNetworks/docusaurus-openapi-docs/pull/354)) - \[Bug] Respect readOnly/writeOnly when creating example from schema ([#&#8203;353](https://togithub.com/PaloAltoNetworks/docusaurus-openapi-docs/pull/353)) - \[Bug] Import Body from [@&#8203;theme](https://togithub.com/theme) in makeRequest ([#&#8203;352](https://togithub.com/PaloAltoNetworks/docusaurus-openapi-docs/pull/352)) - \[Experimental] Improve support for swizzling theme components ([#&#8203;351](https://togithub.com/PaloAltoNetworks/docusaurus-openapi-docs/pull/351)) - Bump loader-utils from 2.0.3 to 2.0.4 ([#&#8203;346](https://togithub.com/PaloAltoNetworks/docusaurus-openapi-docs/pull/346)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/Unleash/unleash). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC41MS4wIiwidXBkYXRlZEluVmVyIjoiMzQuNTEuMCJ9--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-12-09 08:55:01 +01:00
"docusaurus-plugin-openapi-docs": "1.4.7",
fix(deps): update dependency docusaurus-theme-openapi-docs to v1.4.7 (#2652) [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [docusaurus-theme-openapi-docs](https://togithub.com/PaloAltoNetworks/docusaurus-openapi-docs) | [`1.4.5` -> `1.4.7`](https://renovatebot.com/diffs/npm/docusaurus-theme-openapi-docs/1.4.5/1.4.7) | [![age](https://badges.renovateapi.com/packages/npm/docusaurus-theme-openapi-docs/1.4.7/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/docusaurus-theme-openapi-docs/1.4.7/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/docusaurus-theme-openapi-docs/1.4.7/compatibility-slim/1.4.5)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/docusaurus-theme-openapi-docs/1.4.7/confidence-slim/1.4.5)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>PaloAltoNetworks/docusaurus-openapi-docs</summary> ### [`v1.4.7`](https://togithub.com/PaloAltoNetworks/docusaurus-openapi-docs/blob/HEAD/CHANGELOG.md#&#8203;147-Dec-2-2022) [Compare Source](https://togithub.com/PaloAltoNetworks/docusaurus-openapi-docs/compare/v1.4.6...v1.4.7) High level enhancements - Emergency patch to address regression bug introdudced by [#&#8203;351](https://togithub.com/PaloAltoNetworks/docusaurus-openapi-docs/issues/351) Other enhancements and bug fixes - Import markdown utils from lib ([#&#8203;358](https://togithub.com/PaloAltoNetworks/docusaurus-openapi-docs/pull/358)) ### [`v1.4.6`](https://togithub.com/PaloAltoNetworks/docusaurus-openapi-docs/blob/HEAD/CHANGELOG.md#&#8203;146-Dec-2-2022) [Compare Source](https://togithub.com/PaloAltoNetworks/docusaurus-openapi-docs/compare/v1.4.5...v1.4.6) High level enhancements - Added support for swizzling `ApiItem` and `ApiDemoPanel` components! Other enhancements and bug fixes - Remove createProperties from items anyOneOf condition and add new condition for handling items.properties ([#&#8203;356](https://togithub.com/PaloAltoNetworks/docusaurus-openapi-docs/pull/356)) - \[Enhancement] Allow whitespace in key/token/password input ([#&#8203;354](https://togithub.com/PaloAltoNetworks/docusaurus-openapi-docs/pull/354)) - \[Bug] Respect readOnly/writeOnly when creating example from schema ([#&#8203;353](https://togithub.com/PaloAltoNetworks/docusaurus-openapi-docs/pull/353)) - \[Bug] Import Body from [@&#8203;theme](https://togithub.com/theme) in makeRequest ([#&#8203;352](https://togithub.com/PaloAltoNetworks/docusaurus-openapi-docs/pull/352)) - \[Experimental] Improve support for swizzling theme components ([#&#8203;351](https://togithub.com/PaloAltoNetworks/docusaurus-openapi-docs/pull/351)) - Bump loader-utils from 2.0.3 to 2.0.4 ([#&#8203;346](https://togithub.com/PaloAltoNetworks/docusaurus-openapi-docs/pull/346)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/Unleash/unleash). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC41MS4wIiwidXBkYXRlZEluVmVyIjoiMzQuNTEuMCJ9--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-12-09 21:17:43 +01:00
"docusaurus-theme-openapi-docs": "1.4.7",
"file-loader": "6.2.0",
chore: fix broken docs build / remove unused tag files (#2402) ## Issue So, we've got an issue with our docs build not working. When building for production, we get an error that looks a little bit like this: ``` $ docusaurus build [INFO] [en] Creating an optimized production build... ✔ Client ✖ Server Compiled with some errors in 40.85s TypeError: source_default(...).bold is not a function TypeError: source_default(...).bold is not a function [ERROR] Unable to build website for locale en. [ERROR] Error: Failed to compile with errors. at /Users/thomas/projects/work/unleash/website/node_modules/@docusaurus/core/lib/webpack/utils.js:180:24 at /Users/thomas/projects/work/unleash/website/node_modules/webpack/lib/MultiCompiler.js:554:14 at processQueueWorker (/Users/thomas/projects/work/unleash/website/node_modules/webpack/lib/MultiCompiler.js:491:6) at processTicksAndRejections (node:internal/process/task_queues:78:11) [INFO] Docusaurus version: 2.2.0 Node version: v16.14.0 error Command failed with exit code 1. ``` Which isn't very helpful at all. If you go into `/node_modules/@docusaurus/core/lib/client/serverEntry.js` and modify the `render` function to log the actual error and remove anything chalk-related, you get this instead: ``` $ docusaurus build [INFO] [en] Creating an optimized production build... ✔ Client ✖ Server Compiled with some errors in 44.62s Actual error: Error: Unexpected: cant find current sidebar in context at useCurrentSidebarCategory (main:11618:247) at MDXContent (main:38139:1593) at Fb (main:149154:44) at Ib (main:149156:254) at W (main:149162:89) at Jb (main:149165:98) at Ib (main:149157:145) at W (main:149162:89) at Jb (main:149165:98) at Ib (main:149157:145) Actual error: Error: Unexpected: cant find current sidebar in context at useCurrentSidebarCategory (main:11618:247) at MDXContent (main:38513:1469) at Fb (main:149154:44) at Ib (main:149156:254) at W (main:149162:89) at Jb (main:149165:98) at Ib (main:149157:145) at W (main:149162:89) at Jb (main:149165:98) at Ib (main:149157:145) Error: Unexpected: cant find current sidebar in context Error: Unexpected: cant find current sidebar in context [ERROR] Unable to build website for locale en. [ERROR] Error: Failed to compile with errors. at /Users/thomas/projects/work/unleash/website/node_modules/@docusaurus/core/lib/webpack/utils.js:180:24 at /Users/thomas/projects/work/unleash/website/node_modules/webpack/lib/MultiCompiler.js:554:14 at processQueueWorker (/Users/thomas/projects/work/unleash/website/node_modules/webpack/lib/MultiCompiler.js:491:6) at processTicksAndRejections (node:internal/process/task_queues:78:11) [INFO] Docusaurus version: 2.2.0 Node version: v16.14.0 error Command failed with exit code 1. ``` That's better, but it's still not very clear. ## Getting more info We've had problems with a similar error message before. Last time it was caused by an empty file that docusaurus couldn't process. A similar issue has also been described in [ this docusaurus GitHub issue ](https://github.com/facebook/docusaurus/issues/7686). That's also what gave me the idea of changing the logging in the dependency. I'm currently unsure whether this is caused by the openapi docs or something else. I've been in touch with the [openapi plugin maintainer](https://github.com/PaloAltoNetworks/docusaurus-openapi-docs/issues/323) and he has been able to see the same error when building for prod locally, but it was due to some old generated files. Worth noting: this only seems to affect the prod build. Building for dev (`yarn docusaurus start`) works just fine. It also fails locally **and** in CI, so it _is_ an issue. ## Updating the logging To get better logging, you can go into the `/node_modules/@docusaurus/core/lib/client/serverEntry.js` file and update the `render` function from ```js export default async function render(locals) { try { return await doRender(locals); } catch (err) { // We are not using logger in this file, because it seems to fail with some // compilers / some polyfill methods. This is very likely a bug, but in the // long term, when we output native ES modules in SSR, the bug will be gone. // prettier-ignore console.error(chalk.red(`${chalk.bold('[ERROR]')} Docusaurus server-side rendering could not render static page with path ${chalk.cyan.underline(locals.path)}.`)); const isNotDefinedErrorRegex = /(?:window|document|localStorage|navigator|alert|location|buffer|self) is not defined/i; if (isNotDefinedErrorRegex.test(err.message)) { // prettier-ignore console.info(`${chalk.cyan.bold('[INFO]')} It looks like you are using code that should run on the client-side only. To get around it, try using ${chalk.cyan('`<BrowserOnly>`')} (${chalk.cyan.underline('https://docusaurus.io/docs/docusaurus-core/#browseronly')}) or ${chalk.cyan('`ExecutionEnvironment`')} (${chalk.cyan.underline('https://docusaurus.io/docs/docusaurus-core/#executionenvironment')}). It might also require to wrap your client code in ${chalk.cyan('`useEffect`')} hook and/or import a third-party library dynamically (if any).`); } throw err; } } ``` to ```js export default async function render(locals) { try { return await doRender(locals); } catch (err) { console.error(err) throw err; } } ``` That'll yield the errors about the current sidebar in context. ## Root cause Found the issue! 🙋🏼 It's explained in [this comment on the openapi docs integration](https://github.com/PaloAltoNetworks/docusaurus-openapi-docs/issues/323#issuecomment-1311549864) for now, but in short: we have tags defined that we don't use. They're being picked up by docusaurus, but don't have the proper context. That's causing this. The previously mentioned comment is included here for easy finding in the future: ### Root cause explanation The OpenAPI spec we use to generate the docs has a number of tags listed at the root level. This is necessary for this plugin to pick up tag categories and is, as far as I can tell, also how it _should_ be done. However, not all of those tags are in use. Specifically, there's 2 tags that are not. When the plugin generates docs from the spec, it generates pages for all endpoints and all tags and groups them by tag. However, it seems likely that if a tag doesn't have any associated endpoints, then it won't get added to the sidebar because there's no endpoint that references it. But the doc files for these tags do end up lying around in the directory regardless, and when docusaurus tries to pick up the files in the generated directory, it also tries to pick up the unused tag files. But because they're not part of a sidebar, they end up throwing errors because they can't find the sidebar context. ### How I found it The fact that I got more instances of the error message without the sidebar ref than with it made me pay more attention to the number of errors. I decided to check how many files were in the generated directory and how many files were referenced from the generated sidebar. Turns out the difference there was **2**: there were two generated files in the directory that the sidebar didn't reference. At this point, it was easy enough to try and delete those files before rebuilding, and wouldn't you know: it worked! ### Our use case Now, why do we have tags that are unused in the root spec? Can't we just remove them? That's a good question with a bit of a complicated answer. Unleash uses an open core model and the OpenAPI integration is part of that open core. The closed-source parts of Unleash are located in another repo and extend the open-source distribution. Because the OpenAPI spec is configured in the open-source part, enterprise-only tags etc also need to be configured there. Then, when the changes are absorbed into enterprise, we can use the tags there. It gets more complicated because we use an enterprise instance to generate the docs (because we want enterprise-endpoints to be listed too). The instance uses the latest released instance of Unleash to have the docs most accurately reflect the current state of things. So, in this case, the tags have been added, but not yet used by any endpoints, which suddenly causes this build failure. We can add the tags to the enterprise-version, but the spec wouldn't be updated before the next release regardless, which will probably be in a week or so. This isn't an ideal setup, but .. it is what it is. ## Solutions and workarounds As mentioned in the previous section, the reason the build was failing was that there were unused tag files that docusaurus tried to include in the build. Because they don't belong to a sidebar, the compilation failed. I've reported the issue to the openapi plugin maintainers and am waiting for a response. However, it seems that having unused root tags declared is invalid according to the spec, so it's something we should look into fixing in the future. ### Current workaround: cleaning script The current workaround is to extend the api cleaning script to manually remove the unused tag files. ### Ideal solution: filter root-level tags Ideally, we shouldn't list unused OpenAPI tags on the root level at all. However, because of the way we add root-level tags (as a predefined, static lists, refer to `src/lib/openapi/index.ts`) and endpoints (dynamically added at runtime) today, we don't really have a clear way to filter the list of tags. This gets even more complicated when taking the enterprise functionality and the potential extra tags they must have. This is, however, something that should definitely be looked into. Working with OpenAPI across multipile repos is already troublesome, so this is just yet another thing to look into.
2022-11-11 14:01:54 +01:00
"immer": "^9.0.6",
"react": "18.2.0",
"react-dom": "18.2.0",
"unleash-proxy-client": "2.3.0",
"url-loader": "4.1.1"
},
"resolutions": {
2022-08-26 10:27:30 +02:00
"async": "^3.2.4",
"trim": "^1.0.0",
"got": "^11.8.5",
"glob-parent": "^6.0.0",
2021-09-20 12:37:53 +02:00
"browserslist": "^4.16.5",
"set-value": "^4.0.1",
2021-09-27 13:26:18 +02:00
"immer": "^9.0.6",
"ansi-regex": "^5.0.1",
2022-08-26 10:27:30 +02:00
"nth-check": "^2.0.1",
"shelljs": "^0.8.5",
2022-11-03 14:43:36 +01:00
"trim-newlines": "^4.0.0",
"minimatch": "^5.0.0",
2022-12-08 11:32:22 +01:00
"decode-uri-component": "^0.2.1",
"qs": "^6.9.7"
},
"browserslist": {
"production": [
">0.5%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
2022-02-17 12:30:49 +01:00
},
"devDependencies": {
chore(deps): update dependency @babel/core to v7.20.7 (#2740) [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@babel/core](https://babel.dev/docs/en/next/babel-core) ([source](https://togithub.com/babel/babel)) | [`7.20.5` -> `7.20.7`](https://renovatebot.com/diffs/npm/@babel%2fcore/7.20.5/7.20.7) | [![age](https://badges.renovateapi.com/packages/npm/@babel%2fcore/7.20.7/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@babel%2fcore/7.20.7/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@babel%2fcore/7.20.7/compatibility-slim/7.20.5)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@babel%2fcore/7.20.7/confidence-slim/7.20.5)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>babel/babel</summary> ### [`v7.20.7`](https://togithub.com/babel/babel/blob/HEAD/CHANGELOG.md#v7207-2022-12-22) [Compare Source](https://togithub.com/babel/babel/compare/v7.20.5...v7.20.7) ##### :eyeglasses: Spec Compliance - `babel-helper-member-expression-to-functions`, `babel-helper-replace-supers`, `babel-plugin-proposal-class-properties`, `babel-plugin-transform-classes` - [#&#8203;15223](https://togithub.com/babel/babel/pull/15223) fix: Deleting super property should throw ([@&#8203;SuperSodaSea](https://togithub.com/SuperSodaSea)) - `babel-helpers`, `babel-plugin-proposal-class-properties`, `babel-plugin-transform-classes`, `babel-plugin-transform-object-super` - [#&#8203;15241](https://togithub.com/babel/babel/pull/15241) fix: Throw correct error types from sed ant class TDZ helpers ([@&#8203;SuperSodaSea](https://togithub.com/SuperSodaSea)) ##### :bug: Bug Fix - `babel-parser`, `babel-plugin-transform-typescript` - [#&#8203;15209](https://togithub.com/babel/babel/pull/15209) fix: Support auto accessors with TypeScript annotations ([@&#8203;liuxingbaoyu](https://togithub.com/liuxingbaoyu)) - `babel-traverse` - [#&#8203;15287](https://togithub.com/babel/babel/pull/15287) Fix `.parentPath` after rename in `SwitchCase` ([@&#8203;nicolo-ribaudo](https://togithub.com/nicolo-ribaudo)) - `babel-plugin-transform-typescript`, `babel-traverse` - [#&#8203;15284](https://togithub.com/babel/babel/pull/15284) fix: Ts import type and func with duplicate name ([@&#8203;liuxingbaoyu](https://togithub.com/liuxingbaoyu)) - `babel-plugin-transform-block-scoping` - [#&#8203;15278](https://togithub.com/babel/babel/pull/15278) Fix tdz analysis for reassigned captured for bindings ([@&#8203;nicolo-ribaudo](https://togithub.com/nicolo-ribaudo)) - `babel-plugin-proposal-async-generator-functions`, `babel-preset-env` - [#&#8203;15235](https://togithub.com/babel/babel/pull/15235) fix: Transform `for await` with shadowed variables ([@&#8203;liuxingbaoyu](https://togithub.com/liuxingbaoyu)) - `babel-generator`, `babel-plugin-proposal-optional-chaining` - [#&#8203;15258](https://togithub.com/babel/babel/pull/15258) fix: Correctly generate `(a ?? b) as T` ([@&#8203;liuxingbaoyu](https://togithub.com/liuxingbaoyu)) - `babel-plugin-transform-react-jsx`, `babel-types` - [#&#8203;15233](https://togithub.com/babel/babel/pull/15233) fix: Emit correct sourcemap ranges for `JSXText` ([@&#8203;liuxingbaoyu](https://togithub.com/liuxingbaoyu)) - `babel-core`, `babel-helpers`, `babel-plugin-transform-computed-properties`, `babel-runtime-corejs2`, `babel-runtime-corejs3`, `babel-runtime` - [#&#8203;15232](https://togithub.com/babel/babel/pull/15232) fix: Computed properties should keep original definition order ([@&#8203;SuperSodaSea](https://togithub.com/SuperSodaSea)) - `babel-helper-member-expression-to-functions`, `babel-helper-replace-supers`, `babel-plugin-proposal-class-properties`, `babel-plugin-transform-classes` - [#&#8203;15223](https://togithub.com/babel/babel/pull/15223) fix: Deleting super property should throw ([@&#8203;SuperSodaSea](https://togithub.com/SuperSodaSea)) - `babel-generator` - [#&#8203;15216](https://togithub.com/babel/babel/pull/15216) fix: Print newlines for leading Comments of `TSEnumMember` ([@&#8203;liuxingbaoyu](https://togithub.com/liuxingbaoyu)) ##### :nail_care: Polish - `babel-plugin-transform-block-scoping`, `babel-traverse` - [#&#8203;15275](https://togithub.com/babel/babel/pull/15275) Improve relative execution tracking in fn exprs ([@&#8203;nicolo-ribaudo](https://togithub.com/nicolo-ribaudo)) ##### :house: Internal - `babel-helper-define-map`, `babel-plugin-transform-property-mutators` - [#&#8203;15274](https://togithub.com/babel/babel/pull/15274) Inline & simplify `@babel/helper-define-map` ([@&#8203;nicolo-ribaudo](https://togithub.com/nicolo-ribaudo)) - `babel-core`, `babel-plugin-proposal-class-properties`, `babel-plugin-transform-block-scoping`, `babel-plugin-transform-classes`, `babel-plugin-transform-destructuring`, `babel-plugin-transform-parameters`, `babel-plugin-transform-regenerator`, `babel-plugin-transform-runtime`, `babel-preset-env`, `babel-traverse` - [#&#8203;15200](https://togithub.com/babel/babel/pull/15200) Rewrite `transform-block-scoping` plugin ([@&#8203;nicolo-ribaudo](https://togithub.com/nicolo-ribaudo)) ##### :running_woman: Performance - `babel-helper-compilation-targets` - [#&#8203;15228](https://togithub.com/babel/babel/pull/15228) perf: Speed up `getTargets` ([@&#8203;liuxingbaoyu](https://togithub.com/liuxingbaoyu)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/Unleash/unleash). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC43My4zIiwidXBkYXRlZEluVmVyIjoiMzQuNzMuMyJ9--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-12-27 11:07:48 +01:00
"@babel/core": "7.20.7",
chore: fix broken docs build / remove unused tag files (#2402) ## Issue So, we've got an issue with our docs build not working. When building for production, we get an error that looks a little bit like this: ``` $ docusaurus build [INFO] [en] Creating an optimized production build... ✔ Client ✖ Server Compiled with some errors in 40.85s TypeError: source_default(...).bold is not a function TypeError: source_default(...).bold is not a function [ERROR] Unable to build website for locale en. [ERROR] Error: Failed to compile with errors. at /Users/thomas/projects/work/unleash/website/node_modules/@docusaurus/core/lib/webpack/utils.js:180:24 at /Users/thomas/projects/work/unleash/website/node_modules/webpack/lib/MultiCompiler.js:554:14 at processQueueWorker (/Users/thomas/projects/work/unleash/website/node_modules/webpack/lib/MultiCompiler.js:491:6) at processTicksAndRejections (node:internal/process/task_queues:78:11) [INFO] Docusaurus version: 2.2.0 Node version: v16.14.0 error Command failed with exit code 1. ``` Which isn't very helpful at all. If you go into `/node_modules/@docusaurus/core/lib/client/serverEntry.js` and modify the `render` function to log the actual error and remove anything chalk-related, you get this instead: ``` $ docusaurus build [INFO] [en] Creating an optimized production build... ✔ Client ✖ Server Compiled with some errors in 44.62s Actual error: Error: Unexpected: cant find current sidebar in context at useCurrentSidebarCategory (main:11618:247) at MDXContent (main:38139:1593) at Fb (main:149154:44) at Ib (main:149156:254) at W (main:149162:89) at Jb (main:149165:98) at Ib (main:149157:145) at W (main:149162:89) at Jb (main:149165:98) at Ib (main:149157:145) Actual error: Error: Unexpected: cant find current sidebar in context at useCurrentSidebarCategory (main:11618:247) at MDXContent (main:38513:1469) at Fb (main:149154:44) at Ib (main:149156:254) at W (main:149162:89) at Jb (main:149165:98) at Ib (main:149157:145) at W (main:149162:89) at Jb (main:149165:98) at Ib (main:149157:145) Error: Unexpected: cant find current sidebar in context Error: Unexpected: cant find current sidebar in context [ERROR] Unable to build website for locale en. [ERROR] Error: Failed to compile with errors. at /Users/thomas/projects/work/unleash/website/node_modules/@docusaurus/core/lib/webpack/utils.js:180:24 at /Users/thomas/projects/work/unleash/website/node_modules/webpack/lib/MultiCompiler.js:554:14 at processQueueWorker (/Users/thomas/projects/work/unleash/website/node_modules/webpack/lib/MultiCompiler.js:491:6) at processTicksAndRejections (node:internal/process/task_queues:78:11) [INFO] Docusaurus version: 2.2.0 Node version: v16.14.0 error Command failed with exit code 1. ``` That's better, but it's still not very clear. ## Getting more info We've had problems with a similar error message before. Last time it was caused by an empty file that docusaurus couldn't process. A similar issue has also been described in [ this docusaurus GitHub issue ](https://github.com/facebook/docusaurus/issues/7686). That's also what gave me the idea of changing the logging in the dependency. I'm currently unsure whether this is caused by the openapi docs or something else. I've been in touch with the [openapi plugin maintainer](https://github.com/PaloAltoNetworks/docusaurus-openapi-docs/issues/323) and he has been able to see the same error when building for prod locally, but it was due to some old generated files. Worth noting: this only seems to affect the prod build. Building for dev (`yarn docusaurus start`) works just fine. It also fails locally **and** in CI, so it _is_ an issue. ## Updating the logging To get better logging, you can go into the `/node_modules/@docusaurus/core/lib/client/serverEntry.js` file and update the `render` function from ```js export default async function render(locals) { try { return await doRender(locals); } catch (err) { // We are not using logger in this file, because it seems to fail with some // compilers / some polyfill methods. This is very likely a bug, but in the // long term, when we output native ES modules in SSR, the bug will be gone. // prettier-ignore console.error(chalk.red(`${chalk.bold('[ERROR]')} Docusaurus server-side rendering could not render static page with path ${chalk.cyan.underline(locals.path)}.`)); const isNotDefinedErrorRegex = /(?:window|document|localStorage|navigator|alert|location|buffer|self) is not defined/i; if (isNotDefinedErrorRegex.test(err.message)) { // prettier-ignore console.info(`${chalk.cyan.bold('[INFO]')} It looks like you are using code that should run on the client-side only. To get around it, try using ${chalk.cyan('`<BrowserOnly>`')} (${chalk.cyan.underline('https://docusaurus.io/docs/docusaurus-core/#browseronly')}) or ${chalk.cyan('`ExecutionEnvironment`')} (${chalk.cyan.underline('https://docusaurus.io/docs/docusaurus-core/#executionenvironment')}). It might also require to wrap your client code in ${chalk.cyan('`useEffect`')} hook and/or import a third-party library dynamically (if any).`); } throw err; } } ``` to ```js export default async function render(locals) { try { return await doRender(locals); } catch (err) { console.error(err) throw err; } } ``` That'll yield the errors about the current sidebar in context. ## Root cause Found the issue! 🙋🏼 It's explained in [this comment on the openapi docs integration](https://github.com/PaloAltoNetworks/docusaurus-openapi-docs/issues/323#issuecomment-1311549864) for now, but in short: we have tags defined that we don't use. They're being picked up by docusaurus, but don't have the proper context. That's causing this. The previously mentioned comment is included here for easy finding in the future: ### Root cause explanation The OpenAPI spec we use to generate the docs has a number of tags listed at the root level. This is necessary for this plugin to pick up tag categories and is, as far as I can tell, also how it _should_ be done. However, not all of those tags are in use. Specifically, there's 2 tags that are not. When the plugin generates docs from the spec, it generates pages for all endpoints and all tags and groups them by tag. However, it seems likely that if a tag doesn't have any associated endpoints, then it won't get added to the sidebar because there's no endpoint that references it. But the doc files for these tags do end up lying around in the directory regardless, and when docusaurus tries to pick up the files in the generated directory, it also tries to pick up the unused tag files. But because they're not part of a sidebar, they end up throwing errors because they can't find the sidebar context. ### How I found it The fact that I got more instances of the error message without the sidebar ref than with it made me pay more attention to the number of errors. I decided to check how many files were in the generated directory and how many files were referenced from the generated sidebar. Turns out the difference there was **2**: there were two generated files in the directory that the sidebar didn't reference. At this point, it was easy enough to try and delete those files before rebuilding, and wouldn't you know: it worked! ### Our use case Now, why do we have tags that are unused in the root spec? Can't we just remove them? That's a good question with a bit of a complicated answer. Unleash uses an open core model and the OpenAPI integration is part of that open core. The closed-source parts of Unleash are located in another repo and extend the open-source distribution. Because the OpenAPI spec is configured in the open-source part, enterprise-only tags etc also need to be configured there. Then, when the changes are absorbed into enterprise, we can use the tags there. It gets more complicated because we use an enterprise instance to generate the docs (because we want enterprise-endpoints to be listed too). The instance uses the latest released instance of Unleash to have the docs most accurately reflect the current state of things. So, in this case, the tags have been added, but not yet used by any endpoints, which suddenly causes this build failure. We can add the tags to the enterprise-version, but the spec wouldn't be updated before the next release regardless, which will probably be in a week or so. This isn't an ideal setup, but .. it is what it is. ## Solutions and workarounds As mentioned in the previous section, the reason the build was failing was that there were unused tag files that docusaurus tried to include in the build. Because they don't belong to a sidebar, the compilation failed. I've reported the issue to the openapi plugin maintainers and am waiting for a response. However, it seems that having unused root tags declared is invalid according to the spec, so it's something we should look into fixing in the future. ### Current workaround: cleaning script The current workaround is to extend the api cleaning script to manually remove the unused tag files. ### Ideal solution: filter root-level tags Ideally, we shouldn't list unused OpenAPI tags on the root level at all. However, because of the way we add root-level tags (as a predefined, static lists, refer to `src/lib/openapi/index.ts`) and endpoints (dynamically added at runtime) today, we don't really have a clear way to filter the list of tags. This gets even more complicated when taking the enterprise functionality and the potential extra tags they must have. This is, however, something that should definitely be looked into. Working with OpenAPI across multipile repos is already troublesome, so this is just yet another thing to look into.
2022-11-11 14:01:54 +01:00
"@docusaurus/module-type-aliases": "2.2.0",
chore(deps): update storybook monorepo to v6.5.14 (#2645) [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@storybook/addon-actions](https://togithub.com/storybookjs/storybook/tree/main/addons/actions) ([source](https://togithub.com/storybookjs/storybook)) | [`6.5.13` -> `6.5.14`](https://renovatebot.com/diffs/npm/@storybook%2faddon-actions/6.5.13/6.5.14) | [![age](https://badges.renovateapi.com/packages/npm/@storybook%2faddon-actions/6.5.14/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@storybook%2faddon-actions/6.5.14/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@storybook%2faddon-actions/6.5.14/compatibility-slim/6.5.13)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@storybook%2faddon-actions/6.5.14/confidence-slim/6.5.13)](https://docs.renovatebot.com/merge-confidence/) | | [@storybook/addon-essentials](https://togithub.com/storybookjs/storybook/tree/main/addons/essentials) ([source](https://togithub.com/storybookjs/storybook)) | [`6.5.13` -> `6.5.14`](https://renovatebot.com/diffs/npm/@storybook%2faddon-essentials/6.5.13/6.5.14) | [![age](https://badges.renovateapi.com/packages/npm/@storybook%2faddon-essentials/6.5.14/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@storybook%2faddon-essentials/6.5.14/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@storybook%2faddon-essentials/6.5.14/compatibility-slim/6.5.13)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@storybook%2faddon-essentials/6.5.14/confidence-slim/6.5.13)](https://docs.renovatebot.com/merge-confidence/) | | [@storybook/addon-interactions](https://togithub.com/storybookjs/storybook/tree/main/addons/interactions) ([source](https://togithub.com/storybookjs/storybook)) | [`6.5.13` -> `6.5.14`](https://renovatebot.com/diffs/npm/@storybook%2faddon-interactions/6.5.13/6.5.14) | [![age](https://badges.renovateapi.com/packages/npm/@storybook%2faddon-interactions/6.5.14/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@storybook%2faddon-interactions/6.5.14/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@storybook%2faddon-interactions/6.5.14/compatibility-slim/6.5.13)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@storybook%2faddon-interactions/6.5.14/confidence-slim/6.5.13)](https://docs.renovatebot.com/merge-confidence/) | | [@storybook/addon-links](https://togithub.com/storybookjs/storybook/tree/main/addons/links) ([source](https://togithub.com/storybookjs/storybook)) | [`6.5.13` -> `6.5.14`](https://renovatebot.com/diffs/npm/@storybook%2faddon-links/6.5.13/6.5.14) | [![age](https://badges.renovateapi.com/packages/npm/@storybook%2faddon-links/6.5.14/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@storybook%2faddon-links/6.5.14/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@storybook%2faddon-links/6.5.14/compatibility-slim/6.5.13)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@storybook%2faddon-links/6.5.14/confidence-slim/6.5.13)](https://docs.renovatebot.com/merge-confidence/) | | [@storybook/react](https://togithub.com/storybookjs/storybook/tree/main/app/react) ([source](https://togithub.com/storybookjs/storybook)) | [`6.5.13` -> `6.5.14`](https://renovatebot.com/diffs/npm/@storybook%2freact/6.5.13/6.5.14) | [![age](https://badges.renovateapi.com/packages/npm/@storybook%2freact/6.5.14/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@storybook%2freact/6.5.14/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@storybook%2freact/6.5.14/compatibility-slim/6.5.13)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@storybook%2freact/6.5.14/confidence-slim/6.5.13)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>storybookjs/storybook</summary> ### [`v6.5.14`](https://togithub.com/storybookjs/storybook/releases/tag/v6.5.14) [Compare Source](https://togithub.com/storybookjs/storybook/compare/v6.5.13...v6.5.14) ##### Bug Fixes - Angular: Fix "**webpack_require**.nmd is not a function issue" in Angular 15 [#&#8203;20043](https://togithub.com/storybooks/storybook/pull/20043) - CLI/React native: Fix addons template to import register instead of manager [#&#8203;19620](https://togithub.com/storybooks/storybook/pull/19620) ##### Maintenance - Core: Patch preview-web and refs to support React Native [#&#8203;19975](https://togithub.com/storybooks/storybook/pull/19975) ##### Dependency Upgrades - Upgrade loader-utils to 2.0.4 in storysource and source-loader [#&#8203;19891](https://togithub.com/storybooks/storybook/pull/19891) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/Unleash/unleash). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC41MS4wIiwidXBkYXRlZEluVmVyIjoiMzQuNTEuMCJ9--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-12-09 05:13:41 +01:00
"@storybook/addon-actions": "6.5.14",
"@storybook/addon-essentials": "6.5.14",
"@storybook/addon-interactions": "6.5.14",
"@storybook/addon-links": "6.5.14",
"@storybook/react": "6.5.14",
"@storybook/testing-library": "0.0.13",
"@tsconfig/docusaurus": "1.0.6",
chore(deps): update dependency babel-loader to v9 (#2293) [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [babel-loader](https://togithub.com/babel/babel-loader) | [`8.2.5` -> `9.1.0`](https://renovatebot.com/diffs/npm/babel-loader/8.2.5/9.1.0) | [![age](https://badges.renovateapi.com/packages/npm/babel-loader/9.1.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/babel-loader/9.1.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/babel-loader/9.1.0/compatibility-slim/8.2.5)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/babel-loader/9.1.0/confidence-slim/8.2.5)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>babel/babel-loader</summary> ### [`v9.1.0`](https://togithub.com/babel/babel-loader/releases/tag/v9.1.0) [Compare Source](https://togithub.com/babel/babel-loader/compare/v9.0.1...v9.1.0) #### New features - Pass external dependencies from Babel to Webpack by [@&#8203;nicolo-ribaudo](https://togithub.com/nicolo-ribaudo) in [https://github.com/babel/babel-loader/pull/971](https://togithub.com/babel/babel-loader/pull/971) **Full Changelog**: https://github.com/babel/babel-loader/compare/v9.0.1...v9.1.0 ### [`v9.0.1`](https://togithub.com/babel/babel-loader/releases/tag/v9.0.1) [Compare Source](https://togithub.com/babel/babel-loader/compare/v9.0.0...v9.0.1) ##### Bug Fixes - remove "node:" builtin prefix by [@&#8203;JLHwung](https://togithub.com/JLHwung) in [https://github.com/babel/babel-loader/pull/970](https://togithub.com/babel/babel-loader/pull/970) **Full Changelog**: https://github.com/babel/babel-loader/compare/v9.0.0...v9.0.1 ### [`v9.0.0`](https://togithub.com/babel/babel-loader/releases/tag/v9.0.0) [Compare Source](https://togithub.com/babel/babel-loader/compare/v8.3.0...v9.0.0) #### What's Changed - update hash method mechanism so it doesn't fail on a fips enabled machine by [@&#8203;darmbrust](https://togithub.com/darmbrust) in [https://github.com/babel/babel-loader/pull/939](https://togithub.com/babel/babel-loader/pull/939) - Require babel ^7.12.0 and Node.js >= 14.15.0 versions by [@&#8203;JLHwung](https://togithub.com/JLHwung) in [https://github.com/babel/babel-loader/pull/956](https://togithub.com/babel/babel-loader/pull/956) - Remove dependency on loader-utils and drop webpack 4 support by [@&#8203;nied](https://togithub.com/nied) in [https://github.com/babel/babel-loader/pull/942](https://togithub.com/babel/babel-loader/pull/942) #### New Contributors - [@&#8203;darmbrust](https://togithub.com/darmbrust) made their first contribution in [https://github.com/babel/babel-loader/pull/939](https://togithub.com/babel/babel-loader/pull/939) - [@&#8203;nied](https://togithub.com/nied) made their first contribution in [https://github.com/babel/babel-loader/pull/942](https://togithub.com/babel/babel-loader/pull/942) **Full Changelog**: https://github.com/babel/babel-loader/compare/v8.2.5...v9.0.0 ### [`v8.3.0`](https://togithub.com/babel/babel-loader/releases/tag/v8.3.0) [Compare Source](https://togithub.com/babel/babel-loader/compare/v8.2.5...v8.3.0) #### New features - Pass external dependencies from Babel to Webpack by [@&#8203;nicolo-ribaudo](https://togithub.com/nicolo-ribaudo) in [https://github.com/babel/babel-loader/pull/971](https://togithub.com/babel/babel-loader/pull/971) **Full Changelog**: https://github.com/babel/babel-loader/compare/v8.2.5...v8.3.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/Unleash/unleash). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC42LjEiLCJ1cGRhdGVkSW5WZXIiOiIzNC4xNy4xIn0=--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-11-10 00:00:13 +01:00
"babel-loader": "9.1.0",
chore(deps): update dependency enhanced-resolve to v5.12.0 (#2517) [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [enhanced-resolve](https://togithub.com/webpack/enhanced-resolve) | [`5.11.0` -> `5.12.0`](https://renovatebot.com/diffs/npm/enhanced-resolve/5.11.0/5.12.0) | [![age](https://badges.renovateapi.com/packages/npm/enhanced-resolve/5.12.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/enhanced-resolve/5.12.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/enhanced-resolve/5.12.0/compatibility-slim/5.11.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/enhanced-resolve/5.12.0/confidence-slim/5.11.0)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>webpack/enhanced-resolve</summary> ### [`v5.12.0`](https://togithub.com/webpack/enhanced-resolve/releases/tag/v5.12.0) [Compare Source](https://togithub.com/webpack/enhanced-resolve/compare/v5.11.0...v5.12.0) - reverts "utilize throwIfNoEntry in sync mode" </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/Unleash/unleash). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4zMC40IiwidXBkYXRlZEluVmVyIjoiMzQuMzAuNCJ9--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-11-23 22:57:46 +01:00
"enhanced-resolve": "5.12.0",
chore(deps): update react-router monorepo to v6.4.5 (#2643) [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [react-router](https://togithub.com/remix-run/react-router) | [`6.4.3` -> `6.4.5`](https://renovatebot.com/diffs/npm/react-router/6.4.3/6.4.5) | [![age](https://badges.renovateapi.com/packages/npm/react-router/6.4.5/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/react-router/6.4.5/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/react-router/6.4.5/compatibility-slim/6.4.3)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/react-router/6.4.5/confidence-slim/6.4.3)](https://docs.renovatebot.com/merge-confidence/) | | [react-router-dom](https://togithub.com/remix-run/react-router) | [`6.4.3` -> `6.4.5`](https://renovatebot.com/diffs/npm/react-router-dom/6.4.3/6.4.5) | [![age](https://badges.renovateapi.com/packages/npm/react-router-dom/6.4.5/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/react-router-dom/6.4.5/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/react-router-dom/6.4.5/compatibility-slim/6.4.3)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/react-router-dom/6.4.5/confidence-slim/6.4.3)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>remix-run/react-router (react-router)</summary> ### [`v6.4.5`](https://togithub.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#&#8203;645) [Compare Source](https://togithub.com/remix-run/react-router/compare/react-router@6.4.4...react-router@6.4.5) ##### Patch Changes - Updated dependencies: - `@remix-run/router@1.0.5` ### [`v6.4.4`](https://togithub.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#&#8203;644) [Compare Source](https://togithub.com/remix-run/react-router/compare/react-router@6.4.3...react-router@6.4.4) ##### Patch Changes - Updated dependencies: - `@remix-run/router@1.0.4` </details> <details> <summary>remix-run/react-router (react-router-dom)</summary> ### [`v6.4.5`](https://togithub.com/remix-run/react-router/blob/HEAD/packages/react-router-dom/CHANGELOG.md#&#8203;645) [Compare Source](https://togithub.com/remix-run/react-router/compare/react-router-dom@6.4.4...react-router-dom@6.4.5) ##### Patch Changes - Updated dependencies: - `@remix-run/router@1.0.5` - `react-router@6.4.5` ### [`v6.4.4`](https://togithub.com/remix-run/react-router/blob/HEAD/packages/react-router-dom/CHANGELOG.md#&#8203;644) [Compare Source](https://togithub.com/remix-run/react-router/compare/react-router-dom@6.4.3...react-router-dom@6.4.4) ##### Patch Changes - Fix issues with encoded characters in `NavLink` and descendant `<Routes>` ([#&#8203;9589](https://togithub.com/remix-run/react-router/pull/9589), [#&#8203;9647](https://togithub.com/remix-run/react-router/pull/9647)) - Properly serialize/deserialize `ErrorResponse` instances when using built-in hydration ([#&#8203;9593](https://togithub.com/remix-run/react-router/pull/9593)) - Support `basename` in static data routers ([#&#8203;9591](https://togithub.com/remix-run/react-router/pull/9591)) - Updated dependencies: - `@remix-run/router@1.0.4` - `react-router@6.4.4` </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/Unleash/unleash). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC41MS4wIiwidXBkYXRlZEluVmVyIjoiMzQuNTEuMCJ9--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-12-09 00:52:35 +01:00
"react-router": "6.4.5",
"replace-in-file": "6.3.5",
"storybook-addon-root-attribute": "1.0.2",
"typescript": "4.8.4"
}
}