You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feedback - can every app/lib have their own package.json? #3023
This is a feedback. I using nx and it works very well to my clients :)
One thing though, currently I have one package.json with many dependencies of my apps and libs and its hard to tell which dependency in use in which apps/libs.
It will be great if each app and lib will have its own package.json with the packages that app/lib uses.
Even all dependencies are the same versions, I want to know in ease what packages I use for the app.
Why? sometimes I want to move the apps from repo to another repo and I need to take the package.json and copy and filter the packages that the app/lib not use.
(In lerna monorepos for example I have each package the package.json`)
NX Team, what do you think about it? this can be done in nx?
Yes, you can have multiple package.json for each app and lib but it will not be generated by default.
We strongly recommend using a single package.json in the root of the repo but you can setup your repo differently if you so wish. Nx should still work.
Yes, you can have multiple package.json for each app and lib but it will not be generated by default.
We strongly recommend using a single package.json in the root of the repo but you can setup your repo differently if you so wish. Nx should still work.
I need per app package.json is for solving some problems.
every app can publish itself, and record version in package.json.
when build every app individually to docker image, npm can just install itself's dependencies according to package.json.
Yes, you can have multiple package.json for each app and lib but it will not be generated by default.
We strongly recommend using a single package.json in the root of the repo but you can setup your repo differently if you so wish. Nx should still work.
Hi there how would you configure this so each application can have a package.json in the monorepo setup? I need this in order to configure integration with an existing CI/CD pipeline that performs the build off changes to the Repo on a project.
Reacted by Kwame Carr, Michał Katański, Jens Bodal, Weronika Dominiak, Kewin Brandsma, Hector Ayala, ET and seanfloler
Yes, you can have multiple package.json for each app and lib but it will not be generated by default.
We strongly recommend using a single package.json in the root of the repo but you can setup your repo differently if you so wish. Nx should still work.
Some of us do not find it a good idea to use a single package.json for all the apps sorry. Could you please help us with some instructions on how to maintain separate package.json for separate apps.
Reacted by xinzhe, Farrizal Alchudry Mutaqien, Viktor Urbanas, Towry Wang, 오웬, Abdel, ensconced, Volodymyr Zakhovaiko, deepakt2b, Jose Valerio and 2 more
@FrozenPandaz
Having single package.json is error prone. Let me explain why:
in microservices world every service is supposed to be independent and isolated and having a single package.json already violates this
during the build process all dependencies are packaged within each and every build unless you configure webpack with tree shaking which you are forced to do in order to reduce the building time and build size
separate apps (microservices) are supposed to be maintained by different teams and having a single package.json forces all teams to migrate to new version of the lib / framework at the same time instead of being able to plan migration when they decide according to their workload
when you migrate to the new major version of a certain lib you can't deploy your microservice independently which is one of the main benefits of the microservices, since the breaking change is brought to all your apps and you are forced to migrate all of them which slows down the delivery
Given that I may understand some people may still want to have single package.json for simplicity but IMO this breaks flexibility and separation of concerns. I don't see any valid point in forcing people to use single package.json as the main approach in their projects.
Please give us an option to be able to separate the package.json per app and still benefit of all the nx features.
Thank you!
Reacted by Alexandr, Salman Aziz, Leo Oliveira, seanfloler, André, Jeremy Kwon, Niclas Gleesborg, Mia, Towry Wang, 오웬 and 17 more
Reacted by alxpsr, Towry Wang, Ajay Narang, Fedor Shubin and ayumi
I've gone with the recommended method of putting a single package.json for all my apps/libs. However I don't feel comfortable not knowing which packages each app is relying upon. Is there a way to figure that out, if I ever decided to move an app into a different standalone project?
(and a side-question: how about git repositories? single one for all, or per-app?)
Enforcing a single version is not the same thing as providing the same dependency set to everything.
Maven has the concept of a BOM - Bill Of Materials - where you control just the version selection and I think it's a good feature, that could apply here.
I am looking at multi-module monorepos to avoid depending on anything framework related in core components, which can be packaged in different apps.
Activity
FrozenPandaz commentedon May 19, 2020
Yes, you can have multiple
package.jsonfor each app and lib but it will not be generated by default.We strongly recommend using a single
package.jsonin the root of the repo but you can setup your repo differently if you so wish. Nx should still work.zyf0330 commentedon Aug 17, 2021
I need per app package.json is for solving some problems.
zyf0330 commentedon Aug 17, 2021
Find something related to at #1777
cntran commentedon Oct 3, 2021
Hi there how would you configure this so each application can have a package.json in the monorepo setup? I need this in order to configure integration with an existing CI/CD pipeline that performs the build off changes to the Repo on a project.
husny-ahamed-mg commentedon Aug 23, 2022
Some of us do not find it a good idea to use a single package.json for all the apps sorry. Could you please help us with some instructions on how to maintain separate package.json for separate apps.
viktornord commentedon Sep 16, 2022
@FrozenPandaz
Having single package.json is error prone. Let me explain why:
Given that I may understand some people may still want to have single package.json for simplicity but IMO this breaks flexibility and separation of concerns. I don't see any valid point in forcing people to use single package.json as the main approach in their projects.
Please give us an option to be able to separate the package.json per app and still benefit of all the nx features.
Thank you!
towry commentedon Nov 3, 2022
@FrozenPandaz Any updates??
alxpsr commentedon Nov 8, 2022
@viktornord makes sense
amivag commentedon Mar 8, 2023
I've gone with the recommended method of putting a single package.json for all my apps/libs. However I don't feel comfortable not knowing which packages each app is relying upon. Is there a way to figure that out, if I ever decided to move an app into a different standalone project?
(and a side-question: how about git repositories? single one for all, or per-app?)
neg3ntropy commentedon Apr 6, 2023
Enforcing a single version is not the same thing as providing the same dependency set to everything.
Maven has the concept of a BOM - Bill Of Materials - where you control just the version selection and I think it's a good feature, that could apply here.
I am looking at multi-module monorepos to avoid depending on anything framework related in core components, which can be packaged in different apps.
github-actions commentedon May 7, 2023
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.