From e1d27400f5d8be345383b52bd118e652724a517e Mon Sep 17 00:00:00 2001 From: Godfrey Chan Date: Wed, 19 Jul 2023 09:48:20 -0700 Subject: [PATCH] DEV: refactor ember-cli-build (#22694) pass the extra public trees to `app.toTree()` to match: https://github.com/embroider-build/embroider/blob/0e00f2bf154bb44448fc7ece0ca3c79a0a08274c/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 --- .../javascripts/discourse/ember-cli-build.js | 38 +++++++------------ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/app/assets/javascripts/discourse/ember-cli-build.js b/app/assets/javascripts/discourse/ember-cli-build.js index 351411d8e29..ccff495cbd5 100644 --- a/app/assets/javascripts/discourse/ember-cli-build.js +++ b/app/assets/javascripts/discourse/ember-cli-build.js @@ -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, ]); };