Skip to content
This repository has been archived by the owner on Oct 9, 2024. It is now read-only.

Commit

Permalink
add embroider scenarios to ember-try (#148)
Browse files Browse the repository at this point in the history
This adds two scenarios. The first will build the dummy app and test suite using embroider in its most-compatible configuration. The second will build the dummy app and test suite using embroider in its most-optimized configuration.

It's helpful for addons to try both, because apps are likely to start with one and migrate toward the other.
  • Loading branch information
ef4 authored Sep 27, 2020
1 parent 44c471a commit c3c096b
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ jobs:
- env: EMBER_TRY_SCENARIO=ember-canary
- env: EMBER_TRY_SCENARIO=ember-default-with-jquery
- env: EMBER_TRY_SCENARIO=ember-classic
- env: EMBER_TRY_SCENARIO=embroider
- env: EMBER_TRY_SCENARIO=embroider-optimized

before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
Expand Down
22 changes: 21 additions & 1 deletion config/ember-try.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,27 @@ module.exports = async function() {
edition: 'classic'
}
}
}
},
{
name: 'embroider',
npm: {
devDependencies: {
'@embroider/core': '*',
'@embroider/webpack': '*',
'@embroider/compat': '*',
},
},
},
{
name: 'embroider-optimized',
npm: {
devDependencies: {
'@embroider/core': '*',
'@embroider/webpack': '*',
'@embroider/compat': '*',
},
}
},
]
};
};
20 changes: 19 additions & 1 deletion ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,23 @@ module.exports = function(defaults) {
behave. You most likely want to be modifying `./index.js` or app's build file
*/

return app.toTree();
// Use embroider if it's present (it can get added by ember-try)
if ('@embroider/core' in app.dependencies()) {
/* eslint-disable node/no-missing-require, node/no-extraneous-require */
const { Webpack } = require('@embroider/webpack');
const { compatBuild } = require('@embroider/compat');
/* eslint-enable node/no-missing-require, node/no-extraneous-require */
let config = {};
if (process.env.EMBER_TRY_SCENARIO === 'embroider-optimized') {
config = {
staticAddonTrees: true,
staticAddonTestSupportTrees: true,
staticHelpers: true,
staticComponents: true,
}
}
return compatBuild(app, Webpack, config);
} else {
return app.toTree();
}
};

0 comments on commit c3c096b

Please sign in to comment.