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): init generators should not crash when trying to remove dependencies when package.json does not have dependencies #9765

Conversation

gioragutt
Copy link
Contributor

Current Behavior

some init generators (at least web and node) had edge cases where, when they would not invoke other init generators, they would crash when trying to delete dependencies from package.json, because it wouldn't have a "dependencies" key.

Expected Behavior

When there's no "dependencies" (or dev/peer/optional) in package.json, generators should not crash when trying to alter it.

This PR resolves this issue by using the removeDependenciesFromPackageJson method from devkit, instead of the more manual updateJson, in all applicable places where such an action happens.

There are several places where I opted not to update them, they were all migrators doing something specific, and I preferred to stick to the problem at hand.

Related Issue(s)

Fixes #9763

…when package.json does not have dependencies
@nx-cloud
Copy link

nx-cloud bot commented Apr 9, 2022

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 6f83ff8. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 22 targets

Sent with 💌 from NxCloud.

@vercel
Copy link

vercel bot commented Apr 9, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/nrwl/nx-dev/2uigKu2kVGyVCzcVwKvYDXhhsrck
✅ Preview: Ignored

[Deployment for 6f83ff8 canceled]

@AgentEnder AgentEnder merged commit 75b0744 into nrwl:master Apr 12, 2022
FrozenPandaz pushed a commit that referenced this pull request Apr 13, 2022
…endencies when package.json does not have dependencies (#9765)

Co-authored-by: Craigory Coppola <craigorycoppola@gmail.com>
@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 18, 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.

Node app generator unitTestRunner=none option throws error
2 participants