Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Webpack Dev Server | 7,624 | 435,215 | 77,958 | 8 hours ago | 203 | September 19, 2022 | 55 | mit | JavaScript | |
Serves a webpack app. Updates the browser on changes. Documentation https://webpack.js.org/configuration/dev-server/. | ||||||||||
Npm Run All | 4,663 | 44,017 | 28,492 | a year ago | 58 | November 24, 2018 | 84 | mit | JavaScript | |
A CLI tool to run multiple npm-scripts in parallel or sequential. | ||||||||||
Nps | 1,391 | 930 | 645 | a year ago | 36 | July 10, 2020 | 25 | mit | JavaScript | |
NPM Package Scripts -- All the benefits of npm scripts without the cost of a bloated package.json and limits of json | ||||||||||
Ultra Runner | 1,133 | 5 | a month ago | 45 | February 28, 2021 | 37 | apache-2.0 | TypeScript | ||
🏃⛰ Ultra fast monorepo script runner and build tool | ||||||||||
Awesome Npm Scripts | 672 | 8 months ago | cc0-1.0 | |||||||
Everything awesome related to npm scripts and using npm as a build tool. | ||||||||||
Better Npm Run | 641 | 3,485 | 637 | 9 months ago | 17 | July 31, 2018 | 3 | mit | JavaScript | |
🏃♂️ Better NPM scripts runner | ||||||||||
Tasksfile | 352 | 239 | 327 | 7 months ago | 43 | January 25, 2019 | mit | TypeScript | ||
Minimalistic task runner for node.js | ||||||||||
Vscode Npm Scripts | 208 | 4 months ago | 2 | mit | TypeScript | |||||
VSCode extension for running npm-scripts and validating the package.json files. | ||||||||||
Npm Run | 179 | 1,585 | 254 | 5 years ago | 14 | April 12, 2018 | 6 | mit | JavaScript | |
Run locally-installed node module executables. | ||||||||||
Node Themekit | 116 | 82 | 45 | a year ago | 24 | June 23, 2021 | 24 | mit | JavaScript | |
Theme asset interaction library and management tools written in Node.js |
This solution is outdated. Check out kentcdodds/cross-env which might better suit your needs!
Better NPM scripts runner
From this:
{
"scripts": {
"build:dist": "NODE_ENV=development webpack --config $npm_package_webpack --progress --colors",
"test": "NODE_ENV=production karma start"
}
}
To this:
{
"devDependencies": {
"better-npm-run": "~0.0.1"
},
"scripts": {
"build:dist": "better-npm-run build:dist",
"build:prod": "better-npm-run build:prod",
"test": "better-npm-run test"
},
"betterScripts": {
"build:dist": "webpack --config $npm_package_webpack --progress --colors",
"build:prod": {
"command": "webpack --config $npm_package_webpack --progress --colors",
"env": {
"NODE_ENV": "production"
}
},
"test": {
"command": "karma start",
"env": {
"NODE_ENV": "test"
}
}
}
}
The betterScripts
script definition can either be a string or sub-object with command
and env
attributes. Values defined in the env
block will override previously set environment variables.
Note that depending on the OS and terminal you're using, dots, spaces or other special characters in the command path may be treated as separators and the command will be parsed wrong.
{
"serve:dist": "./node_modules/.bin/webpack-dev-server --hot --inline --config webpack/development.js"
}
To prevent this you need to explicitly wrap the command path with double quotes:
{
"serve:dist": "\"./node_modules/.bin/webpack-dev-server\" --hot --inline --config webpack/development.js"
}
If you have an .env
file in your project root it will be loaded on every command.
NODE_PATH=./:./lib
NODE_ENV=development
PORT=5000
Environment variables defined in the betterScripts
script definition will take precedence over .env
values.
Currently, using bash variables (PWD, USER, etc.) is not possible:
"command": "forever start -l ${PWD}/logs/forever.log -o ${PWD}/logs/out.log -e ${PWD}/logs/errors.log -a index.js",
In order to use them, you can create an script file (.sh
) instead:
forever.sh
:
forever start -l ${PWD}/logs/forever.log -o ${PWD}/logs/out.log -e ${PWD}/logs/errors.log -a index.js
package.json
:
"command": "./forever.sh"
This module expose 2 cli commands:
better-npm-run
and,bnr
which is an alias to the former.The shorter one is useful for cases where you have a script that calls several better-npm-run
scripts. e.g:
using the normal cli name
"scripts": {
"dev": "shell-exec 'better-npm-run install-hooks' 'better-npm-run watch-client' 'better-npm-run start-dev' 'better-npm-run start-dev-api' 'better-npm-run start-dev-worker' 'better-npm-run start-dev-socket'",
}
using the shorter alias
"scripts": {
"dev": "shell-exec 'bnr install-hooks' 'bnr watch-client' 'bnr start-dev' 'bnr start-dev-api' 'bnr start-dev-worker' 'bnr start-dev-socket'",
}
And for silence output, you can use -s
or verbose --silence
flags
bnr -s watch-client
And you can use -p
or verbose --path
to specify a custom path of dotenv file
bnr --path=/custom/path/to/your/env/vars start-dev
Also use -e
or verbose --encoding
to specify the encoding of dotenv file
bnr --encoding=base64 start-dev
See envdot docs for more infomation