JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q20504F
  • License MIT

Programmatic interface for configuring and running Angular CLI commands.

Package Exports

  • ng-programmatic

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ng-programmatic) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

ng-programmatic

Azure DevOps builds Azure DevOps coverage npm

Fully typed programmatic interface for configuring and running Angular CLI commands. Primarily designed for use with taskrunners such as Gulp, but could easily be used anywhere.

Currently supports:

  • ng build
  • ng lint
  • ng test
  • ng serve

Install

$ npm i ng-programmatic

Usage

import { Ng, NgBuild } from "ng-programmatic";

// --- Assign args via constructor.
const ngBuild: NgBuild = Ng.Build({ aot: true });

// --- Assign args in bulk, will clear any existing args by default.
ngBuild.setArgs({
  baseHref: "./",
  configuration: "production"
});

// --- Assign args in bulk, with optional merge parameter to keep any existing arguments set.
ngBuild.setArgs({ aot: false }, true);

// --- Assign args individually.
ngBuild
  .setArg("aot", false)
  .setArg("baseHref", "src/")
  .setArg("configuration", "development");

// --- Get current command string.
console.log(ngBuild.toString());
// => `ng build --aot=false --baseHref=src/ --configuration=development`

// --- Run the command.
ngBuild.run().then((result) => {});