As we know, you can run arbitrary commands using npm run by adding a hash of scripts to your package.json :
"scripts": { "build-js": "browserify browser/main.js | uglifyjs -mc > static/bundle.js" }
which will then be launched with npm run build-js .
You can also move these commands to separate scripts, such as bash scripts, as such:
"scripts": { "build-js": "bin/build.sh" }
This obviously does not work on Windows due to the fact that Windows cannot run bash scripts. You can install bash ports, etc., but I would like to use some design for Windows to do the same.
I tried other approaches, including using child_process.exec to run arbitrary commands from a standard node script file:
"scripts": { "build-js": "node bin/build.js" }
But I noticed child_process chokes in relatively large / intensive operations, which makes use impossible.
Is there any Windows (or even better, cross-platform) way to move these package.json npm run scripts to separate files? Preferably one that does not require bash?
source share