- Notifications
You must be signed in to change notification settings - Fork1
CLI tool for enforcing Node/npm versions with Hall & Oates lyrics
License
nicheinc/node-can-do
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
node-can-do
is a CLI tool for enforcing a project's Node/npm versions with Hall & Oates lyrics.
To install for usage in a specific project, run the following:
npm install --save-dev node-can-do
First, specify the version of Node and version of npm that you would like to enforce for your project in the project'spackage.json
, specifically in theengines
section:
"engines": {"node":"12.13.0","npm":"6.12.1" },
Make sure to only use a specific value, no version ranges.
In addition/instead ofpackage.json
, you can specify the version of Node you would like to enforce in an.nvmrc
file.
12.13.0
Next, we recommend usingnode-can-do
in conjunction withnpm scripts
inpackage.json
, e.g.
"scripts": {"myscript":"node-can-do && node ./index.js"},
Or preferably using thepre
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 inpackage.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 inUsage, and then stop script execution with an exit code 1 🛑.
Feel free to file issues athttps://github.com/nicheinc/node-can-do/issues/new
About
CLI tool for enforcing Node/npm versions with Hall & Oates lyrics