Skip to content

Commit

Permalink
Merge pull request #8019 from jrjohnson/enable-embroider-once-again
Browse files Browse the repository at this point in the history
Enable Embroider
  • Loading branch information
dartajax authored Jul 31, 2024
2 parents e752746 + 83e820d commit e5b9c76
Show file tree
Hide file tree
Showing 11 changed files with 78 additions and 160 deletions.
60 changes: 0 additions & 60 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,66 +96,6 @@ jobs:
- name: Build
run: pnpm --filter ${{matrix.workspace}} run build

test-with-embroider:
name: Test With Embroider
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
workspace:
- frontend
- lti-course-manager
- lti-dashboard
env:
BUILD_WITH_EMBROIDER: true
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- name: Install Dependencies
run: pnpm install
- name: Run Tests
run: pnpm --filter ${{matrix.workspace}} exec ember exam --parallel=3 --load-balance --write-execution-file
- uses: actions/upload-artifact@v4
if: failure()
with:
name: replay-${{matrix.workspace}}-embroider.json
path: ./packages/${{matrix.workspace}}/test-execution-*.json
retention-days: 7

build-with-embroider:
name: Build With Embroider
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
workspace:
- frontend
- lti-course-manager
- lti-dashboard
env:
BUILD_WITH_EMBROIDER: true
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- name: Install Dependencies
run: pnpm install
- name: Build
run: pnpm --filter ${{matrix.workspace}} run build

test-deploy-build:
name: Test Deploy Build
runs-on: ubuntu-latest
Expand Down
106 changes: 49 additions & 57 deletions packages/frontend/ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ module.exports = async function (defaults) {
enabled: false,
},
};
if (!process.env.BUILD_WITH_EMBROIDER) {
config.babel.plugins.push(require('ember-auto-import/babel-plugin'));
}

const app = new EmberApp(defaults, config);

Expand All @@ -72,61 +69,56 @@ module.exports = async function (defaults) {
___legacy_support: true,
});

if (process.env.BUILD_WITH_EMBROIDER) {
return require('@embroider/compat').compatBuild(app, Webpack, {
staticAddonTestSupportTrees: true,
staticAddonTrees: true,
staticHelpers: true,
staticComponents: true,
splitAtRoutes: [
//temporarily disabled route splitting for https://github.com/ilios/ilios/issues/4508
/admin[a-z-]*/,
'assign-students',
/course[a-z-]*/,
/curriculum[a-z-]*/,
'dashboard.activities',
'dashboard.calendar',
'dashboard.materials',
// 'error', don't ever split the error route, it will break error handling
'events',
'four-oh-four',
/instructor[a-z-]*/,
/learner[a-z-]*/,
'login',
'logout',
'myprofile',
'pending-user-updates',
'print-course',
/program[a-z-]*/,
/report[a-z-]*/,
/school[a-z-]*/,
'search',
/session[a-z-]*/,
/user[a-z-]*/,
'verification-preview',
'weeklyevents',
],
packagerOptions: {
webpackConfig: {
plugins: [new RetryChunkLoadPlugin() /*, new BundleAnalyzerPlugin()*/],
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
terserOptions: {
compress: {
passes: 6, // slow, but worth it
inline: 5,
reduce_funcs: false,
},
return require('@embroider/compat').compatBuild(app, Webpack, {
staticAddonTestSupportTrees: true,
staticAddonTrees: true,
staticHelpers: true,
staticComponents: true,
splitAtRoutes: [
/admin[a-z-]*/,
'assign-students',
/course[a-z-]*/,
/curriculum[a-z-]*/,
'dashboard.activities',
'dashboard.calendar',
'dashboard.materials',
// 'error', don't ever split the error route, it will break error handling
'events',
'four-oh-four',
/instructor[a-z-]*/,
/learner[a-z-]*/,
'login',
'logout',
'myprofile',
'pending-user-updates',
'print-course',
/program[a-z-]*/,
/report[a-z-]*/,
/school[a-z-]*/,
'search',
/session[a-z-]*/,
/user[a-z-]*/,
'verification-preview',
'weeklyevents',
],
packagerOptions: {
webpackConfig: {
plugins: [new RetryChunkLoadPlugin() /*, new BundleAnalyzerPlugin()*/],
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
terserOptions: {
compress: {
passes: 6, // slow, but worth it
inline: 5,
reduce_funcs: false,
},
}),
],
},
},
}),
],
},
},
});
} else {
return app.toTree();
}
},
});
};
2 changes: 1 addition & 1 deletion packages/lti-course-manager/app/router.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import EmberRouter from '@ember/routing/router';
import EmberRouter from '@embroider/router';
import config from 'lti-course-manager/config/environment';

export default class Router extends EmberRouter {
Expand Down
21 changes: 6 additions & 15 deletions packages/lti-course-manager/ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,17 @@ module.exports = async function (defaults) {
},
hinting: isTestBuild,
};
if (!process.env.BUILD_WITH_EMBROIDER) {
config.babel = {
plugins: [require('ember-auto-import/babel-plugin')],
};
}
const app = new EmberApp(defaults, config);

const { setConfig } = await import('@warp-drive/build-config');
setConfig(app, __dirname, {
___legacy_support: true,
});

if (process.env.BUILD_WITH_EMBROIDER) {
return require('@embroider/compat').compatBuild(app, Webpack, {
staticAddonTestSupportTrees: true,
staticAddonTrees: true,
staticHelpers: true,
staticComponents: true,
});
} else {
return app.toTree();
}
return require('@embroider/compat').compatBuild(app, Webpack, {
staticAddonTestSupportTrees: true,
staticAddonTrees: true,
staticHelpers: true,
staticComponents: true,
});
};
2 changes: 1 addition & 1 deletion packages/lti-dashboard/app/router.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import EmberRouter from '@ember/routing/router';
import EmberRouter from '@embroider/router';
import config from 'lti-dashboard/config/environment';

export default class Router extends EmberRouter {
Expand Down
21 changes: 6 additions & 15 deletions packages/lti-dashboard/ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,17 @@ module.exports = async function (defaults) {
},
hinting: isTestBuild,
};
if (!process.env.BUILD_WITH_EMBROIDER) {
config.babel = {
plugins: [require('ember-auto-import/babel-plugin')],
};
}
const app = new EmberApp(defaults, config);

const { setConfig } = await import('@warp-drive/build-config');
setConfig(app, __dirname, {
___legacy_support: true,
});

if (process.env.BUILD_WITH_EMBROIDER) {
return require('@embroider/compat').compatBuild(app, Webpack, {
staticAddonTestSupportTrees: true,
staticAddonTrees: true,
staticHelpers: true,
staticComponents: true,
});
} else {
return app.toTree();
}
return require('@embroider/compat').compatBuild(app, Webpack, {
staticAddonTestSupportTrees: true,
staticAddonTrees: true,
staticHelpers: true,
staticComponents: true,
});
};
1 change: 1 addition & 0 deletions packages/lti-dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"@ember/test-helpers": "^3.3.0",
"@embroider/compat": "~3.6.0",
"@embroider/macros": "^1.16.3",
"@embroider/router": "^2.1.8",
"@embroider/webpack": "~4.0.3",
"@glimmer/component": "^1.1.2",
"@glimmer/tracking": "^1.1.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/test-app/app/router.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import EmberRouter from '@ember/routing/router';
import EmberRouter from '@embroider/router';
import config from 'test-app/config/environment';
import { courseRoutes, dashboardRoutes } from 'ilios-common/common-routes';

Expand Down
16 changes: 6 additions & 10 deletions packages/test-app/ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,10 @@ module.exports = async function (defaults) {
setConfig(app, __dirname, {
___legacy_support: true,
});
if (process.env.BUILD_WITH_EMBROIDER) {
return require('@embroider/compat').compatBuild(app, Webpack, {
staticAddonTestSupportTrees: true,
staticAddonTrees: true,
staticHelpers: true,
staticComponents: true,
});
} else {
return app.toTree();
}
return require('@embroider/compat').compatBuild(app, Webpack, {
staticAddonTestSupportTrees: true,
staticAddonTrees: true,
staticHelpers: true,
staticComponents: true,
});
};
1 change: 1 addition & 0 deletions packages/test-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"@ember/test-helpers": "^3.3.0",
"@embroider/compat": "^3.6.0",
"@embroider/macros": "^1.16.3",
"@embroider/router": "^2.1.8",
"@embroider/test-setup": "^4.0.0",
"@embroider/webpack": "~4.0.3",
"@glimmer/component": "^1.1.2",
Expand Down
6 changes: 6 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e5b9c76

Please sign in to comment.