Skip to content

Commit

Permalink
Merge pull request #1985 from embroider-build/move-rewritten-app
Browse files Browse the repository at this point in the history
Move rewritten app to ./tmp
  • Loading branch information
mansona authored Jun 13, 2024
2 parents 718cc64 + e89f94b commit 1486226
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion packages/compat/src/compat-addons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default class CompatAddons implements Stage {

async ready(): Promise<{ outputPath: string }> {
return {
outputPath: resolve(locateEmbroiderWorkingDir(this.compatApp.root), 'rewritten-app'),
outputPath: resolve(locateEmbroiderWorkingDir(this.compatApp.root), '..', '..', 'tmp', 'rewritten-app'),
};
}

Expand Down
4 changes: 2 additions & 2 deletions packages/compat/src/standalone-addon-build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ function buildAddonIndex(compatApp: CompatApp, appPackage: Package, packages: Se
// yet. This directory lives outside our rewritten-pacakges directory because
// it's produced by a separate build stage, and it's easier to have them
// writing into separate directories.
content.packages[compatApp.root] = join('..', 'rewritten-app');
content.packages[compatApp.root] = join('..', '..', '..', 'tmp', 'rewritten-app');

let nonResolvableDeps = appPackage.nonResolvableDeps;
if (nonResolvableDeps) {
let extraRoots = [...nonResolvableDeps.values()].map(v => v.root);

// the app gets extraResolutions support just like every addon does
content.extraResolutions[join('..', 'rewritten-app')] = extraRoots;
content.extraResolutions[join('..', '..', '..', 'tmp', 'rewritten-app')] = extraRoots;

// but it also gets extraResolutions registered against its *original*
// location, because the app is unique because stage2 needs a Package
Expand Down
4 changes: 2 additions & 2 deletions tests/addon-template/vite.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
import { resolve } from "path";
import { babel } from "@rollup/plugin-babel";

const root = "node_modules/.embroider/rewritten-app";
const root = "tmp/rewritten-app";

export default defineConfig(({ mode }) => {
return {
Expand Down Expand Up @@ -43,7 +43,7 @@ export default defineConfig(({ mode }) => {
server: {
port: 4200,
watch: {
ignored: ["!**/node_modules/.embroider/rewritten-app/**"],
ignored: ["!**/tmp/rewritten-app/**"],
},
},
// If the "app" is a classic addon dummy app, the public directory is tests/dummy/public,
Expand Down
4 changes: 2 additions & 2 deletions tests/app-template/vite.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
import { resolve } from "path";
import { babel } from "@rollup/plugin-babel";

const root = "node_modules/.embroider/rewritten-app";
const root = "tmp/rewritten-app";

export default defineConfig(({ mode }) => {
return {
Expand Down Expand Up @@ -44,7 +44,7 @@ export default defineConfig(({ mode }) => {
server: {
port: 4200,
watch: {
ignored: ["!**/node_modules/.embroider/rewritten-app/**"],
ignored: ["!**/tmp/**"],
},
},
build: {
Expand Down
2 changes: 1 addition & 1 deletion tests/scenarios/compat-app-html-attributes-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ appScenarios
let app = await scenario.prepare();
let result = await app.execute('ember build', { env: { EMBROIDER_PREBUILD: 'true' } });
assert.equal(result.exitCode, 0, result.output);
expectFile = expectFilesAt(join(app.dir, 'node_modules', '.embroider', 'rewritten-app'), { qunit: assert });
expectFile = expectFilesAt(join(app.dir, 'tmp', 'rewritten-app'), { qunit: assert });
});

test('custom HTML attributes are passed through', () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/scenarios/compat-exclude-dot-files-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ appScenarios

// but not be picked up in the entrypoint
expectAudit
.module('./node_modules/.embroider/rewritten-app/index.html')
.module('./tmp/rewritten-app/index.html')
.resolves('/@embroider/core/entrypoint')
.toModule()
.withContents(content => {
Expand Down
2 changes: 1 addition & 1 deletion tests/scenarios/compat-renaming-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ appScenarios
});
test('renamed modules keep their classic runtime name when used as implicit-modules', function () {
expectAudit
.module('./node_modules/.embroider/rewritten-app/index.html')
.module('./tmp/rewritten-app/index.html')
.resolves('/@embroider/core/entrypoint')
.toModule()
.resolves('./-embroider-implicit-modules.js')
Expand Down
28 changes: 14 additions & 14 deletions tests/scenarios/compat-stage2-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ stage2Scenarios

// check that the app trees with in repo addon are combined correctly
expectAudit
.module('./node_modules/.embroider/rewritten-app/index.html')
.module('./tmp/rewritten-app/index.html')
.resolves('/@embroider/core/entrypoint')
.toModule()
.resolves('./service/in-repo.js')
Expand All @@ -140,7 +140,7 @@ stage2Scenarios
test('incorporates in-repo-addons of in-repo-addons correctly', function () {
// secondary in-repo-addon was correctly detected and activated
expectAudit
.module('./node_modules/.embroider/rewritten-app/index.html')
.module('./tmp/rewritten-app/index.html')
.resolves('/@embroider/core/entrypoint')
.toModule()
.resolves('./services/secondary.js')
Expand Down Expand Up @@ -206,7 +206,7 @@ stage2Scenarios

test('verifies that the correct lexigraphically sorted addons win', function () {
let expectModule = expectAudit
.module('./node_modules/.embroider/rewritten-app/index.html')
.module('./tmp/rewritten-app/index.html')
.resolves('/@embroider/core/entrypoint')
.toModule();
expectModule.resolves('./service/in-repo.js').to('./lib/in-repo-b/_app_/service/in-repo.js');
Expand All @@ -216,7 +216,7 @@ stage2Scenarios

test('addons declared as dependencies should win over devDependencies', function () {
expectAudit
.module('./node_modules/.embroider/rewritten-app/index.html')
.module('./tmp/rewritten-app/index.html')
.resolves('/@embroider/core/entrypoint')
.toModule()
.resolves('./service/dep-wins-over-dev.js')
Expand All @@ -225,7 +225,7 @@ stage2Scenarios

test('in repo addons declared win over dependencies', function () {
expectAudit
.module('./node_modules/.embroider/rewritten-app/index.html')
.module('./tmp/rewritten-app/index.html')
.resolves('/@embroider/core/entrypoint')
.toModule()
.resolves('./service/in-repo-over-deps.js')
Expand All @@ -234,7 +234,7 @@ stage2Scenarios

test('ordering with before specified', function () {
expectAudit
.module('./node_modules/.embroider/rewritten-app/index.html')
.module('./tmp/rewritten-app/index.html')
.resolves('/@embroider/core/entrypoint')
.toModule()
.resolves('./service/test-before.js')
Expand All @@ -243,7 +243,7 @@ stage2Scenarios

test('ordering with after specified', function () {
expectAudit
.module('./node_modules/.embroider/rewritten-app/index.html')
.module('./tmp/rewritten-app/index.html')
.resolves('/@embroider/core/entrypoint')
.toModule()
.resolves('./service/test-after.js')
Expand Down Expand Up @@ -672,7 +672,7 @@ stage2Scenarios

test('non-static other paths are included in the entrypoint', function (assert) {
expectAudit
.module('./node_modules/.embroider/rewritten-app/index.html')
.module('./tmp/rewritten-app/index.html')
.resolves('/@embroider/core/entrypoint')
.toModule()
.withContents(contents => {
Expand All @@ -696,7 +696,7 @@ stage2Scenarios

test('static other paths are not included in the entrypoint', function () {
expectAudit
.module('./node_modules/.embroider/rewritten-app/index.html')
.module('./tmp/rewritten-app/index.html')
.resolves('/@embroider/core/entrypoint')
.toModule()
.withContents(content => {
Expand All @@ -706,7 +706,7 @@ stage2Scenarios

test('top-level static other paths are not included in the entrypoint', function () {
expectAudit
.module('./node_modules/.embroider/rewritten-app/index.html')
.module('./tmp/rewritten-app/index.html')
.resolves('/@embroider/core/entrypoint')
.toModule()
.withContents(content => {
Expand All @@ -716,7 +716,7 @@ stage2Scenarios

test('staticAppPaths do not match partial path segments', function () {
expectAudit
.module('./node_modules/.embroider/rewritten-app/index.html')
.module('./tmp/rewritten-app/index.html')
.resolves('/@embroider/core/entrypoint')
.toModule()
.withContents(content => {
Expand Down Expand Up @@ -788,9 +788,9 @@ dummyAppScenarios
});

test('dummy app sees that its being developed', function () {
let assertFile = expectFile(
'../../node_modules/.embroider/rewritten-app/components/inside-dummy-app.js'
).transform(build.transpile);
let assertFile = expectFile('../../tmp/rewritten-app/components/inside-dummy-app.js').transform(
build.transpile
);
assertFile.matches(/console\.log\(true\)/);
});

Expand Down
4 changes: 2 additions & 2 deletions tests/scenarios/compat-template-colocation-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ scenarios

test(`app's colocated components are not implicitly included`, function (assert) {
expectAudit
.module('./node_modules/.embroider/rewritten-app/index.html')
.module('./tmp/rewritten-app/index.html')
.resolves('/@embroider/core/entrypoint')
.toModule()
.withContents(content => {
Expand Down Expand Up @@ -354,7 +354,7 @@ appScenarios

test(`app's pod components and templates are implicitly included correctly`, function (assert) {
expectAudit
.module('./node_modules/.embroider/rewritten-app/index.html')
.module('./tmp/rewritten-app/index.html')
.resolves('/@embroider/core/entrypoint')
.toModule()
.withContents(content => {
Expand Down
2 changes: 1 addition & 1 deletion tests/scenarios/watch-mode-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ app.forEachScenario(scenario => {

hooks.beforeEach(assert => {
assertRewrittenFile = (rewrittenPath: string) => {
let fullPath = path.join(app.dir, 'node_modules', '.embroider', 'rewritten-app', ...rewrittenPath.split('/'));
let fullPath = path.join(app.dir, 'tmp', 'rewritten-app', ...rewrittenPath.split('/'));
let file = new File(rewrittenPath, fullPath);
return new AssertFile(assert, file);
};
Expand Down
4 changes: 2 additions & 2 deletions tests/ts-app-template-classic/vite.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { resolver, hbs, scripts, templateTag, optimizeDeps, compatPrebuild, cont
import { resolve } from 'path';
import { babel } from '@rollup/plugin-babel';

const root = 'node_modules/.embroider/rewritten-app';
const root = 'tmp/rewritten-app';

export default defineConfig({
root,
Expand Down Expand Up @@ -32,7 +32,7 @@ export default defineConfig({
server: {
port: 4200,
watch: {
ignored: ['!**/node_modules/.embroider/rewritten-app/**'],
ignored: ['!**/tmp/rewritten-app/**'],
},
},
build: {
Expand Down
4 changes: 2 additions & 2 deletions tests/ts-app-template/vite.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { resolver, hbs, scripts, templateTag, optimizeDeps, compatPrebuild, cont
import { resolve } from 'path';
import { babel } from '@rollup/plugin-babel';

const root = 'node_modules/.embroider/rewritten-app';
const root = 'tmp/rewritten-app';

export default defineConfig({
root,
Expand Down Expand Up @@ -32,7 +32,7 @@ export default defineConfig({
server: {
port: 4200,
watch: {
ignored: ['!**/node_modules/.embroider/rewritten-app/**'],
ignored: ['!**/tmp/rewritten-app/**'],
},
},
build: {
Expand Down

0 comments on commit 1486226

Please sign in to comment.