Skip to content

Commit

Permalink
Revert "fix: write other server build output files (#3817)"
Browse files Browse the repository at this point in the history
This reverts commit 916caa6.
  • Loading branch information
mcansh committed Aug 29, 2022
1 parent 81ec1b7 commit 3670cc5
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 34 deletions.
Binary file removed integration/assets/image.png
Binary file not shown.
9 changes: 2 additions & 7 deletions integration/helpers/create-fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const TMP_DIR = path.join(process.cwd(), ".tmp", "integration");
interface FixtureInit {
buildStdio?: Writable;
sourcemap?: boolean;
files?: { [filename: string]: string | Buffer };
files?: { [filename: string]: string };
template?: "cf-template" | "deno-template" | "node-template";
setup?: "node" | "cloudflare";
}
Expand Down Expand Up @@ -205,12 +205,7 @@ async function writeTestFiles(init: FixtureInit, dir: string) {
Object.keys(init.files ?? {}).map(async (filename) => {
let filePath = path.join(dir, filename);
await fse.ensureDir(path.dirname(filePath));
let file = init.files![filename];
if (typeof file === "string") {
await fse.writeFile(filePath, stripIndent(file));
} else {
await fse.writeFile(filePath, file);
}
await fse.writeFile(filePath, stripIndent(init.files![filename]));
})
);
}
24 changes: 0 additions & 24 deletions integration/resource-routes-test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import path from "node:path";
import fse from "fs-extra";
import { test, expect } from "@playwright/test";

import { createAppFixture, createFixture, js } from "./helpers/create-fixture";
Expand All @@ -9,8 +7,6 @@ import { PlaywrightFixture } from "./helpers/playwright-fixture";
test.describe("loader in an app", () => {
let appFixture: AppFixture;

let image = fse.readFileSync(path.join(__dirname, "./assets/image.png"));

test.beforeAll(async () => {
appFixture = await createAppFixture(
await createFixture({
Expand Down Expand Up @@ -51,20 +47,6 @@ test.describe("loader in an app", () => {
import { json } from "@remix-run/node";
export let loader = () => json({hello: "world"});
`,
"app/assets/image.png": image,
"app/routes/image[.]png.jsx": js`
import fs from "node:fs";
import path from "node:path";
import image from "~/assets/image.png";
export let loader = () => {
return new Response(fs.readFileSync(path.join(__dirname, "..", image)), {
headers: {
"Content-Type": "image/png",
},
});
};
`,
},
})
);
Expand Down Expand Up @@ -103,11 +85,5 @@ test.describe("loader in an app", () => {
await app.goto("/data.json");
expect(await page.content()).toContain('{"hello":"world"}');
});

test("should include imported asset in build", async ({ page }) => {
let app = new PlaywrightFixture(appFixture, page);
let res = await app.goto("/image.png");
expect(res.status()).toBe(200);
});
}
});
3 changes: 0 additions & 3 deletions packages/remix-dev/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -525,9 +525,6 @@ async function writeServerBuildResult(
let contents = Buffer.from(file.contents).toString("utf-8");
contents = contents.replace(/"route:/gm, '"');
await fse.writeFile(file.path, contents);
} else {
await fse.ensureDir(path.dirname(file.path));
await fse.writeFile(file.path, file.contents);
}
}
}

0 comments on commit 3670cc5

Please sign in to comment.