This repository is a basic Schematic implementation that is based on this https://javascript-conference.com/blog/how-to-create-your-own-angular-schematics/.
I created this repo so that you can automatically create your Angular projects with predefined settings. In this script, I've pre-configured a config that allows for a faster ng serve
. The script can also be changed to pre-load and pre-configure anything else you want for your new angular projects.
To use locally,
git clone
this repository to the folder where you create your projectssudo npm install -g @angular-devkit/schematics-cli && sudo npm install -g @schematics/angular
cd angular-fast-serve
npm install
npm run build
cd ..
- Edit the package.json in this parent folder (your projects folder), if you don't have a package.json there, use
npm init
to create a basic one and add the following to this file:
"scripts": {
"test": "schematics ./angular-fast-serve/src/collection.json:fast --debug=false"
}
-
now you can run
npm test
in your projects folder to create a new angular project with your custom configuration -
inside the new project you can run
npm start
to run the following:
ng serve --live-reload=false -c fast -o
"fast": {
"optimization": false,
"outputHashing": "none",
"sourceMap": false,
"extractCss": false,
"namedChunks": false,
"showCircularDependencies": true,
"aot": true,
"extractLicenses": false,
"statsJson": false,
"progress": false,
"vendorChunk": true,
"buildOptimizer": false
}
This allows your serve to be faster when developing in the browser.
That's it!