Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly detect host ember-cli version. #190

Merged
merged 2 commits into from
Nov 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
const VersionChecker = require('ember-cli-version-checker');
const clone = require('clone');
const path = require('path');
const semver = require('semver');

let count = 0;

Expand Down Expand Up @@ -339,7 +340,7 @@ module.exports = {

return babelOptions.compileModules;
} else {
return this.emberCLIChecker.gt('2.12.0-alpha.1');
return semver.gt(this.project.emberCLIVersion, '2.12.0-alpha.1');
}
},

Expand All @@ -351,10 +352,10 @@ module.exports = {
},

_getEmberModulesAPIBlacklist() {
const blacklist = {
const blacklist = {
'@ember/debug': ['assert', 'deprecate', 'warn'],
};

if (this._emberStringDependencyPresent()) {
blacklist['@ember/string'] = [
'fmt', 'loc', 'w',
Expand Down
8 changes: 4 additions & 4 deletions node-tests/addon-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('ember-cli-babel', function() {

beforeEach(function() {
this.ui = new MockUI();
let project = { root: __dirname };
let project = { root: __dirname, emberCLIVersion: '2.16.2' };
this.addon = new Addon({
project,
parent: project,
Expand Down Expand Up @@ -280,7 +280,7 @@ describe('ember-cli-babel', function() {

describe('@ember/string detection', function() {
beforeEach(function() {
let project = { root: input.path() };
let project = { root: input.path(), emberCLIVersion: '2.16.2' };
this.addon = new Addon({
project,
parent: project,
Expand Down Expand Up @@ -504,13 +504,13 @@ describe('ember-cli-babel', function() {

describe('without any compileModules option set', function() {
it('returns false for ember-cli < 2.12', function() {
this.addon.emberCLIChecker = { gt() { return false; } };
this.addon.project.emberCLIVersion = '2.11.1';

expect(this.addon.shouldCompileModules()).to.eql(false);
});

it('returns true for ember-cli > 2.12.0-alpha.1', function() {
this.addon.emberCLIChecker = { gt() { return true; } };
this.addon.project.emberCLIVersion = '2.13.0';

expect(this.addon.shouldCompileModules()).to.be.true;
});
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
"broccoli-funnel": "^1.0.0",
"broccoli-source": "^1.1.0",
"clone": "^2.0.0",
"ember-cli-version-checker": "^2.1.0"
"ember-cli-version-checker": "^2.1.0",
"semver": "^5.4.1"
},
"devDependencies": {
"broccoli-test-helper": "^1.1.0",
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4888,7 +4888,7 @@ sane@^1.1.1, sane@^1.4.1, sane@^1.6.0:
walker "~1.0.5"
watch "~0.10.0"

"semver@2 || 3 || 4 || 5":
"semver@2 || 3 || 4 || 5", semver@^5.4.1:
version "5.4.1"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e"

Expand Down