diff --git a/.changeset/chilly-wings-shake.md b/.changeset/chilly-wings-shake.md new file mode 100644 index 0000000..1513d1e --- /dev/null +++ b/.changeset/chilly-wings-shake.md @@ -0,0 +1,5 @@ +--- +"create-better-t-stack": patch +--- + +Fixed an issue where the CLI would still allow selecting non-Convex backends after specifying `--api none` flag. diff --git a/apps/cli/src/index.ts b/apps/cli/src/index.ts index b0713e8..3a23e9a 100644 --- a/apps/cli/src/index.ts +++ b/apps/cli/src/index.ts @@ -244,6 +244,19 @@ function processAndValidateFlags( Object.keys(options).filter((key) => key !== "_" && key !== "$0"), ); + if (options.api) { + config.api = options.api as ProjectApi; + if (options.api === "none") { + if (options.backend && options.backend !== "convex") { + consola.fatal( + `'--api none' is only supported with '--backend convex'. Please choose a different API setting or use '--backend convex'.`, + ); + process.exit(1); + } + config.backend = "convex"; + } + } + if (options.backend) { config.backend = options.backend as ProjectBackend; } @@ -285,9 +298,6 @@ function processAndValidateFlags( if (options.runtime) { config.runtime = options.runtime as ProjectRuntime; } - if (options.api) { - config.api = options.api as ProjectApi; - } if (options.dbSetup) { config.dbSetup = options.dbSetup as ProjectDBSetup; }