[FEATURE] `depadded` script hook
benallfree opened this issue · 2 comments
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 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.
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
Closing: This is an automated message.
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
Closing: This is an automated message.