Conversation
Template needs to stay multi-tenant — you can't commit D1/KV ids into a starter that other people also deploy. Instead: each deployer sets their binding ids as environment variables on their Worker project, and a small build-time script injects them into the adapter-generated dist/server/wrangler.json before wrangler deploy reads it. - scripts/patch-wrangler-config.mjs reads CF_D1_DATABASE_ID, CF_KV_SESSION_ID, CF_R2_BUCKET, CF_R2_PUBLIC_URL from env and writes them into d1_databases[].database_id / kv_namespaces[].id / r2_buckets[].bucket_name in dist/server/wrangler.json. Runs chained into build:cf so the output artifact is always deploy-ready. - build:cf now: 'DEPLOY_TARGET=cloudflare astro build && node scripts/patch-wrangler-config.mjs' - README Cloudflare section rewritten: explicit env var table + deploy-command guidance for the CF dashboard. Verified locally: CF_D1_DATABASE_ID=test-uuid CF_KV_SESSION_ID=test-kv bun run build:cf emits dist/server/wrangler.json with those ids patched in. Empty env vars → patch script warns + leaves placeholders in, so the failure mode is loud.
Three strict-null errors the monorepo root's tsconfig catches on CI but my local build didn't because the create package was still typecheck-clean against the older strict settings: - parseArgs: argv[i] is string | undefined under noUncheckedIndexedAccess. Added an early 'if (a === undefined) continue;' guard so the subsequent .startsWith() and equality checks see a narrowed string. - main: TEMPLATES[templateKey] is TemplateDef | undefined. Added an explicit error-out if the registry lookup misses (shouldn't happen in practice since --template is validated upstream and the prompts menu only offers registered keys, but closes the type hole and gives a clearer message than 'cannot read properties of undefined'). Verified: 'bun run --filter *' typecheck' clean across all three packages.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.