npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ng-extra-build

v1.4.0

Published

extra build for angular-cli 1.x

Downloads

30

Readme

ng-extra-build

ng-extra-build is a build tool for angular-cli, you can use this for extra building tasks that angular-cli can't do, especially for multi-environment.

Features

  • Copy resources for the specified environment.
  • Compile and compress css file for the specified environment.
  • Merge i18n files for the specified environment.
  • Replace contents in final packaged file for the specified environment.
  • Delete files
  • Compress files

Getting Started

Installation

npm install ng-extra-build --save-dev

Usage

Configuration

After ng-extra-build installation is completed, you can find a configuration file named build.conf.json in $your_project_dir, you should modify this file as your requirements. See Configuration Reference.

Command

Append below command after angular-cli build command:

ng-extra-build -env=envName -config=config-file-path

For example, if neware is one of your envoriment name, add below json content in $Your_project_dir/package.json:

{
  ...
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "neware": "ng build -prod -sm=false -aot -e neware && ng-extra-build -env=neware"
  },
  ...
}

And then execute command

npm run neware

to build application for production.

Command Arguments

Argument | Required | Default | Description ---|---|---|--- -env | true | null | Envrionment name -config | false | build.conf.json | Configuration file path. The file path is relative to current working direction (same as path.cwd() in nodejs)

Configuration Reference

  • base (object): The base config.

    • outDir (string): The output directory for build results.This value must set be same as outDir in Angular CLI.
  • copy (array): Copy resources into outDir.

    • from (string): Source file which will be copied.
    • to (string): Destination file which will be copied to.
  • css (object): Css compile options.

    • from (string): Source css file.
    • to (string): Destination css file.
    • devUrl (string): The css href in tag <link> in index.html for the development environment.After build, will replace this href with production environment href.
  • i18n (object): Build options for i18n files

    • source (string): Directory of source i18n files
    • extra (string): Directory of extra i18n files
    • target (string): Directory of target i18n files
  • replacement (array): Replacement configurations

    • file (string): The file (path) you want to execute the replacement.
    • contents (array): Contents you want to replace.
      • replace (string): Contents you want to replace.
      • with (string): Contents you want to replace with
      • withEnv (object): Contents you want to replace with for the specified environment. key is environment name, value is corresponding content you want to replace with.
  • deletion (array): Files you want to delete.

  • compression (object): Compression configurations.

Example Configuration File

{
  "$schema": "./node_modules/ng-extra-build/schema.json",
  "base": {
    "outDir": "dist"
  },
  "copy": [
    {
      "from": "$root/src/env/$env/favicon.ico",
      "to": "$dist/favicon.ico"
    }
  ],
  "css": {
    "from": "$root/src/env/$env/css/theme.css",
    "to": "$dist/assets/css",
    "devUrl": "env/neware/css/theme.css"
  },
  "i18n": {
    "source": "$root/src/assets/i18n",
    "extra": "$root/src/env/$env/i18n",
    "target": "$dist/assets/i18n"
  },
  "replacement": [
    {
      "file": "$dist/index.html",
      "contents": [
        {
          "replace": "Neware Club",
          "withEnv": {
            "neware": "Neware RSP",
            "joy": "Joytele RSP"
          }
        }
      ]
    }
  ],
  "deletion": [
    "$dist/env"
  ],
  "compression": {
    "from": "$dist",
    "to": "$root"
  }
}