Development

Angular

Adding Components

Syntax for creating a new Angular component:

Example :
npm run ng -- generate component <component-name> --project=<project-name> --module=<module-name>

Note: Replace <component-name> with the component name to create, <project-name> with the project to put the component, and <module-name> with the module name to define the component.

Example, create a new component in the gmm/distance application:

Example :
npm run ng -- generate component gmm/distance/components/hello --project=nshmp-apps --module=gmm/distance

Note: The above example creates a new hello component in the gmm/distance/components directory and update the module in gmm/distance.

Adding Services

Syntax for creating a new Angular service:

Example :
npm run ng -- generate service <service-name> --project=<project-name>

Note: Replace <service-name> with the service name to create and <project-name> with the project to put the service

Example, create a new service in the gmm/distance application:

Example :
npm run ng -- generate service gmm/distance/services/hello --project=nshmp-apps

Note: The above example creates a new hello service in the gmm/distance/services directory.

Adding Modules

Syntax for creating a new Angular module:

Example :
npm run ng -- generate module <module-name> --project=<project-name> --flat

Note: Replace <module-name> with the module name to create and <project-name> with the project to put the module

Example, create a new module in the gmm/distance application:

Example :
npm run ng -- generate module gmm/distance/hello --project=nshmp-apps --flat

Note: The above example creates a new hello module in the gmm/distance directory.

Development Server

For a development server, run:

Example :
npm run start

Applications run on http://localhost:4200/nshmp/.

When running the development server any changes to the source code automatically will rebuild the application.

Build

The main application, projects/nshmp-apps, can be built with:

Example :
npm run build

GitHooks

This projects uses Husky to run GitHooks on pre-commit and pre-push.

On pre-commit the following run:

  • pretty-quick --staged
  • npm run lint

On pre-push the following run:

  • pretty-quick --staged
  • npm run lint
  • npm run build:prod

Lint

To run the linting tools, run:

Example :
npm run lint

For automatic fixes, run:

Example :
npm run fix

Production Server

For a productions server, run:

Example :
npm run build:prod
npm run start:prod

Applications run on http://localhost:4200/nshmp/.

Context Path

The context path can be changed:

Example :
npm run build:prod -- --bash-href /some/path/
npm run start:prod

Where some/path is the new context path.
Applications would then run on http://localhost:4200/nshmp/some/path/


Previous: Docker    

results matching ""

    No results matching ""