-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix(devkit): prevent copying package.json properties to project.json during updates #32459
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
Draft
FrozenPandaz
wants to merge
6
commits into
master
Choose a base branch
from
fix-update-config
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…during updates When a project has both project.json and package.json files, the updateProjectConfiguration function was incorrectly copying properties from package.json into project.json. This change modifies updateProjectConfigurationInProjectJson to: - Only include properties that were originally in project.json or are new - Handle nested properties like targets and metadata intelligently - Detect and prevent merge artifacts from being written to project.json - Preserve existing behavior for empty targets and other edge cases Includes comprehensive test coverage for the new behavior.
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Command | Status | Duration | Result |
---|---|---|---|
nx affected --targets=lint,test,build,e2e,e2e-c... |
❌ Failed | 48m 13s | View ↗ |
nx run-many -t check-imports check-commit check... |
✅ Succeeded | 2m 19s | View ↗ |
nx-cloud record -- nx-cloud conformance:check |
✅ Succeeded | 2s | View ↗ |
nx-cloud record -- nx format:check |
✅ Succeeded | 1s | View ↗ |
nx-cloud record -- nx sync:check |
✅ Succeeded | <1s | View ↗ |
nx documentation |
✅ Succeeded | 12s | View ↗ |
☁️ Nx Cloud last updated this comment at 2025-08-21 23:57:52
UTC
… in project.json Replace complex implementation with surgical fix that: - Uses original logic when only project.json exists - When both files exist, only copies properties that belong in project.json - Handles targets specially to check individual targets - Keeps implementation minimal and maintainable
6b30805
to
4ee1c0c
Compare
…erties Verifies that project.json can properly override properties from package.json such as name, while maintaining proper separation of concerns between the files.
…different values When updating project configuration, properties that have different values than what's in package.json should be written to project.json to enable proper overrides. Previously, properties would be skipped if they existed in package.json, even if the new value was different.
Simplify the implementation to be closer to the original logic. When no package.json exists, use original behavior exactly. When package.json exists, filter projectConfiguration before spreading. Maintain the same writeJson structure as original code.
Replace multiple specific assertions with single toEqual expectations for each file, making tests more declarative and easier to read. Each test now has exactly 2 expectations: one for project.json content and one for package.json content.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes an issue where properties from
package.json
were being incorrectly copied toproject.json
when updating project configuration in projects that have both files.Changes Made
Core Fix (Surgical Approach)
updateProjectConfigurationInProjectJson
with minimal changes:project.json
exists: Uses original logic (no changes)project.json
package.json
project.json
OR not inpackage.json
Key Benefits
Test Coverage
package.json
don't get copiedImplementation Details
The fix works by:
project.json
to understand what was originally therepackage.json
to understand what should stay thereproject.json
based on simple rulestargets
to check individual targets rather than the entire propertyThis approach fixes the core issue while keeping the implementation simple and maintainable.
Fixes #ISSUE_NUMBER (if applicable)