Skip to content

Commit

Permalink
docs: cloudflare adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
rossrobino committed Sep 5, 2024
1 parent ef95a19 commit b869f97
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 33 deletions.
12 changes: 0 additions & 12 deletions apps/cloudflare/public/public.html

This file was deleted.

8 changes: 1 addition & 7 deletions apps/cloudflare/src/+page.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,15 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<link rel="stylesheet" href="/style.css" />
<title>Title</title>
<title>Cloudflare Tester</title>
<meta name="description" content="Description" />
</head>
<body>
<header></header>
<main>
<h1>Hello Cloudflare</h1>
<ul>
<li><a href="https://vitejs.dev">Vite</a></li>
<li><a href="https://hono.dev">Hono</a></li>
<li><a href="https://domco.robino.dev">domco</a></li>
</ul>
<p>
<a href="/static">Static</a>
<a href="/public.html">Public</a>
</p>
</main>
<footer></footer>
Expand Down
3 changes: 3 additions & 0 deletions apps/cloudflare/src/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body {
font-family: "Times New Roman", Times, serif;
}
13 changes: 11 additions & 2 deletions apps/docs/src/content/deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,20 @@ export default defineConfig({
});
```

### Cloudflare

The [Cloudflare](https://cloudflare.com) adapter outputs your app to work on Cloudflare Pages.

![A screenshot of the Cloudflare Build Settings UI. Set the Framework Preset field to "None", set the build command to "npm run build", and the build output directory to ".cloudflare".](/cloudflare/build-settings.webp)

- Functions run on the [Workers Runtime](https://developers.cloudflare.com/workers/runtime-apis/).
- Outputs public assets to be served on Cloudflare's CDN.

### Vercel

The [Vercel](https://vercel.com) adapter outputs your app to the [Build Output API](https://vercel.com/docs/build-output-api/v3) specification.

![A screenshot of the Vercel Build and Development Settings UI. Set the Framework Preset field to "Other" and leave all of the other options blank.](/vercel/build-settings.webp)

- Supports Serverless (+ ISR), and Edge Runtime.
- Outputs public assets to be served on Vercel's CDN. Since your application will not be serving these assets, if you want to protect a page, you need to serve it from an endpoint instead.
- Supports [Node.js](https://vercel.com/docs/functions/runtimes#node.js), [Node.js with ISR](https://vercel.com/docs/incremental-static-regeneration), and [Edge Runtime](https://vercel.com/docs/functions/runtimes/edge-runtime).
- Outputs public assets to be served on Vercel's [Edge Network](https://vercel.com/docs/edge-network/overview).
4 changes: 4 additions & 0 deletions apps/docs/src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@
cursor: default;
}
}

img {
border: var(--border);
}
}

@layer components {
Expand Down
12 changes: 0 additions & 12 deletions packages/domco/src/adapter/cloudflare/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,6 @@ export const adapter: AdapterBuilder = async () => {
run: async () => {
const outDir = ".cloudflare";

// const packageJson = await fs.readFile("package.json", "utf-8");
// const { name } = JSON.parse(packageJson);

// const wranglerToml = {
// filePath: path.join(process.cwd(), "wrangler.toml"),
// toml: `name = "${name}"\ncompatibility_date = "2024-09-05"\npages_build_output_dir= "./${outDir}"\n`,
// };

const routes = {
version: 1,
description: "Generated by `domco/adapter/cloudflare`.",
Expand Down Expand Up @@ -124,10 +116,6 @@ export const adapter: AdapterBuilder = async () => {

await fs.mkdir(outDir, { recursive: true });

// if (!(await fileExists(wranglerToml.filePath))) {
// await fs.writeFile(wranglerToml.filePath, wranglerToml.toml);
// }

await Promise.all([
copyClient(outDir),
copyServer(outDir),
Expand Down

0 comments on commit b869f97

Please sign in to comment.