0.1.0 • Published 5 years ago

grunt-angularjson-append-projects v0.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

grunt-angularjson-append-projects

use grunt to append projects to an angular.json file

story

angular 6 introduced creating angular libraries by using the angular cli.

  • create a project: ng new angular-library-container
  • create a subproject (library): ng generate library example-angular-lib --prefix=pfx

If you are not yet familiar to this, I recommend reading:
https://blog.angularindepth.com/creating-a-library-in-angular-6-87799552e7e5
https://blog.angularindepth.com/angular-workspace-no-application-for-you-4b451afcc2ba

... which works perfectly, if you did not release libraries before the time of angular 6. If you did - well, you have to glue things together. Which is why I created grunt-angularjson-append-projects.

getting started

This guide assumes, that you are familiar with the use of grunt.
After having installed grunt@>=1.0.4, you may install this plugin by the following command:

npm install grunt-angularjson-append-projects --save-dev

Once the plugin has been installed, it may be loaded from within your gruntfile:

grunt.loadNpmTasks( "angularjson" );

The task can be run now:

grunt angularjson

usage

const BUILD = "build";

angularjson: {
  template:     "config/angular/angular.json", // file relative to gruntfile.js
  build:        BUILD,  // build directory - relative to gruntfile.js
  libs:         [ // directory pattern(s) for including libraries, relative to gruntfile.js
                  "lib-*",
                  "otherlib",
                  "!lib-dont-include-this-one"
                ],
  fragments:    [ // pattern(s) used to search for (one!) fragment in each library directory (see: libs)
                  "config/angular/angular.lib.json", // relative to library directory
                  "**/angular.lib.json"
                ]
},