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 release] Require Octane features when using Octane preview. #18418

Merged
merged 1 commit into from
Sep 20, 2019
Merged
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
49 changes: 49 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,55 @@ module.exports = {
paths,
absolutePaths,

included() {
this._super.included.apply(this, arguments);

const { has } = require('@ember/edition-utils');

if (has('octane')) {
let optionalFeatures = this.project.addons.find(a => a.name === '@ember/optional-features');
let optionalFeaturesMissing = optionalFeatures !== undefined;
let missingFeatures = [];

if (optionalFeaturesMissing) {
missingFeatures.push(
`* the @ember/optional-features addon is missing, run \`ember install @ember/optional-features\` to install it`
);
}

if (optionalFeaturesMissing || optionalFeatures.isFeatureEnabled('jquery-integration')) {
missingFeatures.push(
`* The jquery-integration optional feature should be disabled under Octane, run \`ember feature:disable jquery-integration\` to disable it`
);
}

if (
optionalFeaturesMissing ||
optionalFeatures.isFeatureEnabled('application-template-wrapper')
) {
missingFeatures.push(
`* The application-template-wrapper optional feature should be disabled under Octane, run \`ember feature:disable application-template-wrapper\` to disable it`
);
}

if (
optionalFeaturesMissing ||
!optionalFeatures.isFeatureEnabled('template-only-glimmer-component')
) {
missingFeatures.push(
`* The template-only-glimmer-component optional feature should be enabled under Octane, run \`ember feature:enabled template-only-glimmer-component\` to enable it`
);
}

if (missingFeatures.length > 0) {
let intro = `You have configured your application to indicate that it is using the 'octane' edition (via \`setEdition('octane')\`), but the appropriate Octane features were not enabled:`;

const SilentError = require('silent-error');
throw new SilentError(`${intro}\n\n${missingFeatures.join('\n\t')}`);
}
}
},

transpileTree(tree, isProduction) {
let emberCliBabel = this.addons.find(a => a.name === 'ember-cli-babel');

Expand Down