Powerful Starterkit combining all latest advanced Angular features. Strict typescript mode and preventing pushing untested code. Read more for all features.
- βοΈ Modern vs. Legacy build (ES5 vs ES2015)
- π IVY opt-in
- βοΈ NGRX store (implemented according ngrx.io)
- π΄ Lazy Loading
- βοΈ HttpInterceptor
- βοΈ NGX-Translate (assets/i18n/{locale}.json)
- π SSR (Server Side Rendering)
- π Prerendering (for SEO and static HTML generation)
- π PWA (Progressive Web App)
- π Service Worker detects new build versions
- π€ Unit Test (Karma)
- π€ E2E Test / Reports (Protractor / Cucumber)
- π Documentation Generation (Compodoc)
- π WPO: Google Lighthouse reporter (save to Compodoc additional docs)
- π WPO: Stats for ES5 build and ES2015
- π― Git hooks (husky)
- π― Extend Angular CLI (webpack)
- π€© Ability to Mock data (mockServer)
- MAC:
npm run certificate:generate:mac && npm run start:clean
- Windows: remove ssl from
serve
inside 'angular.json' andnpm run start:clean
npm run start
available at https://localhost:4202/
(Hot reloading enabled)
npm run start:mock
will use the mock environment, which connects with the mockServer at http://localhost:4000
Because we are running localhost on SSL (https), you will need to generate a certificate and key, and place them in a folder called build
. Run npm run certificate:generate:mac
to create the required certificates and place them in the required folder.
Git hooks are active, which means you only can commit when there are no linting errors, and all unit-tests succeeds. Other commmands can be implemented in the package.json
with husky
.
npm run build
- normal production buildnpm run build:gzip
- production build with files already gzippednpm run prerender:build
-npm run build:gzip
with prerendering all routesnpm run ssr:build
- production build with Server Side Rendering
To create an Ivy build, you'll need to update src/tsconfig.app.json
and set enableIvy: true
.
NOTE: Be aware when doing this, functionality for SSR and Prerendering won't work at this moment (Angular 8.x.x).
This project comes with built-in SSR functionality. The effect of SSR will be valuable on larger projects or slower internet connections, run Google Audit with slow network to see the difference.
- For Serving -
npm run start:ssr
- For Building -
npm run ssr:build
- For Serving -
npm run start:prerender
- For Building -
npm run prerender:build
It is possible to extend the Angular CLI settings via a webpack.partial.js
. Angular CLI will still optimize all functionality without being ejected. The Webpack Partial still gives you the opportunity the specify certain extra configurations in Webpack.
npm run lint
- Linting applicationnpm run test
- Unit test Watchernpm run test:unit-headless
- Unit test single Runnpm run test:e2e
- End to End test with Protractor and reports with Cucumber
Run npm run test
to execute the unit tests via Karma. This script will be run as a watcher. Most effective to run this alongside npm run start
while developing.
Run test:unit-headless
to execute a single run for the Unit test. Best usecases are for pre-commit checks and in pipeline scripts.
Both scripts will provide a Code Coverage file, which can be found in './reports/coverage'
Run npm run test:e2e
to execute the E2E protractor tests. Tests can be found within ./e2e all written in Cucumber style.
This test will provide an report which will be shown at the end of all tests. It can also be found in ./reports/e2e/report. When tests fails, there will be a screenshot attached to the scenario where the test has failed.
When npm run test:e2e
fails to compile as of webdriver issues, run npm run test:e2e:fix-webdriver
to fix this compile error and try again.
npm run doc:full
- create documentation with compodoc- Unit test coverage
- E2E reports
- WPO reports
sample can be fount at './documentation/index.html'
npm run wpo:stats
to get a clear view of all dependencies and their dependencies for your project (when IVY is disabled).npm run wpo:stats-es5
to get a clear view of all dependencies and their dependencies for your project (when IVY is enabled).npm run wpo:stats-es2015
to get a clear view of all dependencies and their dependencies for your project (when IVY is enabled).npm run wpo:lighthouse
to get a lighthouse score for your current project. (change the URL inci/fetchLighthouse.js
).
As of version 1.1.0 it is possible to setup a mockServer with npm run server:mock
. Port will be http://localhost:4000
and the different status can be set at http://localhost:4000/mocking
. All data can be setup in './mockServer'. Examples of API, JSON and images are added.
- IVY build - https://angular.rickvandermeij.nl
- Prerendering (no IVY) - https://angular-prerender.rickvandermeij.nl
- Server Side Rendering (no IVY) -
npm run start:ssr