Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 25 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 (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-01-09T14:51:40.000Z (almost 4 years ago)
- Last Synced: 2024-04-24T18:55:34.690Z (8 months ago)
- Language: TypeScript
- Homepage:
- Size: 191 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# [ng-programmatic](https://www.npmjs.com/package/ng-programmatic)
![Azure DevOps builds](https://img.shields.io/azure-devops/build/tobybessant/25ef4e67-35f0-45f9-a969-e4f0fadecea8/1?label=Build)
![Azure DevOps coverage](https://img.shields.io/azure-devops/coverage/tobybessant/ng-programmatic/1?label=Coverage)
![npm](https://img.shields.io/npm/v/ng-programmatic?label=NPM)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) => {});
```