Skip to content

fix(shared): resolve docusaurus/mermaid/elk dependency and add test#2324

Merged
rocketstack-matt merged 1 commit intofinos:mainfrom
markscott-ms:fix/2323
Apr 10, 2026
Merged

fix(shared): resolve docusaurus/mermaid/elk dependency and add test#2324
rocketstack-matt merged 1 commit intofinos:mainfrom
markscott-ms:fix/2323

Conversation

@markscott-ms
Copy link
Copy Markdown
Contributor

Description

Resolves #2323

This pull request adds explicit overrides for @mermaid-js/layout-elk and webpackbar dependencies to the package.json file 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 webpackbar override may be removable after docusaurus 3.10.1 is released: facebook/docusaurus#11923 (comment)

Testing enhancements:

  • Added a long-running test in shared/src/docify/template-bundles/docusaurus/package.spec.ts to ensure that the Docusaurus template bundle's dependencies resolve without conflicts. This test performs an npm install and checks for successful completion. To minimize the time required, it runs with --package-lock-only to avoid populating a whole node_modules tree. This test file is not copied to the output directory when calm docify runs.

Screenshot of calm docify website successfully created after the fix:

image

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🎨 Code style/formatting changes
  • ♻️ Refactoring (no functional changes)
  • ⚡ Performance improvements
  • ✅ Test additions or updates
  • 🔧 Chore (maintenance, dependencies, CI, etc.)

Affected Components

  • CLI (cli/)
  • Schema (calm/)
  • CALM AI (calm-ai/)
  • CALM Hub (calm-hub/)
  • CALM Hub UI (calm-hub-ui/)
  • CALM Server (calm-server/)
  • CALM Widgets (calm-widgets/)
  • Documentation (docs/)
  • Shared (shared/)
  • VS Code Extension (calm-plugins/vscode/)
  • Dependencies
  • CI/CD

Commit Message Format ✅

Testing

  • I have tested my changes locally
  • I have added/updated unit tests
  • All existing tests pass

Checklist

  • My commits follow the conventional commit format
  • I have updated documentation if necessary
  • I have added tests for my changes (if applicable)
  • My changes follow the project's coding standards

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 overrides to the Docusaurus docify template package.json to pin/force @mermaid-js/layout-elk and webpackbar resolution.
  • Updated shared + CLI “expected output” fixtures to reflect the new generated package.json content.
  • Added a Vitest long-running test that performs an npm install --package-lock-only against 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.

Comment on lines +24 to +28
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));
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
@rocketstack-matt rocketstack-matt merged commit 5b431aa into finos:main Apr 10, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli Affects `cli` code config shared

Projects

None yet

Development

Successfully merging this pull request may close these issues.

npm install fails on docify created website

3 participants