Skip to content

Commit

Permalink
Use pnpm workspace for vite-deno-template integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
redabacha committed Oct 9, 2024
1 parent 4f728c9 commit 65afd86
Show file tree
Hide file tree
Showing 9 changed files with 285 additions and 112 deletions.
1 change: 0 additions & 1 deletion integration/helpers/vite-deno-template/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
node_modules
/app/deno.d.ts
/build
/package.json
5 changes: 5 additions & 0 deletions integration/helpers/vite-deno-template/deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"exclude": ["app/", "build/"],
"nodeModulesDir": "manual",
"unstable": ["kv"]
}
27 changes: 0 additions & 27 deletions integration/helpers/vite-deno-template/deno.jsonc

This file was deleted.

46 changes: 46 additions & 0 deletions integration/helpers/vite-deno-template/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"name": "integration-vite-deno-template",
"version": "0.0.0",
"private": true,
"scripts": {
"build": "deno run -A npm:@remix-run/dev vite:build",
"dev": "deno run -A npm:@remix-run/dev vite:dev",
"typecheck": "deno check '**/*' && deno run -A npm:typescript/tsc",
"typegen": "deno types > ./app/deno.d.ts"
},
"dependencies": {
"@remix-run/dev": "workspace:*",
"@remix-run/node": "workspace:*",
"@remix-run/react": "workspace:*",
"@remix-run/serve": "workspace:*",
"@remix-run/server-runtime": "workspace:*",
"isbot": "^4.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@remix-run/dev": "workspace:*",
"@types/react": "^18.2.20",
"@types/react-dom": "^18.2.7",
"typescript": "^5.1.0",
"vite": "5.1.3",
"vite-tsconfig-paths": "^4.2.1"
},
"dependenciesMeta": {
"@remix-run/dev": {
"injected": true
},
"@remix-run/node": {
"injected": true
},
"@remix-run/react": {
"injected": true
},
"@remix-run/serve": {
"injected": true
},
"@remix-run/server-runtime": {
"injected": true
}
}
}
41 changes: 0 additions & 41 deletions integration/helpers/vite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,43 +122,6 @@ export async function createProject(
return projectDir;
}

export function installDependenciesDeno(cwd: string) {
let installProc = spawnSync(denoBin, ["install"], {
cwd,
stdio: "pipe",
});
if (installProc.status !== 0) {
throw new Error(
[
"Failed to install Deno dependencies",
"",
"exit code: " + installProc.status,
`stdout: \n${installProc.stdout.toString("utf8")}\n`,
`stderr: \n${installProc.stderr.toString("utf8")}\n`,
].join("\n")
);
}
let copyProc = spawnSync(
nodeBin,
[
"./scripts/copy-build-to-dist.mjs",
`--deno-node-modules-paths=${cwd}/node_modules`,
],
{ stdio: "pipe" }
);
if (copyProc.status !== 0) {
throw new Error(
[
"Failed to copy build artifacts for Deno",
"",
"exit code: " + copyProc.status,
`stdout: \n${copyProc.stdout.toString("utf8")}\n`,
`stderr: \n${copyProc.stderr.toString("utf8")}\n`,
].join("\n")
);
}
}

// Avoid "Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env
// being set" in vite-ecosystem-ci which breaks empty stderr assertions. To fix
// this we always ensure that only NO_COLOR is set after spreading process.env.
Expand Down Expand Up @@ -343,8 +306,6 @@ export const test = base.extend<Fixtures>({
await use(async (files, template) => {
let port = await getPort();
let cwd = await createProject(await files({ port }), template);
// Install dependencies as late as possible so Node won't accidentally import them and cause access denied errors in Deno on Windows
installDependenciesDeno(cwd);
stop = await viteDevDeno({ cwd, port });
return { port, cwd };
});
Expand Down Expand Up @@ -383,8 +344,6 @@ export const test = base.extend<Fixtures>({
await files({ port }),
"vite-deno-template"
);
// Install dependencies as late as possible so Node won't accidentally import them and cause access denied errors in Deno on Windows
installDependenciesDeno(cwd);
let { status } = viteBuildDeno({ cwd });
expect(status).toBe(0);
stop = await viteRemixServeDeno({ cwd, port });
Expand Down
232 changes: 232 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ packages:
- "integration/helpers/cf-template"
- "integration/helpers/deno-template"
- "integration/helpers/vite-cloudflare-template"
- "integration/helpers/vite-deno-template"
- "integration/helpers/vite-template"
- "packages/create-remix"
- "packages/remix"
Expand Down
Loading

0 comments on commit 65afd86

Please sign in to comment.