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
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:
$PATHto see if it satifies
naveto see if any of those satifies
This makes it a no-brainer to run an arbitrary package under whatever version
of node it needs. Engineer uses
semver to do the heavy lifting of
installing and checking for valid node.js versions.
npm install -g node-engineer
execute command with node version acceptable to engines package.json propertyusage: engineerOptions:-c Shell command [required]-f Path to package.json [required]Missing required arguments: c, f
# "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.0local versions: Remote version 0.6.19 satisfies range >=0.6.19 <0.7.0running 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.0running cmd: ["npm","ls"]email@example.com /Users/nialljohiggins/projects/node-engineer├── firstname.lastname@example.org extraneous├─┬ email@example.com extraneous│ ├── firstname.lastname@example.org│ ├── email@example.com│ ├── firstname.lastname@example.org│ ├── email@example.com│ └─┬ firstname.lastname@example.org│ └── email@example.com├── firstname.lastname@example.org├─┬ email@example.com│ └── firstname.lastname@example.org└── email@example.com
This is a glue package which relies on: