diff --git a/.gitignore b/.gitignore index 3b462cb..f966dec 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,8 @@ Thumbs.db # Vite vite.config.js.timestamp-* vite.config.ts.timestamp-* +# Cloudflare Types +/worker-configuration.d.ts + +.dev.vars* +!.dev.vars.example diff --git a/bun.lock b/bun.lock index 738338c..0532444 100644 --- a/bun.lock +++ b/bun.lock @@ -1,12 +1,13 @@ { "lockfileVersion": 1, - "configVersion": 1, "workspaces": { "": { "name": "quest", + "dependencies": { + "wrangler": "^4.69.0", + }, "devDependencies": { - "@sveltejs/adapter-auto": "^7.0.0", - "@sveltejs/adapter-cloudflare": "^7.2.8", + "@sveltejs/adapter-cloudflare": "^7.2.6", "@sveltejs/kit": "^2.50.2", "@sveltejs/vite-plugin-svelte": "^6.2.4", "@tailwindcss/forms": "^0.5.11", @@ -20,6 +21,7 @@ "tailwindcss": "^4.1.18", "typescript": "^5.9.3", "vite": "^7.3.1", + "wrangler": "^4.63.0", }, }, }, @@ -222,8 +224,6 @@ "@sveltejs/acorn-typescript": ["@sveltejs/acorn-typescript@1.0.9", "", { "peerDependencies": { "acorn": "^8.9.0" } }, "sha512-lVJX6qEgs/4DOcRTpo56tmKzVPtoWAaVbL4hfO7t7NVwl9AAXzQR6cihesW1BmNMPl+bK6dreu2sOKBP2Q9CIA=="], - "@sveltejs/adapter-auto": ["@sveltejs/adapter-auto@7.0.1", "", { "peerDependencies": { "@sveltejs/kit": "^2.0.0" } }, "sha512-dvuPm1E7M9NI/+canIQ6KKQDU2AkEefEZ2Dp7cY6uKoPq9Z/PhOXABe526UdW2mN986gjVkuSLkOYIBnS/M2LQ=="], - "@sveltejs/adapter-cloudflare": ["@sveltejs/adapter-cloudflare@7.2.8", "", { "dependencies": { "@cloudflare/workers-types": "^4.20250507.0", "worktop": "0.8.0-next.18" }, "peerDependencies": { "@sveltejs/kit": "^2.0.0", "wrangler": "^4.0.0" } }, "sha512-bIdhY/Fi4AQmqiBdQVKnafH1h9Gw+xbCvHyUu4EouC8rJOU02zwhi14k/FDhQ0mJF1iblIu3m8UNQ8GpGIvIOQ=="], "@sveltejs/kit": ["@sveltejs/kit@2.53.4", "", { "dependencies": { "@standard-schema/spec": "^1.0.0", "@sveltejs/acorn-typescript": "^1.0.5", "@types/cookie": "^0.6.0", "acorn": "^8.14.1", "cookie": "^0.6.0", "devalue": "^5.6.3", "esm-env": "^1.2.2", "kleur": "^4.1.5", "magic-string": "^0.30.5", "mrmime": "^2.0.0", "set-cookie-parser": "^3.0.0", "sirv": "^3.0.0" }, "peerDependencies": { "@opentelemetry/api": "^1.0.0", "@sveltejs/vite-plugin-svelte": "^3.0.0 || ^4.0.0-next.1 || ^5.0.0 || ^6.0.0-next.0 || ^7.0.0", "svelte": "^4.0.0 || ^5.0.0-next.0", "typescript": "^5.3.3", "vite": "^5.0.3 || ^6.0.0 || ^7.0.0-beta.0 || ^8.0.0" }, "optionalPeers": ["@opentelemetry/api", "typescript"], "bin": { "svelte-kit": "svelte-kit.js" } }, "sha512-iAIPEahFgDJJyvz8g0jP08KvqnM6JvdW8YfsygZ+pMeMvyM2zssWMltcsotETvjSZ82G3VlitgDtBIvpQSZrTA=="], diff --git a/package.json b/package.json index 798cfa5..1713e76 100644 --- a/package.json +++ b/package.json @@ -1,33 +1,39 @@ { - "name": "quest", - "private": true, - "version": "0.0.1", - "type": "module", - "scripts": { - "dev": "vite dev", - "build": "vite build", - "preview": "vite preview", - "prepare": "svelte-kit sync || echo ''", - "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", - "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", - "lint": "prettier --check .", - "format": "prettier --write ." - }, - "devDependencies": { - "@sveltejs/adapter-auto": "^7.0.0", - "@sveltejs/adapter-cloudflare": "^7.2.8", - "@sveltejs/kit": "^2.50.2", - "@sveltejs/vite-plugin-svelte": "^6.2.4", - "@tailwindcss/forms": "^0.5.11", - "@tailwindcss/typography": "^0.5.19", - "@tailwindcss/vite": "^4.1.18", - "prettier": "^3.8.1", - "prettier-plugin-svelte": "^3.4.1", - "prettier-plugin-tailwindcss": "^0.7.2", - "svelte": "^5.51.0", - "svelte-check": "^4.4.2", - "tailwindcss": "^4.1.18", - "typescript": "^5.9.3", - "vite": "^7.3.1" - } + "name": "quest", + "private": true, + "version": "0.0.1", + "type": "module", + "scripts": { + "dev": "vite dev", + "build": "vite build", + "preview": "bun run build && wrangler dev", + "prepare": "svelte-kit sync || echo ''", + "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", + "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", + "lint": "prettier --check .", + "format": "prettier --write .", + "gen": "wrangler types", + "deploy": "bun run build && wrangler deploy", + "cf-typegen": "wrangler types" + }, + "devDependencies": { + "@sveltejs/adapter-cloudflare": "^7.2.6", + "@sveltejs/kit": "^2.50.2", + "@sveltejs/vite-plugin-svelte": "^6.2.4", + "@tailwindcss/forms": "^0.5.11", + "@tailwindcss/typography": "^0.5.19", + "@tailwindcss/vite": "^4.1.18", + "prettier": "^3.8.1", + "prettier-plugin-svelte": "^3.4.1", + "prettier-plugin-tailwindcss": "^0.7.2", + "svelte": "^5.51.0", + "svelte-check": "^4.4.2", + "tailwindcss": "^4.1.18", + "typescript": "^5.9.3", + "vite": "^7.3.1", + "wrangler": "^4.63.0" + }, + "dependencies": { + "wrangler": "^4.69.0" + } } diff --git a/src/app.d.ts b/src/app.d.ts index da08e6d..ff06f1b 100644 --- a/src/app.d.ts +++ b/src/app.d.ts @@ -2,11 +2,17 @@ // for information about these interfaces declare global { namespace App { + interface Platform { + env: Env; + ctx: ExecutionContext; + caches: CacheStorage; + cf?: IncomingRequestCfProperties + } + // interface Error {} // interface Locals {} // interface PageData {} // interface PageState {} - // interface Platform {} } } diff --git a/static/.assetsignore b/static/.assetsignore new file mode 100644 index 0000000..1b006a0 --- /dev/null +++ b/static/.assetsignore @@ -0,0 +1,2 @@ +_worker.js +_routes.json \ No newline at end of file diff --git a/svelte.config.js b/svelte.config.js index 10c561b..d85b234 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -1,13 +1,6 @@ import adapter from '@sveltejs/adapter-cloudflare'; /** @type {import('@sveltejs/kit').Config} */ -const config = { - kit: { - // adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list. - // If your environment is not supported, or you settled on a specific environment, switch out the adapter. - // See https://svelte.dev/docs/kit/adapters for more information about adapters. - adapter: adapter() - } -}; +const config = { kit: { adapter: adapter() } }; export default config; diff --git a/tsconfig.json b/tsconfig.json index 2c2ed3c..333f768 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,11 +10,9 @@ "skipLibCheck": true, "sourceMap": true, "strict": true, - "moduleResolution": "bundler" + "moduleResolution": "bundler", + "types": [ + "./worker-configuration.d.ts" + ] } - // Path aliases are handled by https://svelte.dev/docs/kit/configuration#alias - // except $lib which is handled by https://svelte.dev/docs/kit/configuration#files - // - // To make changes to top-level options such as include and exclude, we recommend extending - // the generated config; see https://svelte.dev/docs/kit/configuration#typescript } diff --git a/wrangler.jsonc b/wrangler.jsonc new file mode 100644 index 0000000..c748452 --- /dev/null +++ b/wrangler.jsonc @@ -0,0 +1,18 @@ +{ + "$schema": "node_modules/wrangler/config-schema.json", + "name": "quest", + "compatibility_date": "2026-03-02", + "compatibility_flags": [ + "nodejs_compat" + ], + "main": ".svelte-kit/cloudflare/_worker.js", + "assets": { + "binding": "ASSETS", + "directory": ".svelte-kit/cloudflare" + }, + "workers_dev": true, + "preview_urls": true, + "observability": { + "enabled": true + } +}