Skip to content

Commit

Permalink
[BUGFIX beta] Update edition detection to use @ember/edition-u… (#18389)
Browse files Browse the repository at this point in the history
[BUGFIX beta] Update edition detection to use @ember/edition-utils
  • Loading branch information
rwjblue authored Sep 15, 2019
2 parents 865ffd0 + 39f5e99 commit 9ae862a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
5 changes: 3 additions & 2 deletions blueprints/component/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ const getPathOption = require('ember-cli-get-component-path-option');
const normalizeEntityName = require('ember-cli-normalize-entity-name');
const { isModuleUnificationProject } = require('../module-unification');
const { EOL } = require('os');
const { has } = require('@ember/edition-utils');

const OCTANE = process.env.EMBER_VERSION === 'octane';
const OCTANE = has('octane');

// TODO: this should be reading from the @ember/canary-features module
// need to refactor broccoli/features.js to be able to work more similarly
Expand Down Expand Up @@ -49,7 +50,7 @@ module.exports = {

init() {
this._super && this._super.init.apply(this, arguments);
let isOctane = process.env.EMBER_VERSION === 'OCTANE';
let isOctane = has('octane');

this.availableOptions.forEach(option => {
if (option.name === 'component-class') {
Expand Down
3 changes: 2 additions & 1 deletion blueprints/edition-detector.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
'use strict';

const { has } = require('@ember/edition-utils');
const path = require('path');

module.exports = function(blueprint) {
blueprint.filesPath = function() {
let rootPath = process.env.EMBER_VERSION === 'OCTANE' ? 'native-files' : 'files';
let rootPath = has('octane') ? 'native-files' : 'files';
return path.join(this.path, rootPath);
};

Expand Down
6 changes: 4 additions & 2 deletions node-tests/helpers/setup-test-environment.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
const { setEdition, clearEdition } = require('@ember/edition-utils');

function enableOctane() {
beforeEach(function() {
process.env.EMBER_VERSION = 'OCTANE';
setEdition('octane');
});

afterEach(function() {
delete process.env.EMBER_VERSION;
clearEdition();
});
}

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"@babel/helper-module-imports": "^7.0.0",
"@babel/plugin-transform-block-scoping": "^7.6.0",
"@babel/plugin-transform-object-assign": "^7.2.0",
"@ember/edition-utils": "^1.1.1",
"babel-plugin-debug-macros": "^0.3.3",
"babel-plugin-filter-imports": "^3.0.0",
"broccoli-concat": "^3.7.4",
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,11 @@
exec-sh "^0.3.2"
minimist "^1.2.0"

"@ember/edition-utils@^1.1.1":
version "1.1.1"
resolved "https://registry.yarnpkg.com/@ember/edition-utils/-/edition-utils-1.1.1.tgz#d5732c3da593f202e6e1ac6dbee56a758242403f"
integrity sha512-GEhri78jdQp/xxPpM6z08KlB0wrHfnfrJ9dmQk7JeQ4XCiMzXsJci7yooQgg/IcTKCM/PxE/IkGCQAo80adMkw==

"@glimmer/compiler@0.38.5-alpha.2":
version "0.38.5-alpha.2"
resolved "https://registry.yarnpkg.com/@glimmer/compiler/-/compiler-0.38.5-alpha.2.tgz#a133074450c0b75446ece387edfd0f0631e49b94"
Expand Down

0 comments on commit 9ae862a

Please sign in to comment.