npm run scripts in separate file

Viewed 265

I have an Angular project that has several libraries, using a plugin Architecture the idea is to be able to build and then serve each plugin in a separate server.

My build:plugins script is getting rather long:

scripts: {
   "build:plugins" : "ng build plugin1 && ng build plugin2 && ng build plugin3 && ng build plugin4 ..."

}

you get the idea.

Is there any way to move the ng build plugin 1... to a script file?

Thanks

1 Answers

Use bash.

Since npm scripts are bash, moving them to a separate bash file will do the trick.

Create a file called script.sh, move the command there, and then you do the following on the command line

bash script.sh
Related