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

Allow for generated package.json to include dependency range from root package.json #16293

Closed
VirtuaBoza opened this issue Apr 13, 2023 · 3 comments · Fixed by #16398
Closed

Comments

@VirtuaBoza
Copy link

VirtuaBoza commented Apr 13, 2023

One of my favorite features of Nx is that I don't have to think about managing my package.json for publishable packages because Nx will ensure the generated package.json will have all the dependencies I used and none that I didn't use. This is no longer the case in v15 as it's using the strict versions from my package-lock file, and it's making managing dependencies across my projects very difficult. I understand the position of the team (below), but I'm wondering if we can be provided with the option to use the same version (range) from the root package.json.

Also, the new generated pacakge json may have adverse impacts for publishable npm packages as the range specified is important and needs to be included in the generated package json. This also impacts any publishable package using the @nrwl/js:tsc executor.

For publishable packages we suggest creating manual package.json instead of using generated one, because it gives you the freedom to specify ranges as you see fit. For example my library could support @angular/core: >= 10 < 15 but my root package.json would have probably something like @angular/core: ^14.2.0. Using root package json ranges for publishable libs is bad practice, as they tend to be more restrictive than needed.

Originally posted by @meeroslav in #12675 (comment)

@AgentEnder
Copy link
Member

@meeroslav assigning this to you since you are working on similar stuff.

@meeroslav
Copy link
Contributor

Thank you @VirtuaBoza, for raising this issue again.

I will create a fix for libraries to not fallback to fixed versions if local package.json is missing.

@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

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

Successfully merging a pull request may close this issue.

3 participants