Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including @ngstack/install with all npm packages installed. Try it out:

var install = require("@ngstack/install")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@ngstack/install v0.3.1

Angular Package Installer


Build Status

Command-line utility for installing Angular libraries into the Angular CLI-based projects.

Main features

  • Install library from the NPM or local package (i.e. tarball file)
  • Register assets, styles and scripts with angular.json
  • Register library modules in the application
  • Format updated application module with Prettier
  • Generate new configuration file for a library

Getting the tool

Install as a global package using the following command:

npm i -g @ngstack/install

You can use the tool everywhere using ngi alias.


Run ngi without parameters to see the internal help.

-v, --versionoutput the version number
-n, --name <name>set library name if installing from custom sources (default: null)
--initcreate a new configuration file
--module <module>module to use for the registration (default: app)
--import [modules]list of modules to import
--skip-installskip installing library
--skip-assetsskip copying assets
--skip-moduleskip module registration
--skip-formatskip code formatting
-h, --helpoutput usage information

Preparing libraries

Add and publish an ngi.json file as part of your library.


  "assets": [
      "glob": "**/*.json",
      "input": "./assets",
      "output": "./assets/plugins"
  "modules": [
      "name": "MyExtensionModule",
      "namespace": "my-extension"

Based on the configuration above, the tool is going to perform the following actions:

  • copy all JSON files from assets to the assets/plugin folder
  • generate import { MyExtensionModule } from 'my-extension'; in the /src/app/app.module.ts
  • put the MyExtensionModule into the module imports section

Asset configuration

The asset configuration format is based on the Angular CLI settings. However, the input property defines the path relative to the library structure, rather than application one.

  "glob": "**/*.json",
  "input": "./assets",
  "output": "./assets/plugins"

Styles and Scripts

You can also register custom styles and scripts in the corresponding sections within angular.json file.

Example (ngi.json):

  "styles": ["./styles/one.css", "./styles/two.css"],
  "scripts": ["./scripts/test1.js", "./scripts/test2.js"]

Upon execution the ngi tool is going to use relative paths to the extension folder.

Example (angular.json)

  "styles": [
  "scripts": [

Installing arbitrary libraries

The tool works best with the ngi.json configuration files that are published with the libraries. However it is also possible to install an arbitrary Angular library.

In this case you need to provide one or multiple module names to import.

ngi @company/library --import=Module1,Module2

As a result of the command above, the tool is going to install @company/library from the NPM, and setup the main application module with two imports:

import { Module1 } from '@company/library';
import { Module2 } from '@company/library';

  imports: [Module1, Module2]
export class AppModule {}

Note that you will have to setup asset rules for angular.json file manually.


Install library my-extension from the NPM and perform integration tasks if ngi.json file present.

ngi my-extension

Install library from the tarball generated by the npm pack command. Use my-extension name to find and use library in the node_modules.

ngi my-extension-0.0.1.tgz my-extension

Perform only application module integration for manually installed library

ngi my-extension-0.0.1.tgz my-extension --skip-install --skip-assets



RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free