node.js - Run NPM scripts synchronously -
to start project, have 4 terminal commands need executing in order, 1 after , in different terminal windows:
npm install gulp php -s localhost:8001 browser-sync start --proxy "localhost:8001" --files "**/*"
to speed things up, want put theses in package.json
, execute them single command so:
scripts: { "start": "npm install && gulp && php -s localhost:8001 && browser-sync start --proxy 'localhost:8001' --files '**/*'" }
but won't run them asynchronously , in same shell?
you must try exec-sync , provide scripts command 1 one.
var execsync = require('exec-sync'); execsync('npm install'); execsync('gulp'); execsync('php -s localhost:8001');
Comments
Post a Comment