I want to try using npm to run my various build tasks for a web application. I know I can do this by adding a scripts
field to my package.json
like so:
"scripts": {
"build": "some build command"
},
This gets unwieldy when you have more complex commands with a bunch of options. Is it possible to move these commands to a bash script or something along those lines? Something like:
"scripts": {
"build": "build.sh"
},
where npm run build
would execute the commands in the build.sh
file?
Reading through this post it seems like it is, but I'm not clear on exactly where I'm supposed to drop my build.sh
file or if I'm missing something.
rm
? install rimraf, then use that in an npm script.mkdir -p
? installmkdirp
and then use that in an npm script. You have a platform independent universal scripting language, right there, don't then go and pretend it 'Nix only. Does the commandline get too complicated? Use a task runner likegrunt
orgulp
. Keep it universal.