npm.io
0.0.0 • Published 7 years ago

@flatxph/angular-builders

Licence
MIT
Version
0.0.0
Deps
0
Size
12 kB
Vulns
0
Weekly
0

Builders

These are customized builders to make node development easier on the latest angular cli.

Environment Builder

This builds an environment file that supports path variables for easier deployment to cloud providers.

To use this builder, do the following:

  • Create a build.ts file with the following format:
export default const environment = {
    production: process.env.PRODUCTION || false,
    ...
    <variable>: process.env.<VARIABLE> || <default value>
    ...
}
  • On the angular.json, import this as an architect with the following options:

  • An example of this is:

Architect for angular.json

    "environment": {
        "options": {
            model: "Environment";
            modelPath: "./src/environments/model";
            filename: "environment.prod.ts";
            path: "./src/environments/";
            builder: "./src/environments/builder";
        }
    }

File for build.ts

export default const environment = {
    production: process.env.PRODUCTION || false,
    maps: {
        apiKey: process.env.MAPS_API_KEY,
        libraries: process.env.MAPS_LIBRARIES ? process.env.MAPS_LIBRARIES.split(',') : [],
    }
}

Output file environment.prod.ts

export default const environment: Environment = {
}

Keywords