Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ember-env-macros

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-env-macros

The default blueprint for ember-cli addons.

  • 0.3.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
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

Package last updated on 14 Dec 2019

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc