From b9442f06d27d46ae981f9b11bb628dac35d3d962 Mon Sep 17 00:00:00 2001 From: Godfrey Chan Date: Fri, 20 Sep 2019 22:58:07 -0700 Subject: [PATCH] [BUGFIX release] Fix Octane feature detection * `optionalFeaturesMissing` was flipped * `template-only-glimmer-component` -> `template-only-glimmer-components` * indentation was slightly off --- lib/index.js | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/lib/index.js b/lib/index.js index 8ff0703c4c3..8c367727b64 100644 --- a/lib/index.js +++ b/lib/index.js @@ -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` ); } @@ -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')); } } },