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
I would like the ability to run scripts before and after dependencies are added. The install hook runs after the package is installed as a dependency, but we have no hooks for when a dependency is added/removed from a package.
I'm proposing a depadded hook to run after a package dependency is installed using npm i <package>.
When
When npm i <package> is finished executing
Where
As a final step, it will look for a depadded script in the project package.json and run it if present.
How
"scripts": {
"depadded": "echo 'A dependency was added.'"
}
Current Behavior
There is no way to hook into a dependency added event.
Expected Behavior
n/a
Who
n/a
References
Inspired while trying to find a workaround for npm install breaking npm link. I created a package to help track and restore links, but there is no way to automatically run it after npm install <package> executes.
I know this particular issue will be fixed in npm 7, but perhaps there is some general utility to this feature anyway. I am happy to work on it and submit a PR.
The text was updated successfully, but these errors were encountered:
npm v6 is no longer in active development; We will continue to push security releases to v6 at our team's discretion as-per our Support Policy.
If your bug is preproducible on v7, please re-file this issue using our new issue template.
If your issue was a feature request, please consider opening a new RRFC or RFC. If your issue was a question or other idea that was not CLI-specific, consider opening a discussion on our feedback repo
npm v6 is no longer in active development; We will continue to push security releases to v6 at our team's discretion as-per our Support Policy.
If your bug is preproducible on v7, please re-file this issue using our new issue template.
If your issue was a feature request, please consider opening a new RRFC or RFC. If your issue was a question or other idea that was not CLI-specific, consider opening a discussion on our feedback repo
What / Why
I would like the ability to run scripts before and after dependencies are added. The
install
hook runs after the package is installed as a dependency, but we have no hooks for when a dependency is added/removed from a package.I'm proposing a
depadded
hook to run after a package dependency is installed usingnpm i <package>
.When
When
npm i <package>
is finished executingWhere
As a final step, it will look for a
depadded
script in the projectpackage.json
and run it if present.How
Current Behavior
There is no way to hook into a dependency added event.
Expected Behavior
Who
References
Inspired while trying to find a workaround for npm install breaking npm link. I created a package to help track and restore links, but there is no way to automatically run it after
npm install <package>
executes.I know this particular issue will be fixed in npm 7, but perhaps there is some general utility to this feature anyway. I am happy to work on it and submit a PR.
The text was updated successfully, but these errors were encountered: