Skip to content

Commit

Permalink
Revert: dont write other server build output files.
Browse files Browse the repository at this point in the history
that's not the behavior we wanted, we instead wanted these files to end up in the clinet build assetsDirectory

Revert "fix: write other server build output files (#3817)"

This reverts commit 916caa6.
  • Loading branch information
mcansh committed Aug 1, 2022
1 parent ca4366d commit 45fe6eb
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 39 deletions.
6 changes: 0 additions & 6 deletions .changeset/famous-schools-shop.md

This file was deleted.

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]));
})
);
}
23 changes: 0 additions & 23 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 @@ -13,7 +11,6 @@ test.describe("loader in an app", async () => {
let SVG_CONTENTS = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" fill="none" stroke="#000" stroke-width="4" aria-label="Chicken"><path d="M48.1 34C22.1 32 1.4 51 2.5 67.2c1.2 16.1 19.8 17 29 17.8H89c15.7-6.6 6.3-18.9.3-20.5A28 28 0 0073 41.7c-.5-7.2 3.4-11.6 6.9-15.3 8.5 2.6 8-8 .8-7.2.6-6.5-12.3-5.9-6.7 2.7l-3.7 5c-6.9 5.4-10.9 5.1-22.2 7zM48.1 34c-38 31.9 29.8 58.4 25 7.7M70.3 26.9l5.4 4.2"/></svg>`;

test.beforeAll(async () => {
let image = fse.readFileSync(path.join(__dirname, "./assets/image.png"));
fixture = await createFixture({
files: {
"app/routes/index.jsx": js`
Expand Down Expand Up @@ -52,20 +49,6 @@ test.describe("loader in an app", async () => {
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",
},
});
};
`,
"app/assets/icon.svg": SVG_CONTENTS,
"app/routes/[manifest.webmanifest].js": js`
import { json } from "@remix-run/node";
Expand Down Expand Up @@ -123,12 +106,6 @@ test.describe("loader in an app", async () => {
expect(await page.content()).toContain('{"hello":"world"}');
});

test("writes imported asset to `serverBuildPath`", async ({ page }) => {
let app = new PlaywrightFixture(appFixture, page);
let res = await app.goto("/image.png");
expect(res.status()).toBe(200);
});

test("writes imported asset to `assetDirectory`", async ({ page }) => {
new PlaywrightFixture(appFixture, page);
let data = await fixture.getBrowserAsset(
Expand Down
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(
config.assetsBuildDirectory,
file.path.replace(path.dirname(config.serverBuildPath), "")
);

await fse.ensureDir(path.dirname(file.path));
await fse.writeFile(file.path, file.contents);
await fse.ensureDir(path.dirname(assetPath));
await fse.writeFile(assetPath, file.contents);
}
Expand Down

0 comments on commit 45fe6eb

Please sign in to comment.