DEV: refactor ember-cli-build (#22694)

pass the extra public trees to `app.toTree()` to match:

0e00f2bf15/packages/test-setup/src/index.ts (L24-L27)

The ember-cli-terser addon now takes care of minifying all additional trees, so we can remove our custom terser-related logic
This commit is contained in:
Godfrey Chan 2023-07-19 09:48:20 -07:00 committed by GitHub
parent 132bd375f6
commit e1d27400f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -188,38 +188,28 @@ module.exports = function (defaults) {
.findAddonByName("pretty-text")
.treeForMarkdownItBundle();
const terserPlugin = app.project.findAddonByName("ember-cli-terser");
const applyTerser = (tree) => terserPlugin.postprocessTree("all", tree);
return mergeTrees([
return app.toTree([
createI18nTree(discourseRoot, vendorJs),
parsePluginClientSettings(discourseRoot, vendorJs, app),
app.toTree(),
funnel(`${discourseRoot}/public/javascripts`, { destDir: "javascripts" }),
funnel(`${vendorJs}/highlightjs`, {
files: ["highlight-test-bundle.min.js"],
destDir: "assets/highlightjs",
}),
generateWorkboxTree(),
applyTerser(
concat(adminTree, {
inputFiles: ["**/*.js"],
outputFile: `assets/admin.js`,
})
),
applyTerser(
concat(wizardTree, {
inputFiles: ["**/*.js"],
outputFile: `assets/wizard.js`,
})
),
applyTerser(
concat(markdownItBundleTree, {
inputFiles: ["**/*.js"],
outputFile: `assets/markdown-it-bundle.js`,
})
),
concat(adminTree, {
inputFiles: ["**/*.js"],
outputFile: `assets/admin.js`,
}),
concat(wizardTree, {
inputFiles: ["**/*.js"],
outputFile: `assets/wizard.js`,
}),
concat(markdownItBundleTree, {
inputFiles: ["**/*.js"],
outputFile: `assets/markdown-it-bundle.js`,
}),
generateScriptsTree(app),
applyTerser(discoursePluginsTree),
discoursePluginsTree,
]);
};