I have a few "global" dependencies (jshint, csslint, buster, etc..) that I'd like to have automatically installed and executable via the command line when my package is installed via npm install
. Is this possible?
Currently, I'm doing the following manually:
npm install -g <package_name>
npm link <package_name>
Update:
Just came across this feature request for npm. It seems like the scripts
config within package.json is the way to go?
Update Again: Or, after reading the npm docs, maybe I'm supposed to use a .gyp file? I'm confused.
It's not possible to specify dependencies as "global" from a package.json
. And, this is by design as Isaac states in that feature request you referenced:
Yeah, we're never going to do this.
But, "binaries" can still be used when a package is installed locally. They'll be in .../node_modules/.bin/
. And, you should be able to queue them up with a preinstall
script.
Though, if the series of commands is rather lengthy (as "jshint, csslint, buster, etc.." would suggest), you may want to look into using a build tool such as grunt
to perform the various tasks:
{
// ...,
"scripts": {
"preinstall": "grunt"
}
}