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

Deprecate ember-cli-babel 5.x #7676

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
41 changes: 28 additions & 13 deletions lib/broccoli/ember-app.js
Expand Up @@ -86,19 +86,7 @@ let DEFAULT_CONFIG = {
addons: {},
};

function needsEmberCLIShims(addons) {
let babelInstance = addons.find(addon => addon.name === 'ember-cli-babel');
if (!babelInstance) {
return false;
}

let version = babelInstance.pkg.version;
if (semver.lt(version, '6.6.0')) {
return true;
}

return addons.some(addon => needsEmberCLIShims(addon.addons));
}

class EmberApp {
/**
Expand Down Expand Up @@ -458,7 +446,8 @@ class EmberApp {
// certain versions of `ember-source` bundle them by default,
// so we must check if that is the load mechanism of ember
// before checking `bower`.
if (!emberShims && !addonEmberCliShims && !bowerEmberCliShims && needsEmberCLIShims(this.project.addons)) {
let emberCliShimsRequired = this._checkEmberCliBabel(this.project.addons);
if (!emberShims && !addonEmberCliShims && !bowerEmberCliShims && emberCliShimsRequired) {
this.project.ui.writeWarnLine('You have not included `ember-cli-shims` in your project\'s `bower.json` or `package.json`. This only works if you provide an alternative yourself and unset `app.vendorFiles[\'app-shims.js\']`.');
}

Expand Down Expand Up @@ -531,6 +520,32 @@ class EmberApp {
return !!whitelist && whitelist.indexOf(addon.name) === -1;
}

/**
@private
@method _checkEmberCliBabel
@param {Addons} addons
@return {Boolean}
*/
_checkEmberCliBabel(addons, result, roots) {
addons = addons || [];
result = result || false;
roots = roots || {};

let babelInstance = addons.find(addon => addon.name === 'ember-cli-babel');
if (babelInstance) {
let version = babelInstance.pkg.version;
if (semver.lt(version, '6.6.0')) {
result = true;
}
if (semver.lt(version, '6.0.0') && !roots[babelInstance.root]) {
roots[babelInstance.root] = true;
this.project.ui.writeWarnLine(`DEPRECATION: ember-cli-babel 5.x has been deprecated. Please upgrade to at least ember-cli-babel 6.6. Version ${version} located: ${babelInstance.root}`);
}
}

return addons.some(addon => this._checkEmberCliBabel(addon.addons, result, roots));
}

/**
Returns whether an addon should be added to the project

Expand Down