https://github.com/tobybessant/ng-programmatic
Configuration-as-code implementation for configuring and running Angular CLI commands. Primarily designed for use within a taskrunner framework.
https://github.com/tobybessant/ng-programmatic
Last synced: 28 days ago
JSON representation
Configuration-as-code implementation for configuring and running Angular CLI commands. Primarily designed for use within a taskrunner framework.
- Host: GitHub
- URL: https://github.com/tobybessant/ng-programmatic
- Owner: tobybessant
- License: mit
- Created: 2020-12-02T20:07:02.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-01-09T14:51:40.000Z (almost 5 years ago)
- Last Synced: 2025-10-10T11:02:49.661Z (28 days ago)
- Language: TypeScript
- Homepage:
- Size: 191 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# [ng-programmatic](https://www.npmjs.com/package/ng-programmatic)



Fully typed programmatic interface for configuring and running Angular CLI commands. Primarily designed for use with taskrunners
such as [Gulp](https://gulpjs.com/), but could easily be used anywhere.
Currently supports:
- `ng build`
- `ng lint`
- `ng test`
- `ng serve`
# Install
```bash
$ npm i ng-programmatic
```
# Usage
```ts
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) => {});
```