NPM
Node.js Package Manager
Alternative
scripts
in sequence
Works on Linux and Windows
{
"scripts" : {
"build.js" : "...",
"build.css" : "...",
"build" : "npm run build.js && npm run build.css"
}
}
scrtips
in parallel
On Linux
{
"scripts" : {
"watch.js" : "...",
"watch.css" : "...",
"watch" : "npm run watch.js & npm run watch.css"
}
}
On Linux and Windows
npm i concurrently --save-dev
concurrently "npm:watch.js" "npm:watch.css"
# or
concurrently "npm:watch.*"
{
"scripts" : {
"watch.js" : "...",
"watch.css" : "...",
"watch" : "concurrently 'npm:watch.*'"
}
}
yarn run
yarn run <command>
will execute the first match of
scripts
field from localpackage.json
- the local workspace's dependencies binary
- the specified name contains a colon character and one of the workspaces in the project contains exactly one script with a matching name
npx
npx <command>
will execute the first match of
<command>
exists in PATH- the local project binaries
- If
<command>
is not found, it will be installed prior to execution