From 9b22eb21e12885e3da97fa5cf4b6820ff0082ad2 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Mon, 2 Sep 2024 13:57:27 -0400 Subject: [PATCH] Don't move index.html I found another difference between the source app and rewritten app. We've already normalized the *contents* of index.html between the two, but the *location* still differs. --- packages/compat/src/compat-app-builder.ts | 7 ++-- packages/compat/src/compat-app.ts | 44 ---------------------- tests/app-template/{app => }/index.html | 0 tests/ts-app-template/{app => }/index.html | 0 4 files changed, 3 insertions(+), 48 deletions(-) rename tests/app-template/{app => }/index.html (100%) rename tests/ts-app-template/{app => }/index.html (100%) diff --git a/packages/compat/src/compat-app-builder.ts b/packages/compat/src/compat-app-builder.ts index a6f50740c..725ac3307 100644 --- a/packages/compat/src/compat-app-builder.ts +++ b/packages/compat/src/compat-app-builder.ts @@ -127,13 +127,13 @@ export class CompatAppBuilder { return ['.wasm', '.mjs', '.js', '.json', '.ts', '.hbs', '.hbs.js', '.gjs', '.gts']; } - private addEmberEntrypoints(htmlTreePath: string): string[] { + private addEmberEntrypoints(): string[] { let classicEntrypoints = ['index.html', 'tests/index.html']; if (!this.compatApp.shouldBuildTests) { classicEntrypoints.pop(); } for (let entrypoint of classicEntrypoints) { - let sourcePath = join(htmlTreePath, entrypoint); + let sourcePath = join(this.compatApp.root, entrypoint); let rewrittenAppPath = join(this.root, entrypoint); writeFileSync(rewrittenAppPath, readFileSync(sourcePath)); } @@ -463,7 +463,7 @@ export class CompatAppBuilder { } let appFiles = this.updateAppJS(inputPaths.appJS); - let assetPaths = this.addEmberEntrypoints(inputPaths.htmlTree); + let assetPaths = this.addEmberEntrypoints(); if (this.activeFastboot) { // when using fastboot, our own package.json needs to be in the output so fastboot can read it. @@ -741,7 +741,6 @@ function addCachablePlugin(babelConfig: TransformOptions) { interface TreeNames { appJS: BroccoliNode; - htmlTree: BroccoliNode; publicTree: BroccoliNode | undefined; configTree: BroccoliNode; } diff --git a/packages/compat/src/compat-app.ts b/packages/compat/src/compat-app.ts index d231ceae5..32459e261 100644 --- a/packages/compat/src/compat-app.ts +++ b/packages/compat/src/compat-app.ts @@ -96,10 +96,6 @@ export default class CompatApp { return require(resolve.sync(specifier, { basedir: this.emberCLILocation })); } - private get configReplace() { - return this.requireFromEmberCLI('broccoli-config-replace'); - } - private get configLoader() { return this.requireFromEmberCLI('broccoli-config-loader'); } @@ -184,45 +180,6 @@ export default class CompatApp { }; } - private get htmlTree() { - if (this.legacyEmberAppInstance.tests) { - return mergeTrees([this.indexTree, this.testIndexTree]); - } else { - return this.indexTree; - } - } - - private get indexTree() { - let indexFilePath = this.legacyEmberAppInstance.options.outputPaths.app.html; - let index = buildFunnel(this.legacyEmberAppInstance.trees.app, { - allowEmpty: true, - include: [`index.html`], - getDestinationPath: () => indexFilePath, - annotation: 'app/index.html', - }); - return new this.configReplace(index, this.configTree, { - configPath: join('environments', `${this.legacyEmberAppInstance.env}.json`), - files: [indexFilePath], - patterns: this.filteredPatternsByContentFor.others, - annotation: 'ConfigReplace/indexTree', - }); - } - - private get testIndexTree() { - let index = buildFunnel(this.legacyEmberAppInstance.trees.tests, { - allowEmpty: true, - include: [`index.html`], - destDir: 'tests', - annotation: 'tests/index.html', - }); - return new this.configReplace(index, this.configTree, { - configPath: join('environments', `test.json`), - files: ['tests/index.html'], - patterns: this.filteredPatternsByContentFor.others, - annotation: 'ConfigReplace/testIndexTree', - }); - } - @Memoize() babelConfig(): TransformOptions { // this finds all the built-in babel configuration that comes with ember-cli-babel @@ -727,7 +684,6 @@ export default class CompatApp { return { appJS: this.processAppJS().appJS, - htmlTree: this.htmlTree, publicTree, configTree, contentForTree, diff --git a/tests/app-template/app/index.html b/tests/app-template/index.html similarity index 100% rename from tests/app-template/app/index.html rename to tests/app-template/index.html diff --git a/tests/ts-app-template/app/index.html b/tests/ts-app-template/index.html similarity index 100% rename from tests/ts-app-template/app/index.html rename to tests/ts-app-template/index.html