Help you ease development experience with an
@angular/cli 6+ project with multiple applications and/or libraries.
npm i @nephidream/ng-helper -D
npm i @nephidream/ng-helper -g
Make the bin directly available in your
package.json script like
Like this you can do stuff like
npm run ng-helper -- serve -i. A typical use could be
Please note that
-A will select all projects (apps and libraries), so if you have multiple applications, you might want to adapt your start scripts like
You can serve multiple applications and libraries with just one line of code using
ng-helper serve. With this, served libraries are automatically rebuilt on code modification, and the apps using them as well. A typical use case could be
ng-helper serve --all-libs my-app.
Usage: ng-helper serve [options] [projects...]Options:-A, --all
For example, if you are in the root of your project and you generated some applications and/or libraries, your
angular.json might look like
So you could serve them (partially) with
npm run ng-helper -- serve lib-b app-b lib-a. The libraries will be served first and then the applications. Also, the serving follows the order in the
angular.json file. So in this example, the projects are served in the following order:
lib-b and then
A few other things to consider:
- When serving multiple apps at the same time, beware that the default port 4200 might be used for all of them, so you might want to modify the corresponding
angular.jsonproperties to specify different ports for the different apps.
- The e2e applications cannot be served and the binary ignore all applications ending with
- Since the order in the
angular.jsonset the build order of the libraries, be sure that, if you have a library
lib-bthat depends on a library
lib-ashould be placed before
You can build multiple applications and libraries with just one line of code using
Usage: ng-helper build [options] [projects...]Options:-A, --all
The build order follow the same logic as the one presented in the
You can test multiple applications and libraries with just one line of code using
Usage: test [options] [projects...]Options:-A, --all
If one of the projects' tests fail, the process exit with the corresponding exit code;
You can change the version of all
package.json of the different projects.
Usage: version [options] [value]Options:-p, --project-root <path> path to the root of the repository-h, --help output usage information
If no value (like
1.0.1) is given, the version of the root
package.json will be applied to all others.