Skip to content

Commit

Permalink
[BUGFIX release] Require Octane features when using Octane preview.
Browse files Browse the repository at this point in the history
This ensures that users of the Octane preview have the required minimum
features enabled.

(cherry picked from commit 5742c53)
  • Loading branch information
rwjblue committed Sep 20, 2019
1 parent 186d8f2 commit ea77915
Showing 1 changed file with 49 additions and 0 deletions.
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

0 comments on commit ea77915

Please sign in to comment.