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

Commit c3c096b

Browse files
authored
add embroider scenarios to ember-try (#148)
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.
1 parent 44c471a commit c3c096b

3 files changed

Lines changed: 42 additions & 2 deletions

File tree

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ jobs:
5353
- env: EMBER_TRY_SCENARIO=ember-canary
5454
- env: EMBER_TRY_SCENARIO=ember-default-with-jquery
5555
- env: EMBER_TRY_SCENARIO=ember-classic
56+
- env: EMBER_TRY_SCENARIO=embroider
57+
- env: EMBER_TRY_SCENARIO=embroider-optimized
5658

5759
before_install:
5860
- curl -o- -L https://yarnpkg.com/install.sh | bash

config/ember-try.js

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,27 @@ module.exports = async function() {
8383
edition: 'classic'
8484
}
8585
}
86-
}
86+
},
87+
{
88+
name: 'embroider',
89+
npm: {
90+
devDependencies: {
91+
'@embroider/core': '*',
92+
'@embroider/webpack': '*',
93+
'@embroider/compat': '*',
94+
},
95+
},
96+
},
97+
{
98+
name: 'embroider-optimized',
99+
npm: {
100+
devDependencies: {
101+
'@embroider/core': '*',
102+
'@embroider/webpack': '*',
103+
'@embroider/compat': '*',
104+
},
105+
}
106+
},
87107
]
88108
};
89109
};

ember-cli-build.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,23 @@ module.exports = function(defaults) {
2222
behave. You most likely want to be modifying `./index.js` or app's build file
2323
*/
2424

25-
return app.toTree();
25+
// Use embroider if it's present (it can get added by ember-try)
26+
if ('@embroider/core' in app.dependencies()) {
27+
/* eslint-disable node/no-missing-require, node/no-extraneous-require */
28+
const { Webpack } = require('@embroider/webpack');
29+
const { compatBuild } = require('@embroider/compat');
30+
/* eslint-enable node/no-missing-require, node/no-extraneous-require */
31+
let config = {};
32+
if (process.env.EMBER_TRY_SCENARIO === 'embroider-optimized') {
33+
config = {
34+
staticAddonTrees: true,
35+
staticAddonTestSupportTrees: true,
36+
staticHelpers: true,
37+
staticComponents: true,
38+
}
39+
}
40+
return compatBuild(app, Webpack, config);
41+
} else {
42+
return app.toTree();
43+
}
2644
};

0 commit comments

Comments
 (0)