create-better-t-stack 2.10.2 → 2.10.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -184,4 +184,4 @@ DATABASE_URL="your_connection_string"`)}async function ze(n){let{projectName:r,p
184
184
  ╔══════════════════╗
185
185
  ║ Better T-Stack ║
186
186
  ╚══════════════════╝
187
- `;console.log(T(Object.values(Pt)).multiline(e))}else console.log(T(Object.values(Pt)).multiline($))},It=()=>process.exit(0);process.on(`SIGINT`,It),process.on(`SIGTERM`,It);async function Lt(){let n=Date.now();try{let r=await _(v(process.argv)).scriptName(`create-better-t-stack`).usage(`$0 [project-directory] [options]`,`Create a new Better-T Stack project`).positional(`project-directory`,{describe:`Project name/directory`,type:`string`}).option(`yes`,{alias:`y`,type:`boolean`,describe:`Use default configuration and skip prompts`,default:!1}).option(`database`,{type:`string`,describe:`Database type`,choices:[`none`,`sqlite`,`postgres`,`mysql`,`mongodb`]}).option(`orm`,{type:`string`,describe:`ORM type`,choices:[`drizzle`,`prisma`,`mongoose`,`none`]}).option(`auth`,{type:`boolean`,describe:`Include authentication (use --no-auth to exclude)`}).option(`frontend`,{type:`array`,string:!0,describe:`Frontend types`,choices:[`tanstack-router`,`react-router`,`tanstack-start`,`next`,`nuxt`,`native-nativewind`,`native-unistyles`,`svelte`,`solid`,`none`]}).option(`addons`,{type:`array`,string:!0,describe:`Additional addons`,choices:[`pwa`,`tauri`,`starlight`,`biome`,`husky`,`turborepo`,`none`]}).option(`examples`,{type:`array`,string:!0,describe:`Examples to include`,choices:[`todo`,`ai`,`none`]}).option(`git`,{type:`boolean`,describe:`Initialize git repository (use --no-git to skip)`}).option(`package-manager`,{alias:`pm`,type:`string`,describe:`Package manager`,choices:[`npm`,`pnpm`,`bun`]}).option(`install`,{type:`boolean`,describe:`Install dependencies (use --no-install to skip)`}).option(`db-setup`,{type:`string`,describe:`Database setup`,choices:[`turso`,`neon`,`prisma-postgres`,`mongodb-atlas`,`supabase`,`none`]}).option(`backend`,{type:`string`,describe:`Backend framework`,choices:[`hono`,`express`,`next`,`elysia`,`convex`,`none`]}).option(`runtime`,{type:`string`,describe:`Runtime`,choices:[`bun`,`node`,`none`]}).option(`api`,{type:`string`,describe:`API type`,choices:[`trpc`,`orpc`,`none`]}).completion().recommendCommands().version(Nt()).alias(`version`,`v`).help().alias(`help`,`h`).strict().wrap(null).parse(),s=r,l=s.projectDirectory;Ft(),i(g.magenta(`Creating a new Better-T-Stack project`));let f,p,y,b,x=!1;if(s.yes&&l)f=l;else if(s.yes){let t=A.relativePath,n=1;for(;h.pathExistsSync(e.resolve(process.cwd(),t))&&h.readdirSync(e.resolve(process.cwd(),t)).length>0;)t=`${A.projectName}-${n}`,n++;f=t}else f=await Z(l);for(;;){let n=e.resolve(process.cwd(),f),r=h.pathExistsSync(n),i=r&&h.readdirSync(n).length>0;if(!i){p=f,x=!1;break}o.warn(`Directory "${g.yellow(f)}" already exists and is not empty.`);let s=await u({message:`What would you like to do?`,options:[{value:`overwrite`,label:`Overwrite`,hint:`Empty the directory and create the project`},{value:`merge`,label:`Merge`,hint:`Create project files inside, potentially overwriting conflicts`},{value:`rename`,label:`Choose a different name/path`,hint:`Keep the existing directory and create a new one`},{value:`cancel`,label:`Cancel`,hint:`Abort the process`}],initialValue:`rename`});if(a(s)&&(t(g.red(`Operation cancelled.`)),process.exit(0)),s===`overwrite`){p=f,x=!0;break}if(s===`merge`){p=f,x=!1,o.info(`Proceeding into existing directory "${g.yellow(f)}". Files may be overwritten.`);break}s===`rename`?(o.info(`Please choose a different project name or path.`),f=await Z(void 0)):s===`cancel`&&(t(g.red(`Operation cancelled.`)),process.exit(0))}if(p===`.`?(y=process.cwd(),b=e.basename(y)):(y=e.resolve(process.cwd(),p),b=e.basename(y)),x){let e=d();e.start(`Clearing directory "${y}"...`);try{await h.emptyDir(y),e.stop(`Directory "${y}" cleared.`)}catch(t){e.stop(g.red(`Failed to clear directory "${y}".`)),m.error(t),process.exit(1)}}else await h.ensureDir(y);let S=Rt(s,b),{projectName:C,...w}=S;!s.yes&&Object.keys(w).length>0&&(o.info(g.yellow(`Using these pre-selected options:`)),o.message(Q(w)),o.message(``));let T;s.yes?(T={...A,...S,projectName:b,projectDir:y,relativePath:p},T.backend===`convex`?(T.auth=!1,T.database=`none`,T.orm=`none`,T.api=`none`,T.runtime=`none`,T.dbSetup=`none`,T.examples=[`todo`],o.info(`Due to '--backend convex' flag, the following options have been automatically set: auth=false, database=none, orm=none, api=none, runtime=none, dbSetup=none, examples=todo`)):T.backend===`none`?(T.auth=!1,T.database=`none`,T.orm=`none`,T.api=`none`,T.runtime=`none`,T.dbSetup=`none`,T.examples=[],o.info(`Due to '--backend none', the following options have been automatically set: --auth=false, --database=none, --orm=none, --api=none, --runtime=none, --db-setup=none, --examples=none`)):T.database===`none`&&(T.orm=`none`,o.info(`Due to '--database none', '--orm' has been automatically set to 'none'.`),T.auth=!1,o.info(`Due to '--database none', '--auth' has been automatically set to 'false'.`),T.dbSetup=`none`,o.info(`Due to '--database none', '--db-setup' has been automatically set to 'none'.`)),o.info(g.yellow(`Using default/flag options (config prompts skipped):`)),o.message(Q(T)),o.message(``)):T=await At(S,b,y,p),await gt(T),o.success(g.blue(`You can reproduce this setup with the following command:\n${Mt(T)}`));let E=((Date.now()-n)/1e3).toFixed(2);c(g.magenta(`Project created successfully in ${g.bold(E)} seconds!`))}catch(e){e instanceof Error?(e.name===`YError`?t(g.red(`Invalid arguments: ${e.message}`)):(m.error(`An unexpected error occurred: ${e.message}`),e.message.includes(`is only supported with`)||m.error(e.stack)),process.exit(1)):(m.error(`An unexpected error occurred.`),console.error(e),process.exit(1))}}function Rt(t,n){let r={},i=new Set(Object.keys(t).filter(e=>e!==`_`&&e!==`$0`));if(t.api&&(r.api=t.api,t.api===`none`&&t.examples&&!(t.examples.length===1&&t.examples[0]===`none`)&&(m.fatal(`Cannot use '--examples' when '--api' is set to 'none'. Please remove the --examples flag or choose an API type.`),process.exit(1))),t.backend&&(r.backend=t.backend),i.has(`backend`)&&r.backend&&r.backend!==`convex`&&r.backend!==`none`&&i.has(`runtime`)&&t.runtime===`none`&&(m.fatal(`'--runtime none' is only supported with '--backend convex' or '--backend none'. Please choose 'bun', 'node', or remove the --runtime flag.`),process.exit(1)),t.database&&(r.database=t.database),t.orm&&(r.orm=t.orm),t.auth!==void 0&&(r.auth=t.auth),t.git!==void 0&&(r.git=t.git),t.install!==void 0&&(r.install=t.install),t.runtime&&(r.runtime=t.runtime),t.dbSetup&&(r.dbSetup=t.dbSetup),t.packageManager&&(r.packageManager=t.packageManager),n?r.projectName=n:t.projectDirectory&&(r.projectName=e.basename(e.resolve(process.cwd(),t.projectDirectory))),t.frontend&&t.frontend.length>0)if(t.frontend.includes(`none`))t.frontend.length>1&&(m.fatal(`Cannot combine 'none' with other frontend options.`),process.exit(1)),r.frontend=[];else{let e=t.frontend.filter(e=>e!==`none`),n=e.filter(e=>e===`tanstack-router`||e===`react-router`||e===`tanstack-start`||e===`next`||e===`nuxt`||e===`svelte`||e===`solid`),i=e.filter(e=>e===`native-nativewind`||e===`native-unistyles`);n.length>1&&(m.fatal(`Cannot select multiple web frameworks. Choose only one of: tanstack-router, tanstack-start, react-router, next, nuxt, svelte, solid`),process.exit(1)),i.length>1&&(m.fatal(`Cannot select multiple native frameworks. Choose only one of: native-nativewind, native-unistyles`),process.exit(1)),r.frontend=e}if(t.addons&&t.addons.length>0&&(t.addons.includes(`none`)?(t.addons.length>1&&(m.fatal(`Cannot combine 'none' with other addons.`),process.exit(1)),r.addons=[]):r.addons=t.addons.filter(e=>e!==`none`)),t.examples&&t.examples.length>0&&(t.examples.includes(`none`)?(t.examples.length>1&&(m.fatal(`Cannot combine 'none' with other examples.`),process.exit(1)),r.examples=[]):(r.examples=t.examples.filter(e=>e!==`none`),t.examples.includes(`none`)&&r.backend!==`convex`&&(r.examples=[]))),r.backend===`convex`){let e=[];if(i.has(`auth`)&&t.auth===!0&&e.push(`--auth`),i.has(`database`)&&t.database!==`none`&&e.push(`--database ${t.database}`),i.has(`orm`)&&t.orm!==`none`&&e.push(`--orm ${t.orm}`),i.has(`api`)&&t.api!==`none`&&e.push(`--api ${t.api}`),i.has(`runtime`)&&t.runtime!==`none`&&e.push(`--runtime ${t.runtime}`),i.has(`dbSetup`)&&t.dbSetup!==`none`&&e.push(`--db-setup ${t.dbSetup}`),e.length>0&&(m.fatal(`The following flags are incompatible with '--backend convex': ${e.join(`, `)}. Please remove them.`),process.exit(1)),i.has(`frontend`)&&t.frontend){let e=t.frontend.filter(e=>e===`nuxt`||e===`solid`);e.length>0&&(m.fatal(`The following frontends are not compatible with '--backend convex': ${e.join(`, `)}. Please choose a different frontend or backend.`),process.exit(1))}r.auth=!1,r.database=`none`,r.orm=`none`,r.api=`none`,r.runtime=`none`,r.dbSetup=`none`,r.examples=[`todo`]}else if(r.backend===`none`){let e=[];i.has(`auth`)&&t.auth===!0&&e.push(`--auth`),i.has(`database`)&&t.database!==`none`&&e.push(`--database ${t.database}`),i.has(`orm`)&&t.orm!==`none`&&e.push(`--orm ${t.orm}`),i.has(`api`)&&t.api!==`none`&&e.push(`--api ${t.api}`),i.has(`runtime`)&&t.runtime!==`none`&&e.push(`--runtime ${t.runtime}`),i.has(`dbSetup`)&&t.dbSetup!==`none`&&e.push(`--db-setup ${t.dbSetup}`),e.length>0&&(m.fatal(`The following flags are incompatible with '--backend none': ${e.join(`, `)}. Please remove them.`),process.exit(1)),r.auth=!1,r.database=`none`,r.orm=`none`,r.api=`none`,r.runtime=`none`,r.dbSetup=`none`,t.examples&&!t.examples.includes(`none`)&&t.examples.length>0&&(m.fatal(`Cannot select examples when backend is 'none'. Please remove the --examples flag or set --examples none.`),process.exit(1)),r.examples=[],o.info(`Due to '--backend none', the following options have been automatically set: --auth=false, --database=none, --orm=none, --api=none, --runtime=none, --db-setup=none, --examples=none`)}else{let e=r.database??(t.yes?A.database:void 0),n=r.orm??(t.yes?A.orm:void 0),a=r.auth??(t.yes?A.auth:void 0),s=r.dbSetup??(t.yes?A.dbSetup:void 0),c=r.examples??(t.yes?A.examples:void 0),l=r.frontend??(t.yes?A.frontend:void 0),u=r.api??(t.yes?A.api:void 0),d=r.backend??(t.yes?A.backend:void 0);if(e===`none`&&(i.has(`orm`)&&t.orm!==`none`&&(m.fatal(`Cannot use ORM '--orm ${t.orm}' when database is 'none'.`),process.exit(1)),r.orm=`none`,o.info(`Due to '--database none', '--orm' has been automatically set to 'none'.`),i.has(`auth`)&&t.auth===!0&&(m.fatal(`Authentication requires a database. Cannot use --auth when database is 'none'.`),process.exit(1)),r.auth=!1,o.info(`Due to '--database none', '--auth' has been automatically set to 'false'.`),i.has(`dbSetup`)&&t.dbSetup!==`none`&&(m.fatal(`Database setup '--db-setup ${t.dbSetup}' requires a database. Cannot use when database is 'none'.`),process.exit(1)),r.dbSetup=`none`,o.info(`Due to '--database none', '--db-setup' has been automatically set to 'none'.`)),r.orm===`mongoose`&&!i.has(`database`)&&(e&&e!==`mongodb`&&(m.fatal(`Mongoose ORM requires MongoDB. Cannot use --orm mongoose with --database ${e}.`),process.exit(1)),r.database=`mongodb`),e===`mongodb`&&n===`drizzle`&&(m.fatal(`Drizzle ORM is not compatible with MongoDB. Please use --orm prisma or --orm mongoose.`),process.exit(1)),n===`mongoose`&&e&&e!==`mongodb`&&(m.fatal(`Mongoose ORM requires MongoDB. Cannot use --orm mongoose with --database ${e}.`),process.exit(1)),r.dbSetup&&r.dbSetup!==`none`){let t=r.dbSetup;(!e||e===`none`)&&(m.fatal(`Database setup '--db-setup ${t}' requires a database. Cannot use when database is 'none'.`),process.exit(1)),t===`turso`?(e&&e!==`sqlite`&&(m.fatal(`Turso setup requires SQLite. Cannot use --db-setup turso with --database ${e}`),process.exit(1)),n!==`drizzle`&&(m.fatal(`Turso setup requires Drizzle ORM. Cannot use --db-setup turso with --orm ${n??`none`}.`),process.exit(1))):t===`supabase`?e!==`postgres`&&(m.fatal(`Supabase setup requires PostgreSQL. Cannot use --db-setup supabase with --database ${e}.`),process.exit(1)):t===`prisma-postgres`?(e!==`postgres`&&(m.fatal(`Prisma PostgreSQL setup requires PostgreSQL. Cannot use --db-setup prisma-postgres with --database ${e}.`),process.exit(1)),n!==`prisma`&&(m.fatal(`Prisma PostgreSQL setup requires Prisma ORM. Cannot use --db-setup prisma-postgres with --orm ${n}.`),process.exit(1))):t===`mongodb-atlas`?(e!==`mongodb`&&(m.fatal(`MongoDB Atlas setup requires MongoDB. Cannot use --db-setup mongodb-atlas with --database ${e}.`),process.exit(1)),n!==`prisma`&&n!==`mongoose`&&(m.fatal(`MongoDB Atlas setup requires Prisma or Mongoose ORM. Cannot use --db-setup mongodb-atlas with --orm ${n}.`),process.exit(1))):t===`neon`&&e!==`postgres`&&(m.fatal(`Neon PostgreSQL setup requires PostgreSQL. Cannot use --db-setup neon with --database ${e}.`),process.exit(1))}let f=l?.includes(`nuxt`),p=l?.includes(`svelte`),h=l?.includes(`solid`);if((f||p||h)&&u===`trpc`&&(m.fatal(`tRPC API is not supported with '${f?`nuxt`:p?`svelte`:`solid`}' frontend. Please use --api orpc or --api none or remove '${f?`nuxt`:p?`svelte`:`solid`}' from --frontend.`),process.exit(1)),r.addons&&r.addons.length>0){let e=[`pwa`,`tauri`],t=r.addons.some(t=>e.includes(t)),n=l?.some(e=>{let t=e===`tanstack-router`||e===`react-router`||e===`solid`,n=e===`tanstack-router`||e===`react-router`||e===`nuxt`||e===`svelte`||e===`solid`||e===`next`;return r.addons?.includes(`pwa`)&&r.addons?.includes(`tauri`)?t&&n:r.addons?.includes(`pwa`)?t:r.addons?.includes(`tauri`)?n:!0});if(t&&!n){let e=`Selected frontend is not compatible.`;r.addons.includes(`pwa`)&&(e=`PWA requires tanstack-router, react-router, or solid.`),r.addons.includes(`tauri`)&&(e=`Tauri requires tanstack-router, react-router, nuxt, svelte, solid, or next.`),m.fatal(`Incompatible addon/frontend combination: ${e}`),process.exit(1)}r.addons.includes(`husky`)&&!r.addons.includes(`biome`)&&m.warn(`Husky addon is recommended to be used with Biome for lint-staged configuration.`),r.addons=[...new Set(r.addons)]}let g=l&&l.length===1&&(l[0]===`native-nativewind`||l[0]===`native-unistyles`);g&&r.examples&&r.examples.length>0&&!r.examples.includes(`none`)&&(m.fatal(`Examples are not supported when only a native frontend (NativeWind or Unistyles) is selected.`),process.exit(1)),r.examples&&r.examples.length>0&&!r.examples.includes(`none`)&&(r.examples.includes(`todo`)&&d!==`convex`&&d!==`none`&&e===`none`&&(m.fatal(`The 'todo' example requires a database if a backend (other than Convex) is present. Cannot use --examples todo when database is 'none' and a backend is selected.`),process.exit(1)),r.examples.includes(`ai`)&&d===`elysia`&&(m.fatal(`The 'ai' example is not compatible with the Elysia backend.`),process.exit(1)),r.examples.includes(`ai`)&&h&&(m.fatal(`The 'ai' example is not compatible with the Solid frontend.`),process.exit(1)))}return r}Lt().catch(e=>{m.error(`Aborting installation due to unexpected error...`),e instanceof Error?!e.message.includes(`is only supported with`)&&!e.message.includes(`incompatible with`)&&!e.message.includes(`requires`)&&!e.message.includes(`Cannot use`)&&!e.message.includes(`Cannot select multiple`)&&!e.message.includes(`Cannot combine`)&&!e.message.includes(`not supported`)&&(m.error(e.message),m.error(e.stack)):console.error(e),process.exit(1)});
187
+ `;console.log(T(Object.values(Pt)).multiline(e))}else console.log(T(Object.values(Pt)).multiline($))},It=()=>process.exit(0);process.on(`SIGINT`,It),process.on(`SIGTERM`,It);async function Lt(){let n=Date.now();try{let r=await _(v(process.argv)).scriptName(`create-better-t-stack`).usage(`$0 [project-directory] [options]`,`Create a new Better-T Stack project`).positional(`project-directory`,{describe:`Project name/directory`,type:`string`}).option(`yes`,{alias:`y`,type:`boolean`,describe:`Use default configuration and skip prompts`,default:!1}).option(`database`,{type:`string`,describe:`Database type`,choices:[`none`,`sqlite`,`postgres`,`mysql`,`mongodb`]}).option(`orm`,{type:`string`,describe:`ORM type`,choices:[`drizzle`,`prisma`,`mongoose`,`none`]}).option(`auth`,{type:`boolean`,describe:`Include authentication (use --no-auth to exclude)`}).option(`frontend`,{type:`array`,string:!0,describe:`Frontend types`,choices:[`tanstack-router`,`react-router`,`tanstack-start`,`next`,`nuxt`,`native-nativewind`,`native-unistyles`,`svelte`,`solid`,`none`]}).option(`addons`,{type:`array`,string:!0,describe:`Additional addons`,choices:[`pwa`,`tauri`,`starlight`,`biome`,`husky`,`turborepo`,`none`]}).option(`examples`,{type:`array`,string:!0,describe:`Examples to include`,choices:[`todo`,`ai`,`none`]}).option(`git`,{type:`boolean`,describe:`Initialize git repository (use --no-git to skip)`}).option(`package-manager`,{alias:`pm`,type:`string`,describe:`Package manager`,choices:[`npm`,`pnpm`,`bun`]}).option(`install`,{type:`boolean`,describe:`Install dependencies (use --no-install to skip)`}).option(`db-setup`,{type:`string`,describe:`Database setup`,choices:[`turso`,`neon`,`prisma-postgres`,`mongodb-atlas`,`supabase`,`none`]}).option(`backend`,{type:`string`,describe:`Backend framework`,choices:[`hono`,`express`,`next`,`elysia`,`convex`,`none`]}).option(`runtime`,{type:`string`,describe:`Runtime`,choices:[`bun`,`node`,`none`]}).option(`api`,{type:`string`,describe:`API type`,choices:[`trpc`,`orpc`,`none`]}).completion().recommendCommands().version(Nt()).alias(`version`,`v`).help().alias(`help`,`h`).strict().wrap(null).parse(),s=r,l=s.projectDirectory;Ft(),i(g.magenta(`Creating a new Better-T-Stack project`));let f,p,y,b,x=!1;if(s.yes&&l)f=l;else if(s.yes){let t=A.relativePath,n=1;for(;h.pathExistsSync(e.resolve(process.cwd(),t))&&h.readdirSync(e.resolve(process.cwd(),t)).length>0;)t=`${A.projectName}-${n}`,n++;f=t}else f=await Z(l);for(;;){let n=e.resolve(process.cwd(),f),r=h.pathExistsSync(n),i=r&&h.readdirSync(n).length>0;if(!i){p=f,x=!1;break}o.warn(`Directory "${g.yellow(f)}" already exists and is not empty.`);let s=await u({message:`What would you like to do?`,options:[{value:`overwrite`,label:`Overwrite`,hint:`Empty the directory and create the project`},{value:`merge`,label:`Merge`,hint:`Create project files inside, potentially overwriting conflicts`},{value:`rename`,label:`Choose a different name/path`,hint:`Keep the existing directory and create a new one`},{value:`cancel`,label:`Cancel`,hint:`Abort the process`}],initialValue:`rename`});if(a(s)&&(t(g.red(`Operation cancelled.`)),process.exit(0)),s===`overwrite`){p=f,x=!0;break}if(s===`merge`){p=f,x=!1,o.info(`Proceeding into existing directory "${g.yellow(f)}". Files may be overwritten.`);break}s===`rename`?(o.info(`Please choose a different project name or path.`),f=await Z(void 0)):s===`cancel`&&(t(g.red(`Operation cancelled.`)),process.exit(0))}if(p===`.`?(y=process.cwd(),b=e.basename(y)):(y=e.resolve(process.cwd(),p),b=e.basename(y)),x){let e=d();e.start(`Clearing directory "${y}"...`);try{await h.emptyDir(y),e.stop(`Directory "${y}" cleared.`)}catch(t){e.stop(g.red(`Failed to clear directory "${y}".`)),m.error(t),process.exit(1)}}else await h.ensureDir(y);let S=Rt(s,b),{projectName:C,...w}=S;!s.yes&&Object.keys(w).length>0&&(o.info(g.yellow(`Using these pre-selected options:`)),o.message(Q(w)),o.message(``));let T;s.yes?(T={...A,...S,projectName:b,projectDir:y,relativePath:p},T.backend===`convex`?(T.auth=!1,T.database=`none`,T.orm=`none`,T.api=`none`,T.runtime=`none`,T.dbSetup=`none`,T.examples=[`todo`],o.info(`Due to '--backend convex' flag, the following options have been automatically set: auth=false, database=none, orm=none, api=none, runtime=none, dbSetup=none, examples=todo`)):T.backend===`none`?(T.auth=!1,T.database=`none`,T.orm=`none`,T.api=`none`,T.runtime=`none`,T.dbSetup=`none`,T.examples=[],o.info(`Due to '--backend none', the following options have been automatically set: --auth=false, --database=none, --orm=none, --api=none, --runtime=none, --db-setup=none, --examples=none`)):T.database===`none`&&(T.orm=`none`,o.info(`Due to '--database none', '--orm' has been automatically set to 'none'.`),T.auth=!1,o.info(`Due to '--database none', '--auth' has been automatically set to 'false'.`),T.dbSetup=`none`,o.info(`Due to '--database none', '--db-setup' has been automatically set to 'none'.`)),o.info(g.yellow(`Using default/flag options (config prompts skipped):`)),o.message(Q(T)),o.message(``)):T=await At(S,b,y,p),await gt(T),o.success(g.blue(`You can reproduce this setup with the following command:\n${Mt(T)}`));let E=((Date.now()-n)/1e3).toFixed(2);c(g.magenta(`Project created successfully in ${g.bold(E)} seconds!`))}catch(e){e instanceof Error?(e.name===`YError`?t(g.red(`Invalid arguments: ${e.message}`)):(m.error(`An unexpected error occurred: ${e.message}`),e.message.includes(`is only supported with`)||m.error(e.stack)),process.exit(1)):(m.error(`An unexpected error occurred.`),console.error(e),process.exit(1))}}function Rt(t,n){let r={},i=new Set(Object.keys(t).filter(e=>e!==`_`&&e!==`$0`));if(t.api&&(r.api=t.api,t.api===`none`&&t.examples&&!(t.examples.length===1&&t.examples[0]===`none`)&&(m.fatal(`Cannot use '--examples' when '--api' is set to 'none'. Please remove the --examples flag or choose an API type.`),process.exit(1))),t.backend&&(r.backend=t.backend),i.has(`backend`)&&r.backend&&r.backend!==`convex`&&r.backend!==`none`&&i.has(`runtime`)&&t.runtime===`none`&&(m.fatal(`'--runtime none' is only supported with '--backend convex' or '--backend none'. Please choose 'bun', 'node', or remove the --runtime flag.`),process.exit(1)),t.database&&(r.database=t.database),t.orm&&(r.orm=t.orm),t.auth!==void 0&&(r.auth=t.auth),t.git!==void 0&&(r.git=t.git),t.install!==void 0&&(r.install=t.install),t.runtime&&(r.runtime=t.runtime),t.dbSetup&&(r.dbSetup=t.dbSetup),t.packageManager&&(r.packageManager=t.packageManager),n?r.projectName=n:t.projectDirectory&&(r.projectName=e.basename(e.resolve(process.cwd(),t.projectDirectory))),t.frontend&&t.frontend.length>0)if(t.frontend.includes(`none`))t.frontend.length>1&&(m.fatal(`Cannot combine 'none' with other frontend options.`),process.exit(1)),r.frontend=[];else{let e=t.frontend.filter(e=>e!==`none`),n=e.filter(e=>e===`tanstack-router`||e===`react-router`||e===`tanstack-start`||e===`next`||e===`nuxt`||e===`svelte`||e===`solid`),i=e.filter(e=>e===`native-nativewind`||e===`native-unistyles`);n.length>1&&(m.fatal(`Cannot select multiple web frameworks. Choose only one of: tanstack-router, tanstack-start, react-router, next, nuxt, svelte, solid`),process.exit(1)),i.length>1&&(m.fatal(`Cannot select multiple native frameworks. Choose only one of: native-nativewind, native-unistyles`),process.exit(1)),r.frontend=e}if(t.addons&&t.addons.length>0&&(t.addons.includes(`none`)?(t.addons.length>1&&(m.fatal(`Cannot combine 'none' with other addons.`),process.exit(1)),r.addons=[]):r.addons=t.addons.filter(e=>e!==`none`)),t.examples&&t.examples.length>0&&(t.examples.includes(`none`)?(t.examples.length>1&&(m.fatal(`Cannot combine 'none' with other examples.`),process.exit(1)),r.examples=[]):(r.examples=t.examples.filter(e=>e!==`none`),t.examples.includes(`none`)&&r.backend!==`convex`&&(r.examples=[]))),r.backend===`convex`){let e=[];if(i.has(`auth`)&&t.auth===!0&&e.push(`--auth`),i.has(`database`)&&t.database!==`none`&&e.push(`--database ${t.database}`),i.has(`orm`)&&t.orm!==`none`&&e.push(`--orm ${t.orm}`),i.has(`api`)&&t.api!==`none`&&e.push(`--api ${t.api}`),i.has(`runtime`)&&t.runtime!==`none`&&e.push(`--runtime ${t.runtime}`),i.has(`dbSetup`)&&t.dbSetup!==`none`&&e.push(`--db-setup ${t.dbSetup}`),e.length>0&&(m.fatal(`The following flags are incompatible with '--backend convex': ${e.join(`, `)}. Please remove them.`),process.exit(1)),i.has(`frontend`)&&t.frontend){let e=t.frontend.filter(e=>e===`nuxt`||e===`solid`);e.length>0&&(m.fatal(`The following frontends are not compatible with '--backend convex': ${e.join(`, `)}. Please choose a different frontend or backend.`),process.exit(1))}r.auth=!1,r.database=`none`,r.orm=`none`,r.api=`none`,r.runtime=`none`,r.dbSetup=`none`,r.examples=[`todo`]}else if(r.backend===`none`){let e=[];i.has(`auth`)&&t.auth===!0&&e.push(`--auth`),i.has(`database`)&&t.database!==`none`&&e.push(`--database ${t.database}`),i.has(`orm`)&&t.orm!==`none`&&e.push(`--orm ${t.orm}`),i.has(`api`)&&t.api!==`none`&&e.push(`--api ${t.api}`),i.has(`runtime`)&&t.runtime!==`none`&&e.push(`--runtime ${t.runtime}`),i.has(`dbSetup`)&&t.dbSetup!==`none`&&e.push(`--db-setup ${t.dbSetup}`),e.length>0&&(m.fatal(`The following flags are incompatible with '--backend none': ${e.join(`, `)}. Please remove them.`),process.exit(1)),r.auth=!1,r.database=`none`,r.orm=`none`,r.api=`none`,r.runtime=`none`,r.dbSetup=`none`,t.examples&&!t.examples.includes(`none`)&&t.examples.length>0&&(m.fatal(`Cannot select examples when backend is 'none'. Please remove the --examples flag or set --examples none.`),process.exit(1)),r.examples=[]}else{let e=r.database??(t.yes?A.database:void 0),n=r.orm??(t.yes?A.orm:void 0),a=r.auth??(t.yes?A.auth:void 0),s=r.dbSetup??(t.yes?A.dbSetup:void 0),c=r.examples??(t.yes?A.examples:void 0),l=r.frontend??(t.yes?A.frontend:void 0),u=r.api??(t.yes?A.api:void 0),d=r.backend??(t.yes?A.backend:void 0);if(e===`none`&&(i.has(`orm`)&&t.orm!==`none`&&(m.fatal(`Cannot use ORM '--orm ${t.orm}' when database is 'none'.`),process.exit(1)),r.orm=`none`,o.info(`Due to '--database none', '--orm' has been automatically set to 'none'.`),i.has(`auth`)&&t.auth===!0&&(m.fatal(`Authentication requires a database. Cannot use --auth when database is 'none'.`),process.exit(1)),r.auth=!1,o.info(`Due to '--database none', '--auth' has been automatically set to 'false'.`),i.has(`dbSetup`)&&t.dbSetup!==`none`&&(m.fatal(`Database setup '--db-setup ${t.dbSetup}' requires a database. Cannot use when database is 'none'.`),process.exit(1)),r.dbSetup=`none`,o.info(`Due to '--database none', '--db-setup' has been automatically set to 'none'.`)),r.orm===`mongoose`&&!i.has(`database`)&&(e&&e!==`mongodb`&&(m.fatal(`Mongoose ORM requires MongoDB. Cannot use --orm mongoose with --database ${e}.`),process.exit(1)),r.database=`mongodb`),e===`mongodb`&&n===`drizzle`&&(m.fatal(`Drizzle ORM is not compatible with MongoDB. Please use --orm prisma or --orm mongoose.`),process.exit(1)),n===`mongoose`&&e&&e!==`mongodb`&&(m.fatal(`Mongoose ORM requires MongoDB. Cannot use --orm mongoose with --database ${e}.`),process.exit(1)),r.dbSetup&&r.dbSetup!==`none`){let t=r.dbSetup;(!e||e===`none`)&&(m.fatal(`Database setup '--db-setup ${t}' requires a database. Cannot use when database is 'none'.`),process.exit(1)),t===`turso`?(e&&e!==`sqlite`&&(m.fatal(`Turso setup requires SQLite. Cannot use --db-setup turso with --database ${e}`),process.exit(1)),n!==`drizzle`&&(m.fatal(`Turso setup requires Drizzle ORM. Cannot use --db-setup turso with --orm ${n??`none`}.`),process.exit(1))):t===`supabase`?e!==`postgres`&&(m.fatal(`Supabase setup requires PostgreSQL. Cannot use --db-setup supabase with --database ${e}.`),process.exit(1)):t===`prisma-postgres`?(e!==`postgres`&&(m.fatal(`Prisma PostgreSQL setup requires PostgreSQL. Cannot use --db-setup prisma-postgres with --database ${e}.`),process.exit(1)),n!==`prisma`&&(m.fatal(`Prisma PostgreSQL setup requires Prisma ORM. Cannot use --db-setup prisma-postgres with --orm ${n}.`),process.exit(1))):t===`mongodb-atlas`?(e!==`mongodb`&&(m.fatal(`MongoDB Atlas setup requires MongoDB. Cannot use --db-setup mongodb-atlas with --database ${e}.`),process.exit(1)),n!==`prisma`&&n!==`mongoose`&&(m.fatal(`MongoDB Atlas setup requires Prisma or Mongoose ORM. Cannot use --db-setup mongodb-atlas with --orm ${n}.`),process.exit(1))):t===`neon`&&e!==`postgres`&&(m.fatal(`Neon PostgreSQL setup requires PostgreSQL. Cannot use --db-setup neon with --database ${e}.`),process.exit(1))}let f=l?.includes(`nuxt`),p=l?.includes(`svelte`),h=l?.includes(`solid`);if((f||p||h)&&u===`trpc`&&(m.fatal(`tRPC API is not supported with '${f?`nuxt`:p?`svelte`:`solid`}' frontend. Please use --api orpc or --api none or remove '${f?`nuxt`:p?`svelte`:`solid`}' from --frontend.`),process.exit(1)),r.addons&&r.addons.length>0){let e=[`pwa`,`tauri`],t=r.addons.some(t=>e.includes(t)),n=l?.some(e=>{let t=e===`tanstack-router`||e===`react-router`||e===`solid`,n=e===`tanstack-router`||e===`react-router`||e===`nuxt`||e===`svelte`||e===`solid`||e===`next`;return r.addons?.includes(`pwa`)&&r.addons?.includes(`tauri`)?t&&n:r.addons?.includes(`pwa`)?t:r.addons?.includes(`tauri`)?n:!0});if(t&&!n){let e=`Selected frontend is not compatible.`;r.addons.includes(`pwa`)&&(e=`PWA requires tanstack-router, react-router, or solid.`),r.addons.includes(`tauri`)&&(e=`Tauri requires tanstack-router, react-router, nuxt, svelte, solid, or next.`),m.fatal(`Incompatible addon/frontend combination: ${e}`),process.exit(1)}r.addons.includes(`husky`)&&!r.addons.includes(`biome`)&&m.warn(`Husky addon is recommended to be used with Biome for lint-staged configuration.`),r.addons=[...new Set(r.addons)]}let g=l&&l.length===1&&(l[0]===`native-nativewind`||l[0]===`native-unistyles`);g&&r.examples&&r.examples.length>0&&!r.examples.includes(`none`)&&(m.fatal(`Examples are not supported when only a native frontend (NativeWind or Unistyles) is selected.`),process.exit(1)),r.examples&&r.examples.length>0&&!r.examples.includes(`none`)&&(r.examples.includes(`todo`)&&d!==`convex`&&d!==`none`&&e===`none`&&(m.fatal(`The 'todo' example requires a database if a backend (other than Convex) is present. Cannot use --examples todo when database is 'none' and a backend is selected.`),process.exit(1)),r.examples.includes(`ai`)&&d===`elysia`&&(m.fatal(`The 'ai' example is not compatible with the Elysia backend.`),process.exit(1)),r.examples.includes(`ai`)&&h&&(m.fatal(`The 'ai' example is not compatible with the Solid frontend.`),process.exit(1)))}return r}Lt().catch(e=>{m.error(`Aborting installation due to unexpected error...`),e instanceof Error?!e.message.includes(`is only supported with`)&&!e.message.includes(`incompatible with`)&&!e.message.includes(`requires`)&&!e.message.includes(`Cannot use`)&&!e.message.includes(`Cannot select multiple`)&&!e.message.includes(`Cannot combine`)&&!e.message.includes(`not supported`)&&(m.error(e.message),m.error(e.stack)):console.error(e),process.exit(1)});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-better-t-stack",
3
- "version": "2.10.2",
3
+ "version": "2.10.3",
4
4
  "description": "A modern CLI tool for scaffolding end-to-end type-safe TypeScript projects with best practices and customizable configurations",
5
5
  "type": "module",
6
6
  "license": "MIT",