If you're online, it installs/caches npm packages with --force (so you get fresh packages). If you're offline, it installs cached packages with --cache-min.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE
README.md
cli.babel.js
cli.js
package.json

README.md

nofi

npm Online-First Installer

Do you switch between online/offline environments somewhat regularly?

Installation/Usage

  • npm i -g nofi
  • Replace all your npm install commands with nofi

Examples

✖︎  npm install
✔︎  nofi
✖︎  npm install --save foo
✔︎  nofi --save foo
✖︎  npm install --save-dev foo
✔︎  nofi --save-dev foo
✖︎  npm install --save-optional foo
✔︎  nofi --save-optional foo

Flag aliases and installing multiple packages work as well...

  • nofi -S foo
  • nofi -D foo bar
  • nofi -O foo bar baz

How does it work?

  1. Test internet connection using is-online.
  2. If online, use npm install --force to install/cache the latest package.
  3. If offline, use npm install --cache-min Infinity to install from your cache (usually located in ~/.npm).