https://github.com/orlin/install-g
insist to automatically npm-install a package globally
https://github.com/orlin/install-g
Last synced: 2 months ago
JSON representation
insist to automatically npm-install a package globally
- Host: GitHub
- URL: https://github.com/orlin/install-g
- Owner: orlin
- Created: 2014-11-26T09:07:15.000Z (over 10 years ago)
- Default Branch: active
- Last Pushed: 2015-02-23T18:55:45.000Z (over 10 years ago)
- Last Synced: 2024-04-26T00:25:05.316Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 285 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# install-g -- npm install -g {}
One can insist to automatically npm-install a package globally.
[](https://www.npmjs.org/package/install-g)
## Use
1. Add `install-g` to your `package.json` dependencies.
2. Add `"scripts": { "install": "node_modules/.bin/install-g || true" }`As a result, any package using your package as a dependency would trigger its global installation.
Use of devDependencies isn't recommended, unless your project is private.
If you publish it on npm and others end up depending on it -- it will not install automatically...Because the install script is followed by `|| true`, non-zero exitcodes will be ignored.
Thus a missing `./node_modules/.bin/install-g` won't be a problem. Nor will other possible errors
such as the currently usupported `sudo` cause the install to fail. The error will still print
to stderr, but a failed global install will not break the local install.
I'm not sure if Windows can take the `|| true` though.Also note the use of `install` (i.e. `post-install`) rather than `pre-install`.
If people run `install -g` on your package it will install once rather than twice.## Why
Need not ask "please install {something} globally" - it just happens...
See [install-g's dependents](https://www.npmjs.org/package/install-g) for example.## Testing [](http://travis-ci.org/orlin/install-g)
```sh
batshit test
```## License
[MIT](http://orlin.mit-license.org)