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] Fix Octane feature detection #18419

Merged
merged 1 commit into from
Sep 21, 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
24 changes: 13 additions & 11 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,17 @@ module.exports = {

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

if (optionalFeaturesMissing) {
missingFeatures.push(
message.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(
message.push(
`* The jquery-integration optional feature should be disabled under Octane, run \`ember feature:disable jquery-integration\` to disable it`
);
}
Expand All @@ -89,25 +89,27 @@ module.exports = {
optionalFeaturesMissing ||
optionalFeatures.isFeatureEnabled('application-template-wrapper')
) {
missingFeatures.push(
message.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')
!optionalFeatures.isFeatureEnabled('template-only-glimmer-components')
) {
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`
message.push(
`* The template-only-glimmer-components optional feature should be enabled under Octane, run \`ember feature:enabled template-only-glimmer-components\` 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:`;
if (message.length > 0) {
message.unshift(
`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:\n`
);

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