Skip to content

Commit

Permalink
Move builder into a packages/cloudflare directory to match its new pa…
Browse files Browse the repository at this point in the history
…ckage name
  • Loading branch information
petebacondarwin committed Sep 23, 2024
1 parent 88fe982 commit b0beb62
Show file tree
Hide file tree
Showing 41 changed files with 49 additions and 49 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# [POC] Build Next.js app for cf workers

This monorepo includes a POC to see if it is possible to get a Next.js application built via `next build` (in standalone mode) to run in the Cloudflare workerd runtime.
This monorepo includes a package for adapting a Next.js application built via `next build` (in standalone mode) to run in the Cloudflare workerd runtime.

> [!NOTE]
> The code here is built based on the amazing work done by @mhart in <https://github.com/mhart/nextjs-commerce>
Expand All @@ -9,8 +9,8 @@ This monorepo includes a POC to see if it is possible to get a Next.js applicati

The repository contains two directories:

- `builder` containing a package that can be used to build Cloudflare workers compatible output from Next.js applications
- `examples` containing Next.js applications that use the above mentioned builder.
- `packages` containing a cloudflare package that can be used to build Cloudflare workers compatible output from Next.js applications
- `examples` containing Next.js applications that use the above mentioned cloudflare.

## How to try out/develop in the repository

Expand All @@ -23,13 +23,13 @@ pnpm i
build the worker with:

```sh
pnpm --filter builder build
pnpm --filter cloudflare build
```

or in watch mode with:

```sh
pnpm --filter builder build:watch
pnpm --filter cloudflare build:watch
```

build and preview the worker for the `api` application:
Expand Down
2 changes: 1 addition & 1 deletion examples/create-next-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"build": "next build",
"start": "next start",
"lint": "next lint",
"build:worker": "pnpm cloudflare",
"build:worker": "cloudflare",
"dev:worker": "wrangler dev --port 8771",
"preview:worker": "pnpm build:worker && pnpm dev:worker",
"e2e": "playwright test -c e2e/playwright.config.ts"
Expand Down
File renamed without changes.
4 changes: 3 additions & 1 deletion builder/README.md → packages/cloudflare/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Next.js builder for Cloudflare

How to update a Next.js application to run on Cloudflare.

## Configure your app

- add the following `devDependency` to the `package.json`:
- add the following `devDependencies` to the `package.json`:

```bash
pnpm add -D wrangler@latest @opennextjs/cloudflare
Expand Down
6 changes: 2 additions & 4 deletions builder/TODO.md → packages/cloudflare/TODO.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Builder

## TODO
# TODO

- move the wrangler.toml to the templates

Expand Down Expand Up @@ -32,6 +30,6 @@ Changes:
}
```

- Build the app
- Build the app `pnpm cloudflare`

- Serve with `WRANGLER_BUILD_CONDITIONS="" WRANGLER_BUILD_PLATFORM="node" pnpm wrangler dev`
2 changes: 1 addition & 1 deletion builder/package.json → packages/cloudflare/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"repository": {
"type": "git",
"url": "https://github.com/flarelabs-net/poc-next.git",
"directory": "builder"
"directory": "packages/cloudflare"
},
"keywords": [
"cloudflare",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
72 changes: 36 additions & 36 deletions pnpm-lock.yaml

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

2 changes: 1 addition & 1 deletion pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
packages:
- "builder"
- "packages/*"
- "examples/*"

catalog:
Expand Down

0 comments on commit b0beb62

Please sign in to comment.