install-g
insist on global npm install
Last updated 6 years ago by orlin .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install install-g 
SYNC missed versions from official npm registry.

install-g -- npm install -g {}

One can insist to automatically npm-install a package globally.

NPM

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 for example.

Testing Build Status

batshit test

License

MIT

Current Tags

  • 0.0.2-4                                ...           latest (5 years ago)

10 Versions

  • 0.0.2-4                                ...           5 years ago
  • 0.0.2-3                                ...           6 years ago
  • 0.0.2-2                                ...           6 years ago
  • 0.0.2-1                                ...           6 years ago
  • 0.0.2                                ...           6 years ago
  • 0.0.1-4 [deprecated]           ...           6 years ago
  • 0.0.1-3 [deprecated]           ...           6 years ago
  • 0.0.1-2 [deprecated]           ...           6 years ago
  • 0.0.1-1                                ...           6 years ago
  • 0.0.1                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (4)
Dependents (5)

Copyright 2014 - 2016 © taobao.org |