Today, I was curious whether I could get to the point where I could use the Angular’s CLI ability in order to generate boilerplate files in an environment which wasn’t created by the CLI.

The reason I was curious was that there are applications and libraries that are not built on top of the CLI and yet could benefit from its boilerplate generator ability.

After a few attempts, I finally reached the desired result. Let me share with you the process.

Go to any project and run the following command:

npm install @angular/cli --save-dev

In the root directory of your project, create an .angular-cli.json file and paste in it the following code:

{

"apps": [{

"appRoot": ".",

"root": "lib",

"prefix": "your-prefix"

}],

"defaults": {

"styleExt": "scss",

"component": {

"changeDetection": "OnPush"

}

}

}