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

[FEATURE] depadded script hook #962

Closed
benallfree opened this issue Feb 28, 2020 · 2 comments
Closed

[FEATURE] depadded script hook #962

benallfree opened this issue Feb 28, 2020 · 2 comments
Labels
Enhancement new feature or improvement

Comments

@benallfree
Copy link

benallfree commented Feb 28, 2020

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.

@darcyclarke darcyclarke added the Enhancement new feature or improvement label Oct 30, 2020
@darcyclarke
Copy link
Contributor

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.

1 similar comment
@darcyclarke
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement new feature or improvement
Projects
None yet
Development

No branches or pull requests

2 participants