feat: local debugging with wrangler
Signed-off-by: Tom Plant <tom@tplant.com.au>pull/5/head
parent
1e183247cf
commit
3b20472433
|
|
@ -36,3 +36,5 @@ next-env.d.ts
|
|||
|
||||
.terraform/
|
||||
terraform.tfstate*
|
||||
|
||||
/.wrangler
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
declare global {
|
||||
namespace NodeJS {
|
||||
interface ProcessEnv {
|
||||
UPTIMEFLARE_STATE: KVNamespace;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export {};
|
||||
|
|
@ -4,3 +4,15 @@ const nextConfig = {
|
|||
}
|
||||
|
||||
module.exports = nextConfig
|
||||
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
const { setupDevBindings } = require('@cloudflare/next-on-pages/next-dev')
|
||||
setupDevBindings({
|
||||
bindings: {
|
||||
UPTIMEFLARE_STATE: {
|
||||
type: 'kv',
|
||||
id: 'UPTIMEFLARE_STATE'
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -4,6 +4,7 @@
|
|||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"preview": "npx @cloudflare/next-on-pages && wrangler pages dev .vercel/output/static --compatibility-flag nodejs_compat --kv UPTIMEFLARE_STATE",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"lint": "next lint"
|
||||
|
|
@ -25,6 +26,7 @@
|
|||
"react-dom": "^18"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@cloudflare/next-on-pages": "^1.8.5",
|
||||
"@types/node": "^20",
|
||||
"@types/react": "^18",
|
||||
"@types/react-dom": "^18",
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@
|
|||
"incremental": true,
|
||||
"paths": {
|
||||
"@/*": ["./*"]
|
||||
}
|
||||
},
|
||||
"types": ["@cloudflare/workers-types"]
|
||||
},
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
|
||||
"exclude": ["node_modules", "worker/**/*.ts"]
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
"scripts": {
|
||||
"vercel-build": "next build",
|
||||
"deploy": "wrangler deploy",
|
||||
"dev": "wrangler dev",
|
||||
"dev": "wrangler dev --config wrangler-dev.toml --test-scheduled --persist-to ../.wrangler/state",
|
||||
"start": "wrangler dev"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
name = "uptimeflare_worker"
|
||||
main = "src/index.ts"
|
||||
compatibility_date = "2023-11-08"
|
||||
kv_namespaces = [{ binding = "UPTIMEFLARE_STATE", id = "UPTIMEFLARE_STATE" }]
|
||||
Loading…
Reference in New Issue