Skip to content

Commit

Permalink
chore(remix-dev): remove unused code (#7165)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDeBoey authored Aug 16, 2023
1 parent da2d9fb commit be5fa1f
Show file tree
Hide file tree
Showing 33 changed files with 33 additions and 681 deletions.
10 changes: 5 additions & 5 deletions packages/create-remix/__tests__/create-remix-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ describe("create-remix CLI", () => {
args: [
projectDir,
"--template",
path.join(__dirname, "fixtures/stack"),
path.join(__dirname, "fixtures", "stack"),
"--no-git-init",
"--no-install",
],
Expand All @@ -474,7 +474,7 @@ describe("create-remix CLI", () => {
args: [
projectDir,
"--template",
pathToFileURL(path.join(__dirname, "fixtures/stack")).toString(),
pathToFileURL(path.join(__dirname, "fixtures", "stack")).toString(),
"--no-git-init",
"--no-install",
],
Expand Down Expand Up @@ -956,7 +956,7 @@ describe("create-remix CLI", () => {
args: [
notEmptyDir,
"--template",
path.join(__dirname, "fixtures/stack"),
path.join(__dirname, "fixtures", "stack"),
"--no-git-init",
"--no-install",
],
Expand Down Expand Up @@ -986,7 +986,7 @@ describe("create-remix CLI", () => {
args: [
".",
"--template",
path.join(__dirname, "fixtures/stack"),
path.join(__dirname, "fixtures", "stack"),
"--no-git-init",
"--no-install",
],
Expand All @@ -1009,7 +1009,7 @@ describe("create-remix CLI", () => {
args: [
".",
"--template",
path.join(__dirname, "fixtures/stack"),
path.join(__dirname, "fixtures", "stack"),
"--no-git-init",
"--no-install",
],
Expand Down
24 changes: 12 additions & 12 deletions packages/create-remix/__tests__/github-mocks.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as nodePath from "node:path";
import fsp from "node:fs/promises";
import invariant from "tiny-invariant";
import type { setupServer } from "msw/node";
import * as path from "node:path";
import { rest } from "msw";
import type { setupServer } from "msw/node";
import invariant from "tiny-invariant";

type RequestHandler = Parameters<typeof setupServer>[0];

Expand Down Expand Up @@ -56,13 +56,13 @@ let sendTarball: ResponseResolver = async (req, res, ctx) => {

let pathToTarball: string;
if (owner === "remix-run" && repo === "examples") {
pathToTarball = nodePath.join(__dirname, "fixtures/examples-main.tar.gz");
pathToTarball = path.join(__dirname, "fixtures", "examples-main.tar.gz");
} else if (owner === "remix-run" && repo === "remix") {
pathToTarball = nodePath.join(__dirname, "fixtures/remix-repo.tar.gz");
pathToTarball = path.join(__dirname, "fixtures", "remix-repo.tar.gz");
} else if (owner === "fake-remix-tester" && repo === "nested-dir") {
pathToTarball = nodePath.join(__dirname, "fixtures/nested-dir-repo.tar.gz");
pathToTarball = path.join(__dirname, "fixtures", "nested-dir-repo.tar.gz");
} else {
pathToTarball = nodePath.join(__dirname, "fixtures/stack.tar.gz");
pathToTarball = path.join(__dirname, "fixtures", "stack.tar.gz");
}

let fileBuffer = await fsp.readFile(pathToTarball);
Expand Down Expand Up @@ -168,7 +168,7 @@ let githubHandlers: Array<RequestHandler> = [
throw new Error(message);
}

let localPath = nodePath.join(__dirname, "../../..", path);
let localPath = path.join(__dirname, "../../..", path);
let isLocalDir = await isDirectory(localPath);
let isLocalFile = await isFile(localPath);

Expand Down Expand Up @@ -199,11 +199,11 @@ let githubHandlers: Array<RequestHandler> = [

let contentDescriptions = await Promise.all(
dirList.map(async (name): Promise<GHContentsDescription> => {
let relativePath = nodePath.join(path, name);
let relativePath = path.join(path, name);
// NOTE: this is a cheat-code so we don't have to determine the sha of the file
// and our sha endpoint handler doesn't have to do a reverse-lookup.
let sha = relativePath;
let fullPath = nodePath.join(localPath, name);
let fullPath = path.join(localPath, name);
let isDir = await isDirectory(fullPath);
let size = isDir ? 0 : (await fsp.stat(fullPath)).size;
return {
Expand Down Expand Up @@ -247,7 +247,7 @@ let githubHandlers: Array<RequestHandler> = [

// NOTE: we cheat a bit and in the contents/:path handler, we set the sha to the relativePath
let relativePath = sha;
let fullPath = nodePath.join(__dirname, "..", relativePath);
let fullPath = path.join(__dirname, "..", relativePath);
let encoding = "base64" as const;
let size = (await fsp.stat(fullPath)).size;
let content = await fsp.readFile(fullPath, { encoding: "utf-8" });
Expand All @@ -273,7 +273,7 @@ let githubHandlers: Array<RequestHandler> = [
if (typeof relativePath !== "string") {
throw new Error("req.params.path must be a string");
}
let fullPath = nodePath.join(__dirname, "..", relativePath);
let fullPath = path.join(__dirname, "..", relativePath);
let encoding = "base64" as const;
let size = (await fsp.stat(fullPath)).size;
let content = await fsp.readFile(fullPath, { encoding: "utf-8" });
Expand Down
2 changes: 1 addition & 1 deletion packages/create-remix/__tests__/msw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ let miscHandlers: Array<RequestHandler> = [
}),
rest.get("https://example.com/remix-stack.tar.gz", async (req, res, ctx) => {
let fileBuffer = await fsp.readFile(
path.join(__dirname, "./fixtures/stack.tar.gz")
path.join(__dirname, "fixtures", "stack.tar.gz")
);

return res(
Expand Down
Binary file removed packages/remix-dev/__tests__/fixtures/arc.tar.gz
Binary file not shown.

This file was deleted.

This file was deleted.

27 changes: 0 additions & 27 deletions packages/remix-dev/__tests__/fixtures/indie-stack/app/root.tsx

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit be5fa1f

Please sign in to comment.