fix: create: cloudflare starter wasn't creating a r2 bucket

This commit is contained in:
dswbx
2025-04-08 12:43:50 +02:00
parent a80a731498
commit 53467d6750
3 changed files with 44 additions and 35 deletions

2
app/.gitignore vendored
View File

@@ -1,4 +1,4 @@
playwright-report
test-results
bknd.config.*
app/__test__/helper.d.ts
__test__/helper.d.ts

View File

@@ -3,7 +3,7 @@
"type": "module",
"sideEffects": false,
"bin": "./dist/cli/index.js",
"version": "0.11.0-rc.5",
"version": "0.11.0-rc.6",
"description": "Lightweight Firebase/Supabase alternative built to run anywhere — incl. Next.js, React Router, Astro, Cloudflare, Bun, Node, AWS Lambda & more.",
"homepage": "https://bknd.io",
"repository": {

View File

@@ -29,7 +29,9 @@ export const cloudflare = {
{ dir: ctx.dir },
);
const db = ctx.skip ? "d1" : await $p.select({
const db = ctx.skip
? "d1"
: await $p.select({
message: "What database do you want to use?",
options: [
{ label: "Cloudflare D1", value: "d1" },
@@ -64,7 +66,9 @@ export const cloudflare = {
async function createD1(ctx: TemplateSetupCtx) {
const default_db = "data";
const name = ctx.skip ? default_db : await $p.text({
const name = ctx.skip
? default_db
: await $p.text({
message: "Enter database name",
initialValue: default_db,
placeholder: default_db,
@@ -153,13 +157,16 @@ async function createLibsql(ctx: TemplateSetupCtx) {
}
async function createR2(ctx: TemplateSetupCtx) {
const create = ctx.skip ?? await $p.confirm({
const create = ctx.skip
? false
: await $p.confirm({
message: "Do you want to use a R2 bucket?",
initialValue: true,
});
if ($p.isCancel(create)) {
process.exit(1);
}
if (!create) {
await overrideJson(
WRANGLER_FILE,
@@ -173,7 +180,9 @@ async function createR2(ctx: TemplateSetupCtx) {
}
const default_bucket = "bucket";
const name = ctx.skip ? default_bucket : await $p.text({
const name = ctx.skip
? default_bucket
: await $p.text({
message: "Enter bucket name",
initialValue: default_bucket,
placeholder: default_bucket,