Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Parse package.json, inspect engine property and ensure command runs with right node.js version - with the absolute minimum amount of compilation
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.gitignore
LICENSE
README.md
main.js
package.json

README.md

node-engineer

Parse package.json, inspect engines property and ensure command runs with right node.js version - avoiding as much compilation as possible.

Engineer makes it trivial to run a command in an environment where node and npm match those specified by a particular package.json's engines field. It attempts to do this using already-present node binaries to save time if at all possible. Otherwise, it will reach out to the Internet, download, compile and install a satisfying version of Node.Js.

Engineer will try in this order, using the first satisfying version it finds:

  • Inspect the version of node.js in the $PATH to see if it satifies engines.
  • Inspect the version of node.js versions already installed locally via nave to see if any of those satifies engines.
  • Pick the maximum remote version of node.js which satisfies via nave.

This makes it a no-brainer to run an arbitrary package under whatever version of node it needs. Engineer uses nave and semver to do the heavy lifting of installing and checking for valid node.js versions.

Installation

npm install -g node-engineer

Usage

execute command with node version acceptable to engines package.json property
usage: engineer

Options:
  -c  Shell command         [required]
  -f  Path to package.json  [required]

Missing required arguments: c, f

Demo

# "node":">=0.6.19 <0.7.0"
# $PATH contains node 0.6.17
# No existing locally-installed nave versions

$ engineer -f package.json -c 'npm ls'
System non-Nave Node.JS version 0.6.17 does not satisfy range >=0.6.19 <0.7.0
local versions: []
Remote version 0.6.19 satisfies range >=0.6.19 <0.7.0
running cmd: ["./node_modules/nave/nave.sh","use","0.6.19","npm","ls"]
# "node":">=0.6.0 <0.7.0"
# $PATH contains node 0.6.17

$ engineer -f package.json -c 'npm ls'
System non-Nave Node.JS version 0.6.17 satisfies range >=0.6.0 <0.7.0
running cmd: ["npm","ls"]
node-engineer@0.2.0 /Users/nialljohiggins/projects/node-engineer
├── chai@1.0.4  extraneous
├─┬ mocha@1.2.0  extraneous
│ ├── commander@0.5.2 
│ ├── debug@0.7.0 
│ ├── diff@1.0.2 
│ ├── growl@1.5.1 
│ └─┬ jade@0.20.3 
│   └── mkdirp@0.3.3 
├── nave@0.2.13 
├─┬ optimist@0.3.4 
│ └── wordwrap@0.0.2 
└── semver@1.0.14 

Credits

This is a glue package which relies on:

Something went wrong with that request. Please try again.