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

[chore]: require ember-auto-import 2.0.0 #19760

Closed
wants to merge 1 commit into from
Closed
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
14 changes: 12 additions & 2 deletions lib/index.js
Expand Up @@ -11,6 +11,7 @@ const injectBabelHelpers = require('./transforms/inject-babel-helpers').injectBa
const debugTree = require('broccoli-debug').buildDebugCallback('ember-source:addon');
const vmBabelPlugins = require('@glimmer/vm-babel-plugins');
const Overrides = require('./overrides');
const semver = require('semver');

const PRE_BUILT_TARGETS = [
'last 1 Chrome versions',
Expand Down Expand Up @@ -46,12 +47,21 @@ module.exports = {
this._super.init && this._super.init.apply(this, arguments);

if ('ember' in this.project.bowerDependencies()) {
// TODO: move this to a throw soon.
this.ui.writeWarnLine(
throw new Error(
'Ember.js is now provided by node_module `ember-source`, please remove it from bower'
);
}

let emberAutoImport = this.project.addons.find((a) => a.name === 'ember-auto-import');
if (
this.project.addons.length &&
(!emberAutoImport || semver.lt(emberAutoImport.pkg.version, '2.0.0'))
) {
throw new Error(
'ember-auto-import must be present and installed as version 2.0.0 or greater. See the v2.0 upgrade guide here - https://github.com/ef4/ember-auto-import/blob/main/docs/upgrade-guide-2.0.md'
);
}

// resets `this.root` to the correct location by default ember-cli
// considers `__dirname` here to be the root, but since our main entry
// point is within a subfolder we need to correct that
Expand Down