Package.json scripts and custom settings

NOTE: the CLI flags presented in this section were used on Angular <= 5.x. While some of them are still supported on Angular CLI 6.x+, it is recommended to use the new angular.json configuration file. See the corresponding section (Angular 6 setup) for more details.

AOT

we want to run in development mode with ahead of time compilation mode enabled this is because when we build the app AOT is enabled by default and in that phase some errors could arise, so is better to spot those in development phase:

ng serve --aot=true

HTTPS

Of course we want to create secure app, so we need to enable https by default, if we work with https all the request made from the browser needs to be on https, for this reason we have a proxy that enable https on our mock api

ng serve -ssl

Port

In most of the case we have multiple app that are running at the same time in our localhost so for every app we'll use a random port to not clash

ng serve --port=4321

Environment

Read the chapter above about envs. To specify to the Angular server which env we want to enable we have to specify it like this

ng serve --e="development" OR ng serve --e="staging" ...

Target

Target is a params that ask Angular CLI to optimise the build output for production or not (minify assets / css / js / html / create source map / remove some extra tag added to the DOM / other optimisations)

ng serve --target="development" OR ng serve --target="production"

NPM scripts

serve the project

build the project

we have those scripts to build the project based on envs

"build": "npm run build:development",
"build:development": "ng build --configuration=development && npm run post-build",
"build:remote-development": "ng build --configuration=remote-development",
"build:staging": "ng build --configuration=staging && npm run post-build",
"build:production": "ng build --configuration=production && npm run post-build",

Run automated tests UT and E2E tests

Please read test section

Lint the project

Please read Project Structure / Naming conventions / Code style

results matching ""

    No results matching ""