Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Bun runtime template #28

Open
wants to merge 25 commits into
base: js-template
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
1fd3e18
add explicit `ssr: true` to all react-router.config.ts files
brookslybrand Nov 25, 2024
98eccd6
add gitignore to cloudflare-d1
diurivj Nov 25, 2024
8cd83ba
Merge pull request #12 from diurivj/cloudflare-d1-gitignore
brookslybrand Dec 2, 2024
6009c21
Merge pull request #11 from remix-run/js-template
brookslybrand Dec 2, 2024
69afbe8
remove redundant forceConsistentCasingInFileNames
pcattori Dec 4, 2024
565c366
isolatedModules -> verbatimModuleSyntax
pcattori Dec 4, 2024
d278357
cloudflare: fix `typecheck`
pcattori Dec 4, 2024
cc37d7a
cloudflare-d1: fix `typecheck`
pcattori Dec 4, 2024
3d31dd1
cloudflare-d1: fix `build`
pcattori Dec 4, 2024
7e6ee7c
cloudflare-d1: fix `start`
pcattori Dec 4, 2024
7ea829e
netlify: fix `start`
pcattori Dec 4, 2024
21f6b4f
node-postgres: fix `typecheck`
pcattori Dec 4, 2024
8bf7ca3
vercel: add missing gitignore
pcattori Dec 4, 2024
117e458
do not build with tsc during `typecheck`
pcattori Dec 4, 2024
dac1da7
Merge pull request #21 from remix-run/pedro/clean-up
pcattori Dec 4, 2024
3179330
chore: simplify tsc command
brookslybrand Dec 4, 2024
44f89f1
Merge pull request #22 from remix-run/no-emit
brookslybrand Dec 4, 2024
7836ecf
tidy gitignores
pcattori Dec 4, 2024
888d4ea
Merge pull request #23 from remix-run/pedro/tidy-gitignores
pcattori Dec 4, 2024
747b54b
Add starter kits image to templates
brookslybrand Dec 4, 2024
c1da1b6
Add Open in StackBlitz link to default template
brophdawg11 Dec 6, 2024
5ade190
tests: typecheck, dev, build, start across all templates
pcattori Dec 8, 2024
cf421fd
perf: symlink node_modules
pcattori Dec 9, 2024
ae5dd8f
Merge pull request #26 from remix-run/pedro/tests
pcattori Dec 9, 2024
1aac0ad
Add Bun template
cloudcreatr Dec 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 4 additions & 17 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
.env
!.env.example
.DS_Store
.react-router
build
node_modules
*.tsbuildinfo
/node_modules/

# Cloudflare specific
.mf
.wrangler

# Netlify specific
.netlify

# Vercel specific
.vercel
/test-results/
/playwright-report/
# Tests
/blob-report/
/playwright-report/
/playwright/.cache/
/test-results/
55 changes: 23 additions & 32 deletions .tests/cloudflare-d1.spec.ts
Original file line number Diff line number Diff line change
@@ -1,41 +1,32 @@
import { execFile } from "node:child_process";
import * as path from "node:path";
import { expect, Page } from "@playwright/test";
import { matchLine, testTemplate, urlRegex } from "./utils.js";

import { test, expect } from "@playwright/test";
const test = testTemplate("cloudflare-d1");

import { startVite } from "./utils.js";

let vite: Awaited<ReturnType<typeof startVite>>;
test.beforeAll(async () => {
const cp = execFile("pnpm", ["db:migrate"], {
cwd: path.resolve(process.cwd(), "cloudflare-d1"),
});
await new Promise((resolve) => cp.on("exit", resolve));
if (cp.exitCode !== 0) {
throw new Error("Failed to run db:migrate");
}

vite = await startVite("cloudflare-d1");
test("typecheck", async ({ $ }) => {
await $(`pnpm typecheck`);
});
test.afterAll(async () => {
await vite?.cleanup();

test("dev", async ({ page, port, $ }) => {
await $(`pnpm db:migrate`);
const dev = $(`pnpm dev --port ${port}`);
const url = await matchLine(dev.stdout, urlRegex.viteDev);
await workflow({ page, url });
});

test("loads home page", async ({ page }) => {
await page.goto(new URL("/", vite.baseURL).href);
test("build + start", async ({ page, port, $ }) => {
await $(`pnpm build`);
const start = $(`pnpm start --port ${port}`);
const url = await matchLine(start.stdout, urlRegex.wrangler);
await workflow({ page, url });
});

async function workflow({ page, url }: { page: Page; url: string }) {
await page.goto(url);
await expect(page).toHaveTitle(/New React Router App/);

await page
.getByRole("link", {
name: "React Router Docs",
})
.waitFor();
await page
.getByRole("link", {
name: "Join Discord",
})
.waitFor();
await page.getByRole("link", { name: "React Router Docs" }).waitFor();
await page.getByRole("link", { name: "Join Discord" }).waitFor();

const randomText = Math.random().toString(36).substring(7);
await page.getByRole("textbox", { name: "Name" }).fill(randomText);
Expand All @@ -45,6 +36,6 @@ test("loads home page", async ({ page }) => {
await page.getByRole("button", { name: "Sign Guest Book" }).click();
await page.getByText(randomText).waitFor();

await page.goto(new URL("/", vite.baseURL).href);
await page.goto(url);
await page.getByText(randomText).waitFor();
});
}
43 changes: 22 additions & 21 deletions .tests/cloudflare.spec.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
import { test, expect } from "@playwright/test";
import { expect, Page } from "@playwright/test";

import { startVite } from "./utils.js";
import { matchLine, testTemplate, urlRegex } from "./utils";

let vite: Awaited<ReturnType<typeof startVite>>;
test.beforeAll(async () => {
vite = await startVite("cloudflare");
const test = testTemplate("cloudflare");

test("typecheck", async ({ $ }) => {
await $(`pnpm typecheck`);
});
test.afterAll(async () => {
await vite?.cleanup();

test("dev", async ({ page, port, $ }) => {
const dev = $(`pnpm dev --port ${port}`);
const url = await matchLine(dev.stdout, urlRegex.viteDev);
await workflow({ page, url });
});

test("loads home page", async ({ page }) => {
await page.goto(new URL("/", vite.baseURL).href);
test("build + start", async ({ page, port, $ }) => {
await $(`pnpm build`);
const start = $(`pnpm start --port ${port}`);
const url = await matchLine(start.stdout, urlRegex.wrangler);
await workflow({ page, url });
});

async function workflow({ page, url }: { page: Page; url: string }) {
await page.goto(url);
await expect(page).toHaveTitle(/New React Router App/);

await page
.getByRole("link", {
name: "React Router Docs",
})
.waitFor();
await page
.getByRole("link", {
name: "Join Discord",
})
.waitFor();
});
await page.getByRole("link", { name: "React Router Docs" }).waitFor();
await page.getByRole("link", { name: "Join Discord" }).waitFor();
}
43 changes: 22 additions & 21 deletions .tests/default.spec.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
import { test, expect } from "@playwright/test";
import { expect, Page } from "@playwright/test";

import { startVite } from "./utils.js";
import { matchLine, testTemplate, urlRegex } from "./utils";

let vite: Awaited<ReturnType<typeof startVite>>;
test.beforeAll(async () => {
vite = await startVite("default");
const test = testTemplate("default");

test("typecheck", async ({ $ }) => {
await $(`pnpm typecheck`);
});
test.afterAll(async () => {
await vite?.cleanup();

test("dev", async ({ page, port, $ }) => {
const dev = $(`pnpm dev --port ${port}`);
const url = await matchLine(dev.stdout, urlRegex.viteDev);
await workflow({ page, url });
});

test("loads home page", async ({ page }) => {
await page.goto(new URL("/", vite.baseURL).href);
test("build + start", async ({ page, port, $ }) => {
await $(`pnpm build`);
const start = $(`pnpm start`, { env: { PORT: String(port) } });
const url = await matchLine(start.stdout, urlRegex.reactRouterServe);
await workflow({ page, url });
});

async function workflow({ page, url }: { page: Page; url: string }) {
await page.goto(url);
await expect(page).toHaveTitle(/New React Router App/);

await page
.getByRole("link", {
name: "React Router Docs",
})
.waitFor();
await page
.getByRole("link", {
name: "Join Discord",
})
.waitFor();
});
await page.getByRole("link", { name: "React Router Docs" }).waitFor();
await page.getByRole("link", { name: "Join Discord" }).waitFor();
}
47 changes: 26 additions & 21 deletions .tests/netlify.spec.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
import { test, expect } from "@playwright/test";
import { expect, Page } from "@playwright/test";

import { startCustom } from "./utils.js";
import { matchLine, testTemplate, urlRegex } from "./utils";

let vite: Awaited<ReturnType<typeof startCustom>>;
test.beforeAll(async () => {
vite = await startCustom("netlify");
const test = testTemplate("netlify");

test("typecheck", async ({ $ }) => {
await $(`pnpm typecheck`);
});
test.afterAll(async () => {
await vite?.cleanup();

test("dev", async ({ page, port, $ }) => {
const dev = $(`pnpm dev`, { env: { PORT: String(port) } });
const url = await matchLine(dev.stdout, urlRegex.custom);
await workflow({ page, url });
});

test("loads home page", async ({ page }) => {
await page.goto(new URL("/", vite.baseURL).href);
test("build + start", async ({ page, edit, port, $ }) => {
await edit("netlify.toml", (txt) =>
txt
.replaceAll("[dev]", "[dev]\nautoLaunch = false")
.replaceAll("npm run", "pnpm")
);
const start = $(`pnpm start --port ${port}`);
const url = await matchLine(start.stdout, urlRegex.netlify);
await workflow({ page, url });
});

async function workflow({ page, url }: { page: Page; url: string }) {
await page.goto(url);
await expect(page).toHaveTitle(/New React Router App/);

await page
.getByRole("link", {
name: "React Router Docs",
})
.waitFor();
await page
.getByRole("link", {
name: "Join Discord",
})
.waitFor();
});
await page.getByRole("link", { name: "React Router Docs" }).waitFor();
await page.getByRole("link", { name: "Join Discord" }).waitFor();
}
43 changes: 22 additions & 21 deletions .tests/node-custom-server.spec.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
import { test, expect } from "@playwright/test";
import { expect, Page } from "@playwright/test";

import { startCustom } from "./utils.js";
import { matchLine, testTemplate, urlRegex } from "./utils";

let vite: Awaited<ReturnType<typeof startCustom>>;
test.beforeAll(async () => {
vite = await startCustom("node-custom-server");
const test = testTemplate("node-custom-server");

test("typecheck", async ({ $ }) => {
await $(`pnpm typecheck`);
});
test.afterAll(async () => {
await vite?.cleanup();

test("dev", async ({ page, port, $ }) => {
const dev = $(`pnpm dev`, { env: { PORT: String(port) } });
const url = await matchLine(dev.stdout, urlRegex.custom);
await workflow({ page, url });
});

test("loads home page", async ({ page }) => {
await page.goto(new URL("/", vite.baseURL).href);
test("build + start", async ({ page, port, $ }) => {
await $(`pnpm build`);
const start = $(`pnpm start`, { env: { PORT: String(port) } });
const url = await matchLine(start.stdout, urlRegex.custom);
await workflow({ page, url });
});

async function workflow({ page, url }: { page: Page; url: string }) {
await page.goto(url);
await expect(page).toHaveTitle(/New React Router App/);

await page
.getByRole("link", {
name: "React Router Docs",
})
.waitFor();
await page
.getByRole("link", {
name: "Join Discord",
})
.waitFor();
});
await page.getByRole("link", { name: "React Router Docs" }).waitFor();
await page.getByRole("link", { name: "Join Discord" }).waitFor();
}
51 changes: 4 additions & 47 deletions .tests/node-postgres.spec.ts
Original file line number Diff line number Diff line change
@@ -1,50 +1,7 @@
import { execFile } from "node:child_process";
import * as path from "node:path";
import { testTemplate } from "./utils";

import { test, expect } from "@playwright/test";
const test = testTemplate("node-postgres");

import { startCustom } from "./utils.js";

let vite: Awaited<ReturnType<typeof startCustom>>;
test.beforeAll(async () => {
const cp = execFile("pnpm", ["db:migrate"], {
cwd: path.resolve(process.cwd(), "node-postgres"),
});
await new Promise((resolve) => cp.on("exit", resolve));
if (cp.exitCode !== 0) {
throw new Error("Failed to run db:migrate");
}

vite = await startCustom("node-postgres");
});
test.afterAll(async () => {
await vite?.cleanup();
});

test("loads home page", async ({ page }) => {
await page.goto(new URL("/", vite.baseURL).href);

await expect(page).toHaveTitle(/New React Router App/);

await page
.getByRole("link", {
name: "React Router Docs",
})
.waitFor();
await page
.getByRole("link", {
name: "Join Discord",
})
.waitFor();

const randomText = Math.random().toString(36).substring(7);
await page.getByRole("textbox", { name: "Name" }).fill(randomText);
await page
.getByRole("textbox", { name: "Email" })
.fill(`email${randomText}@example.com`);
await page.getByRole("button", { name: "Sign Guest Book" }).click();
await page.getByText(randomText).waitFor();

await page.goto(new URL("/", vite.baseURL).href);
await page.getByText(randomText).waitFor();
test("typecheck", async ({ $ }) => {
await $(`pnpm typecheck`);
});
Loading