Skip to content

Commit bb8a57f

Browse files
mixonicRobert Jackson
authored andcommitted
Only check semver range if ember-source is present
Prior to this patch the value `false` would be passed to `semver.gte(` causing an exception of `Invalid Version: false`. This ensures the range validity of the version is only checked if one is present. Specifically bower versions of Ember have an `emberVersion` of `false` here. However none of those versions of Ember support co-location. Fixes #422
1 parent 0176e64 commit bb8a57f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/ember-addon-main.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ module.exports = {
3030
let babelVersion = hasBabel && babel.pkg.version;
3131

3232
let ember = this.project.addons.find(a => a.name === 'ember-source');
33-
let emberVersion = ember !== undefined && ember.pkg.version;
33+
let hasEmberSource = ember !== undefined;
34+
let emberVersion = hasEmberSource && ember.pkg.version;
3435

3536
// using this.project.emberCLIVersion() allows us to avoid issues when `npm
3637
// link` is used; if this addon were linked and we did something like
@@ -43,7 +44,7 @@ module.exports = {
4344

4445
// once a polyfill is written, we will need to update this logic to check
4546
// for _either_ `[email protected]` or the polyfill
46-
let hasValidEmberVersion = semver.gte(emberVersion, '3.13.0');
47+
let hasValidEmberVersion = hasEmberSource && semver.gte(emberVersion, '3.13.0');
4748

4849
this._cachedShouldColocateTemplates =
4950
hasValidEmberVersion && hasValidBabelVersion && hasValidEmberCLIVersion;

0 commit comments

Comments
 (0)