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

Global hook #3

Closed
EnzoMartin opened this issue Jan 28, 2016 · 4 comments
Closed

Global hook #3

EnzoMartin opened this issue Jan 28, 2016 · 4 comments

Comments

@EnzoMartin
Copy link
Contributor

Was idly thinking about this earlier, and only did some basic research on it so far, but it could be kinda neat if there's a way to create a global hook with npm so that it runs john after every post npm install on a directory so you don't have to add it to every package.json in your projects

Food for thought, gonna look at it more this weekend

@davej
Copy link
Owner

davej commented Jan 28, 2016

Yup, looked into this before, it's not possible to do after installing each new module in your project (i.e. npm install some-module --save) but you can do after doing a general npm install.

It's as simple as:

// in package.json
{
  // ...
  "scripts": {
    "postinstall": "john"
  },
  "devDependencies": {
    "john": "^1"
  },
}

You obviously don't need to have john installed globally for this to work either. Might be good to document it in the README for sure.

@davej
Copy link
Owner

davej commented Jan 28, 2016

Oh wait, I think I misunderstood what you've said. Yeah would be very interested in a global hook!

@EnzoMartin
Copy link
Contributor Author

Yea, the point is for you not to have it in individual repositories, so you can have it purely installed locally in your global modules, and trigger it automatically wherever npm install just finished running.

I'll look at it over the weekend and see if there's a way to do it

@davej
Copy link
Owner

davej commented Jan 28, 2016

Cool, yeah that would be very useful!

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

No branches or pull requests

2 participants