Skip to content

CLI tool for enforcing Node/npm versions with Hall & Oates lyrics

License

Notifications You must be signed in to change notification settings

nicheinc/node-can-do

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-can-do

GitHub license npm version

node-can-do is a CLI tool for enforcing a project's Node/npm versions with Hall & Oates lyrics.

Daryl Hall singing "I Can't Go For That"

Installation

To install for usage in a specific project, run the following:

npm install --save-dev node-can-do

Usage

First, specify the version of Node and version of npm that you would like to enforce for your project in the project's package.json, specifically in the engines section:

"engines": {
  "node": "12.13.0",
  "npm": "6.12.1"    
},

Make sure to only use a specific value, no version ranges.

In addition/instead of package.json, you can specify the version of Node you would like to enforce in an .nvmrc file.

12.13.0

Next, we recommend using node-can-do in conjunction with npm scripts in package.json, e.g.

"scripts": {
  "myscript": "node-can-do && node ./index.js"
},

Or preferably using the pre script hook, e.g.

"scripts": {
  "premyscript": "node-can-do",
  "myscript": "node ./index.js"
},

Finally, run

npm run myscript

If you are running the versions of Node and npm that are specified in package.json or .nvmrc, then your script should continue as normal 🎉.

If you are running a different version of Node and/or npm, node-can-do will produce terminal output informing you to change your version of the incorrect tool, and then stop script execution with an exit code 1 🛑.

If there is no specified version of Node and/or npm, node-can-do will produce terminal output informing you to add your required versions in one of the locations specified in Usage, and then stop script execution with an exit code 1 🛑.

Issues

Feel free to file issues at https://github.com/nicheinc/node-can-do/issues/new

About

CLI tool for enforcing Node/npm versions with Hall & Oates lyrics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •