Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
35 changes: 35 additions & 0 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,38 @@ jobs:
- run: npm run build
- run: npx playwright install --with-deps chromium
- run: npm run test:e2e

# The suite above runs against the Vite dev server, which cannot see problems
# that only exist on the Workers runtime. Two such bugs shipped green during
# the migration: a missing nodejs_compat flag that throws at runtime rather
# than at build, and a prerendered feed served with the wrong content type.
# This job runs the same tests against workerd.
workers-runtime:
runs-on: ubuntu-latest
timeout-minutes: 15

steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version-file: .nvmrc
cache: npm
- run: npm ci
- run: npm run build
- run: npx playwright install --with-deps chromium
- name: Start workerd
run: npx wrangler dev --port 8788 --local &> /tmp/wrangler.log &
- name: Wait for it to serve
run: |
for i in $(seq 1 40); do
curl -sf -o /dev/null http://localhost:8788/ && exit 0
sleep 3
done
echo "workerd never became ready"; cat /tmp/wrangler.log; exit 1
- name: Fail on runtime compatibility warnings
run: |
if grep -qiE "wasn't found on the file system but is built into node" /tmp/wrangler.log; then
echo "Worker is missing a nodejs_compat import:"; grep -iE -A3 "built into node" /tmp/wrangler.log
exit 1
fi
- run: E2E_BASE_URL=http://localhost:8788 npm run test:e2e
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The local server runs at [localhost:3000](http://localhost:3000).
| Command | Purpose |
| ------------------ | ------------------------------------------- |
| `npm run dev` | Start the local server |
| `npm run build` | Create the Cloudflare Workers build |
| `npm run build` | Create the Cloudflare Workers build |
| `npm run preview` | Preview a production build |
| `npm run check` | Run formatting, lint, types, and unit tests |
| `npm run test:e2e` | Run the Playwright browser suite |
Expand Down
20 changes: 14 additions & 6 deletions wrangler.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,20 @@
// Worker throws at runtime rather than at build time.
"compatibility_flags": ["nodejs_compat"],
"main": ".svelte-kit/cloudflare/_worker.js",
// Keep the workers.dev hostname alive as a fallback that does not depend on
// the zone's DNS being correct.
"workers_dev": true,
// Custom domains; Cloudflare manages the DNS records for these itself.
"routes": [
{ "pattern": "cjdyas.design", "custom_domain": true },
{ "pattern": "www.cjdyas.design", "custom_domain": true },
],
"assets": {
"directory": ".svelte-kit/cloudflare",
"binding": "ASSETS"
"binding": "ASSETS",
},
"observability": {
"enabled": true
"enabled": true,
},
// Contact form abuse guard. The in-memory limiter this replaces kept its
// counter inside a single isolate, which does not survive on Workers.
Expand All @@ -23,8 +31,8 @@
"namespace_id": "1001",
"simple": {
"limit": 5,
"period": 60
}
}
]
"period": 60,
},
},
],
}
Loading