Skip to content
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

fix(core): change name schema order in project.json #13409

Conversation

Roozenboom
Copy link
Contributor

Current Behavior

The addProjectToWorkspaceJson generator utility is creating a project.json with first the schema property and afterwards the name and rest of the projectConfiguration. This works ok, but has unexpected behavior when you use another generator (for example @nrwl/angular:application) that does a formatting on the project configuration files. The 'wrongly' sorted project.json files will show as updated in the changed files list. Which is something we like to prevent in a large monorepo with multiple codeowners.

Expected Behavior

Expected behavior is that every schematic/generator and utility is generating the project.json in the same way so that generated files are formatted correctly and not show up as unrelated changes when you create a new app or lib.

Steps to Reproduce

I created a small reproduction path on nx-examples: nrwl/nx-examples#250
If you checkout this code and run nx g @nrwl/angular:app test-app --dry-run you will see that the output shows:
UPDATE libs/cart/cart-page/project.json
which isn't expected when you generate a new app called test-app.

Screenshot 2022-11-25 at 13 18 38
Screenshot 2022-11-25 at 13 19 28

Solution

The solution to this issue is as simple as changing the order of the properties in the project configuration in the addProjectToWorkspaceJson utility

@vercel
Copy link

vercel bot commented Nov 25, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
nx-dev ✅ Ready (Inspect) Visit Preview Nov 25, 2022 at 2:43PM (UTC)

Copy link
Collaborator

@FrozenPandaz FrozenPandaz left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution! LGTM 🎉

@FrozenPandaz FrozenPandaz merged commit f0fc786 into nrwl:master Nov 25, 2022
FrozenPandaz pushed a commit that referenced this pull request Nov 28, 2022
@Roozenboom Roozenboom deleted the bugfix/update-name-schema-order-project-json branch December 12, 2022 12:43
@github-actions
Copy link

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants