Skip to content

Commit

Permalink
move wrangler, rename cf_worker -> backend (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelcolvin authored Feb 6, 2025
1 parent 9c3d4c0 commit 185ed81
Show file tree
Hide file tree
Showing 13 changed files with 34 additions and 29 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
name: Test deploy
with:
command: deploy --dry-run
workingDirectory: src/backend

check:
if: always()
Expand Down Expand Up @@ -70,6 +71,7 @@ jobs:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
environment: previews
command: deploy --var GITHUB_SHA:${{ github.sha }}
workingDirectory: src/backend

- name: get preview URL
id: get_preview_url
Expand All @@ -95,3 +97,4 @@ jobs:
with:
apiToken: ${{ secrets.cloudflare_api_token }}
command: deploy --var GITHUB_SHA:${{ github.sha }}
workingDirectory: src/backend
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dist-ssr
*.local

# cloudflare
/.wrangler/
.wrangler/
.dev.vars

# Editor directories and files
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"typecheck": "npm run --workspaces typecheck",
"build": "npm run --workspace=frontend build",
"dev": "npm run --workspace=frontend dev",
"cf-typegen": "wrangler types src/cf_worker/worker-configuration.d.ts && prettier --write -- src/cf_worker/worker-configuration.d.ts",
"cf-dev": "wrangler dev"
"cf-typegen": "npm run --workspace=backend cf-typegen",
"dev-backend": "npm run --workspace=backend dev"
},
"prettier": {
"singleQuote": true,
Expand Down
14 changes: 14 additions & 0 deletions src/backend/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "backend",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"typecheck": "tsc --noEmit",
"cf-typegen": "wrangler types worker-configuration.d.ts && prettier --write -- worker-configuration.d.ts",
"dev": "wrangler dev"
},
"dependencies": {
"zod": "^3.24.1"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions src/backend/worker-configuration.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Generated by Wrangler by running `wrangler types worker-configuration.d.ts`

interface Env {
GITHUB_SHA: string
BUCKET: R2Bucket
ASSETS: Fetcher
}
8 changes: 4 additions & 4 deletions wrangler.toml → src/backend/wrangler.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
#:schema node_modules/wrangler/config-schema.json
name = "pydantic-run"
compatibility_date = "2025-01-09"
main = "src/cf_worker/src/index.ts"
main = "src/index.ts"
routes = ["pydantic.run/*"]
workers_dev = false

[build]
command = "npm run build"
watch_dir = ["src/frontend/src", "src/cf_worker/src"]
command = "cd ../frontend && npm run build"
watch_dir = ["../frontend/src", "src"]

[[r2_buckets]]
bucket_name = "pydantic-run"
binding = "BUCKET"

[assets]
directory = "src/frontend/dist"
directory = "../frontend/dist"
binding = "ASSETS"

[env.previews]
Expand Down
12 changes: 0 additions & 12 deletions src/cf_worker/package.json

This file was deleted.

7 changes: 0 additions & 7 deletions src/cf_worker/worker-configuration.d.ts

This file was deleted.

0 comments on commit 185ed81

Please sign in to comment.