Skip to content

fix: buildVersion now correctly reads from project's package.json #3928

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 18, 2025

Conversation

ScriptedAlchemy
Copy link
Member

@ScriptedAlchemy ScriptedAlchemy commented Jul 17, 2025

This pull request addresses an issue where the BuildVersion was incorrectly reading from the wrong package.json location. It introduces fixes to ensure the BuildVersion is accurately derived from the project's package.json and adds comprehensive tests to validate this functionality.

#3835

Fixes to BuildVersion resolution:

  • .changeset/fix-build-version-package-json.md: Updated getBuildVersion() to accept an optional root parameter for correct directory resolution. Modified StatsManager to use compiler.context for determining the build version. Ensured the buildVersion in mf-manifest.json matches the project's package.json version.
  • packages/managers/src/utils.ts: Refactored getBuildVersion() to accept an optional root parameter and use it to read the correct package.json.
  • packages/manifest/src/StatsManager.ts: Updated StatsManager to use the context from the compiler options when resolving the buildVersion. Added a private getBuildInfo() method to encapsulate the logic for retrieving build information. [1] [2]

Added tests for BuildVersion functionality:

)

- Modified getBuildVersion() to accept optional root parameter for correct directory resolution
- Updated StatsManager to use compiler.context when determining build version
- Added comprehensive test case to verify buildVersion matches package.json
- Ensures mf-manifest.json contains correct buildVersion from project root

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Copy link

changeset-bot bot commented Jul 17, 2025

🦋 Changeset detected

Latest commit: 4611821

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 33 packages
Name Type
@module-federation/manifest Patch
@module-federation/managers Patch
@module-federation/enhanced Patch
@module-federation/modern-js Patch
@module-federation/rspack Patch
@module-federation/dts-plugin Patch
@module-federation/nextjs-mf Patch
@module-federation/node Patch
@module-federation/rsbuild-plugin Patch
@module-federation/rspress-plugin Patch
@module-federation/storybook-addon Patch
@module-federation/modernjsapp Patch
@module-federation/cli Patch
remote5 Patch
website-new Patch
@module-federation/runtime Patch
@module-federation/webpack-bundler-runtime Patch
@module-federation/sdk Patch
@module-federation/runtime-tools Patch
@module-federation/third-party-dts-extractor Patch
@module-federation/devtools Patch
@module-federation/bridge-react Patch
@module-federation/bridge-vue3 Patch
@module-federation/bridge-shared Patch
@module-federation/bridge-react-webpack-plugin Patch
@module-federation/retry-plugin Patch
@module-federation/data-prefetch Patch
@module-federation/error-codes Patch
@module-federation/inject-external-runtime-core-plugin Patch
@module-federation/runtime-core Patch
create-module-federation Patch
@module-federation/esbuild Patch
@module-federation/utilities Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

netlify bot commented Jul 17, 2025

Deploy Preview for module-federation-docs ready!

Name Link
🔨 Latest commit 4611821
🔍 Latest deploy log https://app.netlify.com/projects/module-federation-docs/deploys/6879d9d8cf3b760008d47ce1
😎 Deploy Preview https://deploy-preview-3928--module-federation-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

ScriptedAlchemy and others added 2 commits July 17, 2025 21:35
…ture

- Fixed test to look for mf-manifest.json in correct location (root instead of dist)
- Updated test to access buildVersion from manifest.metaData.buildInfo
- Test now passes successfully validating the BuildVersion fix
@2heal1 2heal1 merged commit 7000c1f into main Jul 18, 2025
18 checks passed
@2heal1 2heal1 deleted the fix/build-version-package-json-reading branch July 18, 2025 06:08
@2heal1 2heal1 mentioned this pull request Jul 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants