Socket
Socket
Sign inDemoInstall

ember-env-macros

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ember-env-macros

The default blueprint for ember-cli addons.


Version published
Weekly downloads
130
decreased by-25.29%
Maintainers
1
Install size
10.1 kB
Created
Weekly downloads
 

Readme

Source

ember-env-macros

npm version Build Status

Get both build and runtime configurations in Ember app or addon.

Compatibility

  • Ember.js v3.4 or above
  • Ember CLI v2.13 or above
  • Node.js v8 or above

Installation

yarn add ember-env-macros

Usage

If you have build env:

// ember-cli-build.js
module.exports = function(defaults) {
  let app = new EmberAddon(defaults, {
    'some-config': {
      buildKey: true,
      nestedKey: {
        key: 'build',
      },
    },
  });

  return app.toTree();
};

and config env:

module.exports = function(environment) {
  let ENV = {
    // ...
    'some-config': {
      envKey: false,
      nestedKey: {
        key: 'config',
      },
    },
}

You can get access to them via:

import { configEnv, buildEnv } from 'ember-env-macros';

let model = {
  config: {
    envValue: configEnv('some-config.envKey'),
    nestedValue: configEnv('some-config.nestedKey.key'),
    defaultValue: configEnv('some-config.missingKey', 'default'),
  },
  build: {
    buildValue: buildEnv('some-config.buildKey'),
    nestedValue: buildEnv('some-config.nestedKey.key'),
    defaultValue: buildEnv('some-config.missingKey', 'default'),
  },
};

The build output will be:

var model = {
  config: {
    envValue: false,
    nestedValue: 'config',
    defaultValue: 'default',
  },
  build: {
    buildValue: true,
    nestedValue: 'build',
    defaultValue: 'default',
  },
};

When used in an addon or engine, both config and build envs are from the host app.

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.

Keywords

FAQs

Last updated on 14 Dec 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc