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

@ember/edition-utils

Package Overview
Dependencies
Maintainers
12
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ember/edition-utils - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

.github/workflows/nodejs.yml

11

CHANGELOG.md

@@ -0,2 +1,13 @@

## v1.1.0 (2019-09-15)
#### :rocket: Enhancement
* [#1](https://github.com/emberjs/ember-edition-utils/pull/1) Allow falling back to process.env.EMBER_VERSION. ([@rwjblue](https://github.com/rwjblue))
#### :memo: Documentation
* [#2](https://github.com/emberjs/ember-edition-utils/pull/2) Add some basic README content. ([@rwjblue](https://github.com/rwjblue))
#### Committers: 1
- Robert Jackson ([@rwjblue](https://github.com/rwjblue))
Could not infer "repo" from the "package.json" file.

13

index.js

@@ -30,3 +30,14 @@ /**

function _getEdition() {
return process.env.EMBER_EDITION;
let edition = process.env.EMBER_EDITION;
if (edition === undefined) {
// check fallback "old" location
edition = process.env.EMBER_VERSION;
if (edition === 'octane') {
console.log('Please update to using @ember/edition-utils. Using process.env.EMBER_VERSION to declare your application / addon as "octane" ready is deprecated.');
}
}
return edition;
}

@@ -33,0 +44,0 @@

3

package.json
{
"name": "@ember/edition-utils",
"version": "1.0.1",
"version": "1.1.0",
"description": "Utilities to detect if a given edition is in use in an ember-cli application.",
"repository": "https://github.com/emberjs/ember-octane-utils.git",
"license": "MIT",

@@ -6,0 +7,0 @@ "author": "Robert Jackson <me@rwjblue.com>",

# @ember/edition-utils
This package is the officially supported mechanism for declaring and detecting
the specific edition that a given application is using.
## Usage
### Declaring Edition
In order to declare which edition of Ember your application (or addon) is compatible with
you would call `setEdition` from within your `.ember-cli.js` file. This might look something like:
```js
const { setEdition } = require('@ember/edition-utils');
setEdition('octane');
module.exports = {
// other configuration here
}
```
### Detecting Edition
In order to detect if the currently running application is using _at least_ a
specific edition, you would call `has`. This will most commonly be used from
within various addon's to determine which blueprint code to run. For example:
```js
const { has } = require('@ember/edition-utils');
if (has('octane')) {
// do octane stuff
} else {
// do classic mode stuff
}
```
## License
This project is licensed under the [MIT License](LICENSE.md).

@@ -5,2 +5,4 @@ const { setEdition, has, _getEdition } = require('./index');

const OriginalConsole = Object.assign({}, console);
QUnit.module('@ember/edition-utils', function(hooks) {

@@ -16,2 +18,4 @@ // only a test helper **because** we don't want folks to

delete process.env.EMBER_EDITION;
delete process.env.EMBER_VERSION;
Object.assign(console, OriginalConsole);
});

@@ -43,3 +47,16 @@

});
test('should infer edition from process.env.EMBER_VERSION with a warning', function(assert) {
assert.expect(2);
process.env.EMBER_VERSION = 'octane';
console.log = (...args) => {
assert.deepEqual(args, [
'Please update to using @ember/edition-utils. Using process.env.EMBER_VERSION to declare your application / addon as "octane" ready is deprecated.',
]);
}
assert.ok(has('octane'), 'finds process.env.EMBER_VERSION');
});
});
});
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