Ok, I have a project where I use npm. I need it to compile several .coffee scripts.
I need to execute multiple prestart scripts, like:
"scripts": {
"prestart": "coffee -c ./file1.coffee",
"prestart": "coffee -c ./file2.coffee",
"prestart": "coffee -c ./file3.coffee",
"prestart": "coffee -c ./file4.coffee",
"start": "node ./file1.js"
},
But it only seems to execute the last one, and it doesn't let me append many scripts on one like:
"prestart": "coffee -c ./file1.coffee; coffee -c./file2.coffee"
What can I do?
wrap them in a parent script
"scripts": {
"prestart": "sh ./make-coffee.sh",
"start": "node ./file1.js"
},
//make-coffee.sh
#!/bin/bash
coffee -c ./file1.coffee
coffee -c ./file2.coffee
coffee -c ./file3.coffee
coffee -c ./file4.coffee
or another (unix-only) solution is to run multiple commands. I don't know what happens if the early commands fail.
"scripts": {
"prestart": "coffee -c ./file1.coffee; coffee -c ./file2.coffee; coffee -c ./file3.coffee; coffee -c ./file4.coffee",
"start": "node ./file1.js"
},
you can use &&
like this
"scripts": {
"prestart": "coffee -c ./file1.coffee && coffee -c ./file2.coffee && coffee -c ./file3.coffee && coffee -c ./file4.coffee",
"start": "node ./file1.js"
},
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With