Skip to content

Commit

Permalink
Don't move index.html
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ef4 committed Sep 2, 2024
1 parent eb93cd5 commit 9b22eb2
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 48 deletions.
7 changes: 3 additions & 4 deletions packages/compat/src/compat-app-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -741,7 +741,6 @@ function addCachablePlugin(babelConfig: TransformOptions) {

interface TreeNames {
appJS: BroccoliNode;
htmlTree: BroccoliNode;
publicTree: BroccoliNode | undefined;
configTree: BroccoliNode;
}
44 changes: 0 additions & 44 deletions packages/compat/src/compat-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -727,7 +684,6 @@ export default class CompatApp {

return {
appJS: this.processAppJS().appJS,
htmlTree: this.htmlTree,
publicTree,
configTree,
contentForTree,
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 9b22eb2

Please sign in to comment.