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

[BUGFIX beta] fail builds in ember-cli when ember-cli-shims isn't met #4057

Merged
merged 1 commit into from
Jan 12, 2016
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
39 changes: 30 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
'use strict';

var path = require('path');
var SilentError = require('silent-error');

module.exports = {
name: 'ember-data',
Expand All @@ -21,21 +22,41 @@ module.exports = {

init: function() {
var bowerDeps = this.project.bowerDependencies();
var VersionChecker = require('ember-cli-version-checker');

var checker = new VersionChecker(this);
var shims = checker.for('ember-cli-shims', 'bower');

var semver = require('semver');
var version = require('./package').version;

if (process.env.EMBER_DATA_SKIP_VERSION_CHECKING_DO_NOT_USE_THIS_ENV_VARIABLE) {
// Skip for node tests as we can't currently override the version of ember-cli-shims
// before the test helpers run.
return;
}

if (bowerDeps['ember-data']) {
this._warn('Please remove `ember-data` from `bower.json`. As of Ember Data 2.3.0, only the NPM package is needed.');
this._warn('Please remove `ember-data` from `bower.json`. As of Ember Data 2.3.0, only the NPM package is needed. If you need an ' +
'earlier version of ember-data (< 2.3.0), you can leave this unchanged for now, but we strongly suggest you upgrade your version of Ember Data ' +
'as soon as possible.');
this._forceBowerUsage = true;
} else {
this._forceBowerUsage = false;
}

var VersionChecker = require('ember-cli-version-checker');
var emberDataBower = checker.for('ember-data', 'bower');

var checker = new VersionChecker(this);
var dep = checker.for('ember-cli-shims', 'bower');
if (!shims.satisfies('< 0.1.0') && emberDataBower.satisfies('< 2.3.0-beta.3')) {
throw new SilentError('Using a version of ember-cli-shims greater than or equal to 0.1.0 will cause errors while loading Ember Data < 2.3.0-beta.3 Please update ember-cli-shims from ' + shims.version + ' to 0.0.6');
}

if (!shims.satisfies('>= 0.1.0') && emberDataBower.satisfies('>= 2.3.0-beta.3')) {
throw new SilentError('Using a version of ember-cli-shims prior to 0.1.0 will cause errors while loading Ember Data 2.3.0-beta.3+. Please update ember-cli-shims from ' + shims.version + ' to 0.1.0.');
}

if (!dep.satisfies('>= 0.1.0')) {
this._warn('Using a version of ember-cli-shims prior to 0.1.0 will cause errors while loading Ember Data 2.3+. Please update ember-cli-shims from ' + dep.version + ' to 0.1.0.');
} else {
// NPM only, but ember-cli-shims does not match
if (!shims.satisfies('>= 0.1.0') && semver.satisfies(version, '^2.3.0-beta.3')) {
throw new SilentError('Using a version of ember-cli-shims prior to 0.1.0 will cause errors while loading Ember Data 2.3.0-beta.3+. Please update ember-cli-shims from ' + shims.version + ' to 0.1.0.');
}
}
},

Expand Down
2 changes: 2 additions & 0 deletions node-tests/nodetest-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ var Promise = require('ember-cli/lib/ext/promise');
var rimraf = require('rimraf');
var mochaOnlyDetector = require('mocha-only-detector');

process.env.EMBER_DATA_SKIP_VERSION_CHECKING_DO_NOT_USE_THIS_ENV_VARIABLE = true;

if (process.env.EOLNEWLINE) {
require('os').EOL = '\n';
}
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"ember-cli-version-checker": "^1.1.4",
"ember-inflector": "^1.9.4",
"inflection": "^1.8.0",
"semver": "^5.1.0",
"silent-error": "^1.0.0"
},
"devDependencies": {
Expand Down