fix(shared): resolve docusaurus/mermaid/elk dependency and add test#2324
fix(shared): resolve docusaurus/mermaid/elk dependency and add test#2324rocketstack-matt merged 1 commit intofinos:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses npm install failures on docify-generated Docusaurus sites by forcing consistent dependency resolution for the Docusaurus template bundle, and adds a regression test to detect future peer-dependency breakages early.
Changes:
- Added
overridesto the Docusaurus docify templatepackage.jsonto pin/force@mermaid-js/layout-elkandwebpackbarresolution. - Updated shared + CLI “expected output” fixtures to reflect the new generated
package.jsoncontent. - Added a Vitest long-running test that performs an
npm install --package-lock-onlyagainst the template bundle to ensure installs resolve cleanly.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| shared/src/docify/template-bundles/docusaurus/package.json | Adds dependency overrides to prevent Docusaurus/Mermaid/ELK resolution conflicts. |
| shared/src/docify/template-bundles/docusaurus/package.spec.ts | Adds an installability regression test for the template bundle’s dependency graph. |
| shared/test_fixtures/docify/workshop/expected-output/secure/package.json | Updates expected generated site output to include the new overrides. |
| shared/test_fixtures/docify/workshop/expected-output/non-secure/package.json | Updates expected generated site output to include the new overrides. |
| cli/test_fixtures/getting-started/STEP-2/website/package.json | Updates CLI getting-started website fixture to include the new overrides. |
| cli/test_fixtures/getting-started/STEP-3/website/package.json | Updates CLI getting-started website fixture to include the new overrides. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const exitCode = await new Promise<number>((resolve, reject) => { | ||
| const stderr: string[] = []; | ||
| const proc = spawn('npm', ['install', '--package-lock-only', '--prefix', tmpDir]); | ||
| proc.stderr?.on('data', (chunk: Buffer) => stderr.push(chunk.toString())); | ||
| proc.on('close', (code) => resolve(code ?? 1)); |
There was a problem hiding this comment.
This test shells out to npm install, which by default may run audit/fund requests and (depending on npm behavior) lifecycle scripts, making the test slower/flakier and potentially executing third‑party scripts during CI. Consider adding --no-audit, --no-fund, and --ignore-scripts, and run the command with cwd set to tmpDir (instead of relying on --prefix) so it’s fully isolated; also consider using npm.cmd on Windows to keep the test runnable for contributors.
Description
Resolves #2323
This pull request adds explicit
overridesfor@mermaid-js/layout-elkandwebpackbardependencies to thepackage.jsonfile of the docusaurus docify template bundle to ensure consistent dependency resolution and prevent potential conflicts. Additionally, it introduces a new test to verify that the Docusaurus template bundle's dependencies can be installed without peer dependency issues.The
webpackbaroverride may be removable after docusaurus 3.10.1 is released: facebook/docusaurus#11923 (comment)Testing enhancements:
shared/src/docify/template-bundles/docusaurus/package.spec.tsto ensure that the Docusaurus template bundle's dependencies resolve without conflicts. This test performs annpm installand checks for successful completion. To minimize the time required, it runs with--package-lock-onlyto avoid populating a wholenode_modulestree. This test file is not copied to the output directory whencalm docifyruns.Screenshot of
calm docifywebsite successfully created after the fix:Type of Change
Affected Components
cli/)calm/)calm-ai/)calm-hub/)calm-hub-ui/)calm-server/)calm-widgets/)docs/)shared/)calm-plugins/vscode/)Commit Message Format ✅
Testing
Checklist