-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
309 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
/app/deno.d.ts | ||
/build | ||
/package.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { | ||
Links, | ||
Meta, | ||
Outlet, | ||
Scripts, | ||
ScrollRestoration, | ||
} from "@remix-run/react"; | ||
|
||
export default function App() { | ||
return ( | ||
<html lang="en"> | ||
<head> | ||
<meta charSet="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<Meta /> | ||
<Links /> | ||
</head> | ||
<body> | ||
<Outlet /> | ||
<ScrollRestoration /> | ||
<Scripts /> | ||
</body> | ||
</html> | ||
); | ||
} |
41 changes: 41 additions & 0 deletions
41
integration/helpers/vite-deno-template/app/routes/_index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import type { MetaFunction } from "@remix-run/react"; | ||
|
||
export const meta: MetaFunction = () => { | ||
return [ | ||
{ title: "New Remix App" }, | ||
{ name: "description", content: "Welcome to Remix!" }, | ||
]; | ||
}; | ||
|
||
export default function Index() { | ||
return ( | ||
<div style={{ fontFamily: "system-ui, sans-serif", lineHeight: "1.8" }}> | ||
<h1>Welcome to Remix</h1> | ||
<ul> | ||
<li> | ||
<a | ||
target="_blank" | ||
href="https://remix.run/tutorials/blog" | ||
rel="noreferrer" | ||
> | ||
15m Quickstart Blog Tutorial | ||
</a> | ||
</li> | ||
<li> | ||
<a | ||
target="_blank" | ||
href="https://remix.run/tutorials/jokes" | ||
rel="noreferrer" | ||
> | ||
Deep Dive Jokes App Tutorial | ||
</a> | ||
</li> | ||
<li> | ||
<a target="_blank" href="https://remix.run/docs" rel="noreferrer"> | ||
Remix Docs | ||
</a> | ||
</li> | ||
</ul> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"tasks": { | ||
"build": "deno run -A npm:@remix-run/dev@^2.11.2 vite:build", | ||
"dev": "deno run -A npm:@remix-run/dev@^2.11.2 vite:dev", | ||
"typecheck": "deno check '**/*' && deno run -A npm:typescript@^5.5.4/tsc", | ||
"typegen": "deno types > ./app/deno.d.ts" | ||
}, | ||
"exclude": ["app/", "build/"], | ||
"nodeModulesDir": true, | ||
"imports": { | ||
"@remix-run/dev": "npm:@remix-run/dev@^2.11.2", | ||
"@remix-run/express": "npm:@remix-run/express@^2.11.2", | ||
"@remix-run/react": "npm:@remix-run/react@^2.11.2", | ||
"@remix-run/server-runtime": "npm:@remix-run/server-runtime@^2.11.2", | ||
"@std/http": "jsr:@std/http@^1.0.4", | ||
"@std/path": "jsr:@std/path@^1.0.3", | ||
"@types/node": "npm:@types/node@^22.5.1", | ||
"@types/react": "npm:@types/react@^18.3.5", | ||
"@types/react-dom": "npm:@types/react-dom@^18.3.0", | ||
"isbot": "npm:isbot@^5.1.17", | ||
"postcss": "npm:postcss@^8.4.41", | ||
"react": "npm:react@^18.3.1", | ||
"react-dom": "npm:react-dom@^18.3.1", | ||
"typescript": "npm:typescript@^5.5.4", | ||
"vite": "npm:vite@^5.4.2", | ||
"vite-tsconfig-paths": "npm:vite-tsconfig-paths@^5.0.1" | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"include": [ | ||
"app/**/*.ts", | ||
"app/**/*.tsx", | ||
"app/**/.server/**/*.ts", | ||
"app/**/.server/**/*.tsx", | ||
"app/**/.client/**/*.ts", | ||
"app/**/.client/**/*.tsx" | ||
], | ||
"compilerOptions": { | ||
"lib": ["DOM", "DOM.Iterable", "ES2022"], | ||
"types": ["vite/client"], | ||
"isolatedModules": true, | ||
"esModuleInterop": true, | ||
"jsx": "react-jsx", | ||
"module": "ESNext", | ||
"moduleResolution": "Bundler", | ||
"resolveJsonModule": true, | ||
"target": "ES2022", | ||
"strict": true, | ||
"allowJs": true, | ||
"skipLibCheck": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"baseUrl": ".", | ||
"paths": { | ||
"~/*": ["./app/*"] | ||
}, | ||
|
||
// Vite takes care of building everything, not tsc. | ||
"noEmit": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { vitePlugin as remix } from "@remix-run/dev"; | ||
import { defineConfig } from "vite"; | ||
import tsconfigPaths from "vite-tsconfig-paths"; | ||
|
||
export default defineConfig({ | ||
plugins: [ | ||
remix({ | ||
future: { | ||
v3_fetcherPersist: true, | ||
v3_relativeSplatPath: true, | ||
v3_throwAbortReason: true, | ||
}, | ||
}), | ||
tsconfigPaths(), | ||
], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import { expect } from "@playwright/test"; | ||
import dedent from "dedent"; | ||
|
||
import type { Files } from "./helpers/vite.js"; | ||
import { test, viteConfig } from "./helpers/vite.js"; | ||
|
||
const files: Files = async ({ port }) => ({ | ||
"vite.config.ts": dedent` | ||
export default { | ||
${await viteConfig.server({ port })} | ||
plugins: [ | ||
remix(), | ||
], | ||
} | ||
`, | ||
"app/routes/_index.tsx": ` | ||
import { Form, useLoaderData } from "@remix-run/react"; | ||
import { | ||
json, | ||
type ActionFunctionArgs, | ||
type LoaderFunctionArgs, | ||
} from "@remix-run/server-runtime"; | ||
const key = "__my-key__"; | ||
export async function loader({ context }: LoaderFunctionArgs) { | ||
const MY_KV = await Deno.openKv("test"); | ||
const { value } = await MY_KV.get<string>([key]); | ||
return json({ value, extra: context.extra }); | ||
} | ||
export async function action({ request }: ActionFunctionArgs) { | ||
const MY_KV = await Deno.openKv("test"); | ||
if (request.method === "POST") { | ||
const formData = await request.formData(); | ||
const value = formData.get("value") as string; | ||
await MY_KV.set([key], value); | ||
return null; | ||
} | ||
if (request.method === "DELETE") { | ||
await MY_KV.delete([key]); | ||
return null; | ||
} | ||
throw new Error(\`Method not supported: "\${request.method}"\`); | ||
} | ||
export default function Index() { | ||
const { value } = useLoaderData<typeof loader>(); | ||
return ( | ||
<div> | ||
<h1>Welcome to Remix</h1> | ||
{value ? ( | ||
<> | ||
<p data-text>Value: {value}</p> | ||
<Form method="DELETE"> | ||
<button>Delete</button> | ||
</Form> | ||
</> | ||
) : ( | ||
<> | ||
<p data-text>No value</p> | ||
<Form method="POST"> | ||
<label htmlFor="value">Set value:</label> | ||
<input type="text" name="value" id="value" required /> | ||
<br /> | ||
<button>Save</button> | ||
</Form> | ||
</> | ||
)} | ||
</div> | ||
); | ||
} | ||
`, | ||
}); | ||
|
||
test("vite dev", async ({ page, viteDevDeno }) => { | ||
let { port } = await viteDevDeno(files, "vite-deno-template"); | ||
await page.goto(`http://localhost:${port}/`, { | ||
waitUntil: "networkidle", | ||
}); | ||
await expect(page.locator("[data-text]")).toHaveText("No value"); | ||
|
||
await page.getByLabel("Set value:").fill("my-value"); | ||
await page.getByRole("button").click(); | ||
await expect(page.locator("[data-text]")).toHaveText("Value: my-value"); | ||
expect(page.errors).toEqual([]); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.