-
Notifications
You must be signed in to change notification settings - Fork 239
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
[RRFC] Promote npm add
to a top-level command
#395
Comments
Some more ideas to be explored:
|
Thanks for your thought and work here @ruyadorno ! Haven't thought about this at length yet, but a first few ideas:
|
Linking #364 as they can potentially be linked based on how we end up implementing |
5 tasks
Some questions that should be answered in the RFC:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Motivation ("The Why")
Users are often confused by the fact that
npm install
(no args) andnpm install <pkg>
have different behavior with regards to lifecycle scripts, updating the package-lock file and other possible nuances in arborist when adding new deps to the installed tree vs simply reifying a tree.The lifecycle script discussion has happened to some extent already over at #325 and although there's some level of agreement on having it work with a new type of lifecycle script (such as a generic tree mutation event) I would like to propose an alternative that at the same time also aims to improve the UX around adding new dependencies to a project.
How
We currently have a
npm add
command that is lightly documented and works as an alias tonpm install
. The main idea to be proposed in an eventual RFC is to turnnpm add
into an actual top-level command (with its own docs page and associated tests) along with adding custom behavior to run newpreadd
,add
andpostadd
lifecycle scripts.This aims to improve some of the existing pain points:
Desired Behaviour
Given a project with the following package.json:
When adding a new dependency using
npm add <pkg>
the lifecycle script would be executed, e.g:References
cc @karlhorky @wraithgar
The text was updated successfully, but these errors were encountered: