Just a short note on discovery (which is not too much of a discovery actually): you can use pre- & post- hooks in npm-scripts
for your own custom tasks.
So, next time you would need to run several things as part of one task, you could leverage those.
{
"scripts": {
"premyscript": "echo \"Pre stuff\"",
"myscript": "echo \"LOL MY SCRIPT\" ",
"postmyscript":"echo \"Post stuff\""
}
}
So, if we run npm run myscript
in the folder where package.json would hold abovementioned lines, we would see something like:
$ npm run myscript
> npm-test@0.0.0 premyscript /home/sudodoki/Projects/npm-test
> echo "Pre stuff"
Pre stuff
> npm-test@0.0.0 myscript /home/sudodoki/Projects/npm-test
> echo "LOL MY SCRIPT"
LOL MY SCRIPT
> npm-test@0.0.0 postmyscript /home/sudodoki/Projects/npm-test
> echo "Post stuff"
Post stuff
UPD (21/7/14): Note on this became part of oficial documentation. OSS FTW