Skip to content

Latest commit

 

History

History
98 lines (71 loc) · 3.48 KB

scripts.md

File metadata and controls

98 lines (71 loc) · 3.48 KB

NPM Scripts

All the things you need to know about the npm developer API.

Table of Contents generated with DocToc

Task name convention

All the scripts are in lowercase like test.

For subtasks is to separate names with double dots like this task:subtask so you can execute npm run build:dev.

Build (build)

Make the dev bundles of the app.

Subtasks:

  • aot: build the app using angular ahead of time compilation.
  • ci: same as build:dev but with ci specific conf.
  • dev *: make the app bundles in memory.
  • prod: make the bundles, parse the index.html and copy the src/public directory content into the dist folder.

CI (ci)

Scripts usefull to run into the CI environment. All the tasks run the lint and tests tasks.

Subtasks:

  • aot: Runs the e2e tests with an aot build.
  • jit: Runs the e2e tests with an normal production build.
  • nobuild: Runs the same without building the app before.
  • testall *: Runs the base and the e2e tests with all the different kinds of build.

Clean (clean)

Remove node modules folder, npm cache and all the stuff generated by other tasks like tests, coverage, etc.

Subtasks:

  • aot: remove only the compiled folder.
  • dist: remove only the dist folder.
  • install: execute clean task and install node dependencies.
  • start: execute clean task and start the dev server.

DocToc (doctoc)

Create or updates the tables of content of the markdown documentation files. You can see the package page here.

  • generate *: Run the command against the markdown files.
  • ci: Runs the generation tasks and check if there are changes at any file in the repo, if yes exit an error because the generation command changed something. The documentation must have the table of contents always updated when the repo is pushed to origin.

Lint (lint)

Executes all the main tasks for linting the source code and conf files.

Subtasks:

  • md: Lint all the markdown code.
  • js: Lint all the javascript code, including configuration files at config/.
  • ts: Lint all the typescript app code, including tests files.

Server (server)

Start a webserver for being accesible from a browser.

Subtasks:

  • dev *: start a webpack-dev-server that serves the app in memory in watch mode.
  • ci: start the same as server:dev but with no watch or progress indicator.
  • prod: start a simple web server that serves dist folder contents through port 8080.

Test (test)

Run the unit tests of the app with Karma and calculate the coverage.

Watch (watch)

He runs a task and stay waiting for files modifications.

Subtasks:

  • dev *: executes the dev build task on every file modification.
  • prod: executes the prod build task on every file modification.
  • test: run the unit tests on every file modification.

The * at subtask specification means that it runs when no subtask is specified.