harmonious
Version:
Ensure that node is run as the correct version, and uses --harmony, if needed
47 lines (38 loc) • 770 B
Markdown
# harmonious
Ensure that your Node.js CLI apps are loaded with the correct Node version based on `engines.node` in package.json, and with --harmony if needed.
## Usage
As simple as can be:
```js
{
"engines": {
"node": "=0.11.13"
}
}
```
File **app.js**:
```js
#!/usr/bin/env node
var harmony = require('./harmonious');
harmony('./lib/cli');
```
**`harmonious`** will ensure that regardless of how you invoke your app,
`harmony` extensions will be loaded. These will all work:
```bash
$ ./app
$ node app
$ node --harmony app
$ n use 0.11.13 app
```
Say you have a global `bin` you want to use:
```json
{
"bin": {
"myapp": "app.js"
}
}
```
You don't have to worry about trying to shove `--harmony` somewhere:
```
$ sudo myapp
$ sudo node myapp
```