create-better-t-stack 1.7.1 → 1.8.0
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.
- package/README.md +3 -1
- package/dist/index.js +106 -105
- package/package.json +2 -2
- package/template/base/apps/web-base/src/index.css +1 -1
- package/template/base/apps/web-tanstack-router/src/components/mode-toggle.tsx +37 -0
- package/template/base/apps/web-tanstack-router/src/components/theme-provider.tsx +73 -0
- package/template/base/apps/web-tanstack-router/src/routes/__root.tsx +1 -2
- package/template/base/apps/web-tanstack-start/app.config.ts +17 -0
- package/template/base/apps/web-tanstack-start/package.json +52 -0
- package/template/base/apps/web-tanstack-start/public/robots.txt +3 -0
- package/template/base/apps/web-tanstack-start/src/api.ts +6 -0
- package/template/base/apps/web-tanstack-start/src/client.tsx +8 -0
- package/template/base/apps/web-tanstack-start/src/components/header.tsx +27 -0
- package/template/base/apps/web-tanstack-start/src/index.css +135 -0
- package/template/base/apps/web-tanstack-start/src/router.tsx +70 -0
- package/template/base/apps/web-tanstack-start/src/routes/__root.tsx +68 -0
- package/template/base/apps/web-tanstack-start/src/routes/index.tsx +88 -0
- package/template/base/apps/web-tanstack-start/src/ssr.tsx +12 -0
- package/template/base/apps/web-tanstack-start/src/utils/trpc.ts +5 -0
- package/template/base/apps/web-tanstack-start/tsconfig.json +28 -0
- package/template/examples/ai/apps/web-tanstack-start/src/routes/ai.tsx +69 -0
- package/template/examples/todo/apps/web-tanstack-start/src/routes/todos.tsx +135 -0
- package/template/with-auth/apps/web-tanstack-router/src/utils/trpc.ts +39 -0
- package/template/with-auth/apps/web-tanstack-start/src/components/header.tsx +32 -0
- package/template/with-auth/apps/web-tanstack-start/src/components/sign-in-form.tsx +139 -0
- package/template/with-auth/apps/web-tanstack-start/src/components/sign-up-form.tsx +164 -0
- package/template/with-auth/apps/web-tanstack-start/src/components/user-menu.tsx +62 -0
- package/template/with-auth/apps/web-tanstack-start/src/router.tsx +76 -0
- package/template/with-auth/apps/web-tanstack-start/src/routes/dashboard.tsx +37 -0
- package/template/with-auth/apps/web-tanstack-start/src/routes/login.tsx +18 -0
- package/template/with-drizzle-sqlite/apps/server/src/db/schema/auth.ts +0 -6
- /package/template/base/apps/{web-base → web-react-router}/src/components/mode-toggle.tsx +0 -0
- /package/template/base/apps/{web-base → web-react-router}/src/components/theme-provider.tsx +0 -0
- /package/template/with-auth/apps/{web-base → web-react-router}/src/utils/trpc.ts +0 -0
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{cancel as
|
|
3
|
-
${c[0]}`):
|
|
4
|
-
${
|
|
2
|
+
import{cancel as v,intro as qr,log as S,outro as Wr,spinner as Jr}from"@clack/prompts";import{Command as Hr}from"commander";import g from"picocolors";import de from"node:path";import{fileURLToPath as $t}from"node:url";var Q=()=>{let e=process.env.npm_config_user_agent;return e?.startsWith("pnpm")?"pnpm":e?.startsWith("bun")?"bun":"npm"};var Et=$t(import.meta.url),Tt=de.dirname(Et),$=de.join(Tt,"../"),w={projectName:"my-better-t-app",frontend:["tanstack-router"],database:"sqlite",orm:"drizzle",auth:!0,addons:[],examples:[],git:!0,packageManager:Q(),noInstall:!1,turso:!1,prismaPostgres:!1,backend:"hono",runtime:"bun"},ae={"better-auth":"^1.2.4","@better-auth/expo":"^1.2.5","drizzle-orm":"^0.38.4","drizzle-kit":"^0.30.5","@libsql/client":"^0.14.0",postgres:"^3.4.5","@prisma/client":"^6.5.0",prisma:"^6.5.0","vite-plugin-pwa":"^0.21.2","@vite-pwa/assets-generator":"^0.2.6","@tauri-apps/cli":"^2.4.0","@biomejs/biome":"1.9.4",husky:"^9.1.7","lint-staged":"^15.5.0","@hono/node-server":"^1.14.0",tsx:"^4.19.2","@types/node":"^22.13.11","@types/bun":"^1.2.6","@elysiajs/node":"^1.2.6","@elysiajs/cors":"^1.2.0","@elysiajs/trpc":"^1.1.0",elysia:"^1.2.25","@hono/trpc-server":"^0.3.4",hono:"^4.7.5",ai:"^4.2.8","@ai-sdk/google":"^1.2.3","@prisma/extension-accelerate":"^1.3.0"};import La from"node:path";import{cancel as Na,spinner as _a}from"@clack/prompts";import Ua from"fs-extra";import Je from"picocolors";import N from"node:path";import E from"fs-extra";import At from"node:path";import ue from"fs-extra";var b=e=>{let{dependencies:a=[],devDependencies:t=[],projectDir:r}=e,n=At.join(r,"package.json"),s=ue.readJSONSync(n);s.dependencies||(s.dependencies={}),s.devDependencies||(s.devDependencies={});for(let i of a){let o=ae[i];s.dependencies[i]=o}for(let i of t){let o=ae[i];s.devDependencies[i]=o}ue.writeJSONSync(n,s,{spaces:2})};import K from"node:path";import{log as Ct,spinner as Rt}from"@clack/prompts";import{execa as St}from"execa";import X from"fs-extra";import me from"picocolors";async function fe(e,a,t){let r=Rt(),n=K.join(e,"apps/web");if(await X.pathExists(n))try{r.start("Setting up Tauri desktop app support..."),b({devDependencies:["@tauri-apps/cli"],projectDir:n});let s=K.join(n,"package.json");if(await X.pathExists(s)){let l=await X.readJson(s);l.scripts={...l.scripts,tauri:"tauri","desktop:dev":"tauri dev","desktop:build":"tauri build"},await X.writeJson(s,l,{spaces:2})}let i,o;switch(a){case"npm":i="npx",o=["@tauri-apps/cli@latest"];break;case"pnpm":i="pnpm",o=["dlx","@tauri-apps/cli@latest"];break;case"bun":i="bunx",o=["@tauri-apps/cli@latest"];break;default:i="npx",o=["@tauri-apps/cli@latest"]}let p=t.includes("react-router")?"http://localhost:5173":"http://localhost:3001";o=[...o,"init",`--app-name=${K.basename(e)}`,`--window-title=${K.basename(e)}`,"--frontend-dist=dist",`--dev-url=${p}`,`--before-dev-command=${a} run dev`,`--before-build-command=${a} run build`],await St(i,o,{cwd:n,env:{CI:"true"}}),r.stop("Tauri desktop app support configured successfully!")}catch(s){throw r.stop(me.red("Failed to set up Tauri")),s instanceof Error&&Ct.error(me.red(s.message)),s}}async function he(e,a,t,r){let n=r.includes("react-router")||r.includes("tanstack-router");a.includes("pwa")&&n&&await Dt(e,r),a.includes("tauri")&&n&&await fe(e,t,r),a.includes("biome")&&await It(e),a.includes("husky")&&await Ot(e)}function Ft(e,a){return N.join(e,"apps/web")}async function It(e){let a=N.join($,"template/with-biome");await E.pathExists(a)&&await E.copy(a,e,{overwrite:!0}),b({devDependencies:["@biomejs/biome"],projectDir:e});let t=N.join(e,"package.json");if(await E.pathExists(t)){let r=await E.readJson(t);r.scripts={...r.scripts,check:"biome check --write ."},await E.writeJson(t,r,{spaces:2})}}async function Ot(e){let a=N.join($,"template/with-husky");await E.pathExists(a)&&await E.copy(a,e,{overwrite:!0}),b({devDependencies:["husky","lint-staged"],projectDir:e});let t=N.join(e,"package.json");if(await E.pathExists(t)){let r=await E.readJson(t);r.scripts={...r.scripts,prepare:"husky"},r["lint-staged"]={"*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}":["biome check --write ."]},await E.writeJson(t,r,{spaces:2})}}async function Dt(e,a){let t=N.join($,"template/with-pwa");await E.pathExists(t)&&await E.copy(t,e,{overwrite:!0});let r=Ft(e,a);if(!await E.pathExists(r))return;b({dependencies:["vite-plugin-pwa"],devDependencies:["@vite-pwa/assets-generator"],projectDir:r});let n=N.join(r,"vite.config.ts");if(await E.pathExists(n)){let i=await E.readFile(n,"utf8");if(!i.includes("vite-plugin-pwa")){let c=i.match(/^import .* from ['"](.*)['"]/m);c?i=i.replace(c[0],`import { VitePWA } from "vite-plugin-pwa";
|
|
3
|
+
${c[0]}`):i=`import { VitePWA } from "vite-plugin-pwa";
|
|
4
|
+
${i}`}let o=`VitePWA({
|
|
5
5
|
registerType: "autoUpdate",
|
|
6
6
|
manifest: {
|
|
7
7
|
name: "My App",
|
|
@@ -16,18 +16,18 @@ ${s}`}let o=`VitePWA({
|
|
|
16
16
|
devOptions: {
|
|
17
17
|
enabled: true,
|
|
18
18
|
},
|
|
19
|
-
})`;
|
|
19
|
+
})`;i.includes("VitePWA(")||(a.includes("react-router")?i=i.replace(/plugins: \[\s*tailwindcss\(\)/,`plugins: [
|
|
20
20
|
tailwindcss(),
|
|
21
|
-
${o}`):a.includes("tanstack-router")?
|
|
21
|
+
${o}`):a.includes("tanstack-router")?i=i.replace(/plugins: \[\s*tailwindcss\(\)/,`plugins: [
|
|
22
22
|
tailwindcss(),
|
|
23
|
-
${o}`):
|
|
24
|
-
${o},`)),await E.writeFile(n,
|
|
23
|
+
${o}`):i=i.replace(/plugins: \[/,`plugins: [
|
|
24
|
+
${o},`)),await E.writeFile(n,i)}let s=N.join(r,"package.json");if(await E.pathExists(s)){let i=await E.readJson(s);i.scripts={...i.scripts,"generate-pwa-assets":"pwa-assets-generator"},await E.writeJson(s,i,{spaces:2})}}import re from"node:path";import{log as ge}from"@clack/prompts";import we from"picocolors";function be(e=32){let a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t="",r=a.length;for(let n=0;n<e;n++)t+=a.charAt(Math.floor(Math.random()*r));return t}async function Pe(e,a,t=[]){if(!a)return;let r=re.join(e,"apps/server"),n=re.join(e,"apps/web"),s=re.join(e,"apps/native");try{(t.includes("react-router")||t.includes("tanstack-router")||t.includes("tanstack-start"))&&(b({dependencies:["better-auth"],projectDir:r}),b({dependencies:["better-auth"],projectDir:n})),t.includes("native")&&(b({dependencies:["better-auth","@better-auth/expo"],projectDir:s}),b({dependencies:["better-auth","@better-auth/expo"],projectDir:r}))}catch(i){throw ge.error(we.red("Failed to configure authentication")),i instanceof Error&&ge.error(we.red(i.message)),i}}import Lt from"node:path";async function ye(e,a,t){let r=Lt.join(e,"apps/server"),n=[],s=[];a==="hono"?(n.push("hono","@hono/trpc-server"),t==="node"&&(n.push("@hono/node-server"),s.push("tsx","@types/node"))):a==="elysia"&&(n.push("elysia","@elysiajs/cors","@elysiajs/trpc"),t==="node"&&(n.push("@elysiajs/node"),s.push("tsx","@types/node"))),t==="bun"&&s.push("@types/bun"),b({dependencies:n,devDependencies:s,projectDir:r})}import Nt from"node:path";import _t from"fs-extra";async function je(e,a){let t=Nt.join(e,"README.md"),r=Ut(a);try{await _t.writeFile(t,r)}catch(n){console.error("Failed to create README.md file:",n)}}function Ut(e){let{projectName:a,packageManager:t,database:r,auth:n,addons:s=[],orm:i="drizzle",runtime:o="bun",frontend:c=["tanstack-router"]}=e,p=c.includes("react-router"),l=c.includes("tanstack-router"),m=c.includes("native"),x=t==="npm"?"npm run":t,y=p?"5173":"3001";return`# ${a}
|
|
25
25
|
|
|
26
|
-
This project was created with [Better-T-Stack](https://github.com/better-t-stack
|
|
26
|
+
This project was created with [Better-T-Stack](https://github.com/AmanVarshney01/create-better-t-stack), a modern TypeScript stack that combines React, ${l?"TanStack Router":"React Router"}, Hono, tRPC, and more.
|
|
27
27
|
|
|
28
28
|
## Features
|
|
29
29
|
|
|
30
|
-
${
|
|
30
|
+
${Mt(r,n,s,i,o,c)}
|
|
31
31
|
|
|
32
32
|
## Getting Started
|
|
33
33
|
|
|
@@ -37,20 +37,20 @@ First, install the dependencies:
|
|
|
37
37
|
${t} install
|
|
38
38
|
\`\`\`
|
|
39
39
|
|
|
40
|
-
${
|
|
40
|
+
${Bt(r,n,x,i)}
|
|
41
41
|
|
|
42
42
|
Then, run the development server:
|
|
43
43
|
|
|
44
44
|
\`\`\`bash
|
|
45
|
-
${
|
|
45
|
+
${x} dev
|
|
46
46
|
\`\`\`
|
|
47
47
|
|
|
48
|
-
${
|
|
49
|
-
${
|
|
48
|
+
${l||p?`Open [http://localhost:${y}](http://localhost:${y}) in your browser to see the web application.`:""}
|
|
49
|
+
${m?`Use the Expo Go app to run the mobile application.
|
|
50
50
|
`:""}
|
|
51
51
|
The API is running at [http://localhost:3000](http://localhost:3000).
|
|
52
52
|
|
|
53
|
-
${
|
|
53
|
+
${s.includes("pwa")&&p?`
|
|
54
54
|
## PWA Support with React Router v7
|
|
55
55
|
|
|
56
56
|
There is a known compatibility issue between VitePWA and React Router v7.
|
|
@@ -62,16 +62,16 @@ See: https://github.com/vite-pwa/vite-plugin-pwa/issues/809
|
|
|
62
62
|
\`\`\`
|
|
63
63
|
${a}/
|
|
64
64
|
\u251C\u2500\u2500 apps/
|
|
65
|
-
${
|
|
66
|
-
`:""}${
|
|
65
|
+
${l||p?`\u2502 \u251C\u2500\u2500 web/ # Frontend application (React, ${l?"TanStack Router":"React Router"})
|
|
66
|
+
`:""}${m?`\u2502 \u251C\u2500\u2500 native/ # Mobile application (React Native, Expo)
|
|
67
67
|
`:""}\u2502 \u2514\u2500\u2500 server/ # Backend API (Hono, tRPC)
|
|
68
68
|
\`\`\`
|
|
69
69
|
|
|
70
70
|
## Available Scripts
|
|
71
71
|
|
|
72
|
-
${
|
|
73
|
-
`}function
|
|
74
|
-
`)}function
|
|
72
|
+
${zt(x,r,i,n,m)}
|
|
73
|
+
`}function Mt(e,a,t,r,n,s){let i=s.includes("tanstack-router"),o=s.includes("react-router"),c=s.includes("native"),p=["- **TypeScript** - For type safety and improved developer experience"];i?p.push("- **TanStack Router** - File-based routing with full type safety"):o&&p.push("- **React Router** - Declarative routing for React"),c&&(p.push("- **React Native** - Build mobile apps using React"),p.push("- **Expo** - Tools for React Native development")),p.push("- **TailwindCSS** - Utility-first CSS for rapid UI development","- **shadcn/ui** - Reusable UI components","- **Hono** - Lightweight, performant server framework","- **tRPC** - End-to-end type-safe APIs",`- **${n==="bun"?"Bun":"Node.js"}** - Runtime environment`),e!=="none"&&p.push(`- **${r==="drizzle"?"Drizzle":"Prisma"}** - TypeScript-first ORM`,`- **${e==="sqlite"?"SQLite/Turso":"PostgreSQL"}** - Database engine`),a&&p.push("- **Authentication** - Email & password authentication with Better Auth");for(let l of t)l==="pwa"?p.push("- **PWA** - Progressive Web App support"):l==="tauri"?p.push("- **Tauri** - Build native desktop applications"):l==="biome"?p.push("- **Biome** - Linting and formatting"):l==="husky"&&p.push("- **Husky** - Git hooks for code quality");return p.join(`
|
|
74
|
+
`)}function Bt(e,a,t,r){if(e==="none")return"";let n=`## Database Setup
|
|
75
75
|
|
|
76
76
|
`;return e==="sqlite"?n+=`This project uses SQLite${r==="drizzle"?" with Drizzle ORM":" with Prisma"}.
|
|
77
77
|
|
|
@@ -93,35 +93,35 @@ ${t} db:push
|
|
|
93
93
|
\`\`\`bash
|
|
94
94
|
${t} db:push
|
|
95
95
|
\`\`\``}
|
|
96
|
-
`,n}function
|
|
96
|
+
`,n}function zt(e,a,t,r,n){let s=`- \`${e} dev\`: Start both web and server in development mode
|
|
97
97
|
- \`${e} build\`: Build both web and server
|
|
98
98
|
- \`${e} dev:web\`: Start only the web application
|
|
99
99
|
- \`${e} dev:server\`: Start only the server
|
|
100
|
-
- \`${e} check-types\`: Check TypeScript types across all apps`;return n&&(
|
|
101
|
-
- \`${e} dev:native\`: Start the React Native/Expo development server`),a!=="none"&&(
|
|
100
|
+
- \`${e} check-types\`: Check TypeScript types across all apps`;return n&&(s+=`
|
|
101
|
+
- \`${e} dev:native\`: Start the React Native/Expo development server`),a!=="none"&&(s+=`
|
|
102
102
|
- \`${e} db:push\`: Push schema changes to database
|
|
103
|
-
- \`${e} db:studio\`: Open database studio UI`,a==="sqlite"&&t==="drizzle"&&(
|
|
104
|
-
- \`cd apps/server && ${e} db:local\`: Start the local SQLite database`)),
|
|
105
|
-
It looks like: prisma+postgres://accelerate.prisma-data.net/?api_key=...`));let n=await
|
|
106
|
-
${n}`,await
|
|
103
|
+
- \`${e} db:studio\`: Open database studio UI`,a==="sqlite"&&t==="drizzle"&&(s+=`
|
|
104
|
+
- \`cd apps/server && ${e} db:local\`: Start the local SQLite database`)),s}import Ee from"node:path";import{log as oa,spinner as ca}from"@clack/prompts";import pa from"fs-extra";import Te from"picocolors";import W from"node:path";import{cancel as Gt,isCancel as Vt,log as U,password as qt}from"@clack/prompts";import{execa as Wt}from"execa";import _ from"fs-extra";import G from"picocolors";async function Jt(e,a){try{U.info(G.blue("Initializing Prisma PostgreSQL"));let t=W.join(e,"prisma");await _.ensureDir(t),await Wt(a==="npm"?"npx":a==="pnpm"?"pnpm dlx":"bunx",["prisma","init","--db"],{cwd:e,stdio:"inherit"}),U.info(G.yellow(`Please copy the Prisma Postgres URL from the output above.
|
|
105
|
+
It looks like: prisma+postgres://accelerate.prisma-data.net/?api_key=...`));let n=await qt({message:"Paste your Prisma Postgres database URL:",validate(s){if(!s)return"Please enter a database URL";if(!s.startsWith("prisma+postgres://"))return"URL should start with prisma+postgres://"}});return Vt(n)?(Gt("Database setup cancelled"),null):{databaseUrl:n}}catch(t){return t instanceof Error&&U.error(G.red(t.message)),null}}async function ne(e,a){let t=W.join(e,"apps/server",".env"),r="";await _.pathExists(t)&&(r=await _.readFile(t,"utf8"));let n=a?`DATABASE_URL="${a.databaseUrl}"`:'DATABASE_URL="postgresql://postgres:postgres@localhost:5432/mydb?schema=public"';r.includes("DATABASE_URL=")?r=r.replace(/DATABASE_URL=.*(\r?\n|$)/,`${n}$1`):r+=`
|
|
106
|
+
${n}`,await _.writeFile(t,r.trim())}function ke(){U.info(`Manual Prisma PostgreSQL Setup Instructions:
|
|
107
107
|
|
|
108
108
|
1. Visit https://console.prisma.io and create an account
|
|
109
109
|
2. Create a new PostgreSQL database from the dashboard
|
|
110
110
|
3. Get your database URL
|
|
111
111
|
4. Add the database URL to the .env file in apps/server/.env
|
|
112
112
|
|
|
113
|
-
DATABASE_URL="your_database_url"`)}async function ve(e,a="npm"){let t=
|
|
113
|
+
DATABASE_URL="your_database_url"`)}async function ve(e,a="npm"){let t=W.join(e,"apps/server");try{let r=await Jt(t,a);r?(await ne(e,r),await Ht(t),U.success(G.green("Prisma PostgreSQL database configured successfully!"))):(await ne(e),ke())}catch(r){U.error(G.red(`Error during Prisma PostgreSQL setup: ${r}`)),await ne(e),ke(),U.info("Setup completed with manual configuration required.")}}async function Ht(e){try{b({dependencies:["@prisma/extension-accelerate"],projectDir:e});let a=W.join(e,"prisma/index.ts");await _.writeFile(a,`
|
|
114
114
|
import { PrismaClient } from '@prisma/client';
|
|
115
115
|
import { withAccelerate } from "@prisma/extension-accelerate";
|
|
116
116
|
|
|
117
117
|
const prisma = new PrismaClient().$extends(withAccelerate());
|
|
118
118
|
|
|
119
119
|
export default prisma;
|
|
120
|
-
`.trim());let r=
|
|
121
|
-
${n}`,n=n.replace("export const db = new PrismaClient();","export const db = new PrismaClient().$extends(withAccelerate());"),await
|
|
122
|
-
`);return a.length<=1?[]:a.slice(1).map(r=>{let[n,i,
|
|
120
|
+
`.trim());let r=W.join(e,"src/db/index.ts");if(await _.pathExists(r)){let n=await _.readFile(r,"utf8");n.includes("@prisma/extension-accelerate")||(n=`import { withAccelerate } from "@prisma/extension-accelerate";
|
|
121
|
+
${n}`,n=n.replace("export const db = new PrismaClient();","export const db = new PrismaClient().$extends(withAccelerate());"),await _.writeFile(r,n))}}catch{U.warn(G.yellow("Could not add Prisma Accelerate extension automatically"))}}import Qt from"node:os";import xe from"node:path";import{cancel as se,confirm as Kt,isCancel as ie,log as V,select as Xt,spinner as oe,text as Yt}from"@clack/prompts";import{$ as D}from"execa";import Zt from"fs-extra";import F from"picocolors";async function ea(){try{return(await D`turso --version`).exitCode===0}catch{return!1}}async function ta(){try{return!(await D`turso auth whoami`).stdout.includes("You are not logged in")}catch{return!1}}async function aa(){let e=oe();try{return e.start("Logging in to Turso..."),await D`turso auth login`,e.stop("Logged in to Turso successfully!"),!0}catch(a){throw e.stop(F.red("Failed to log in to Turso")),a}}async function ra(e){let a=oe();try{if(a.start("Installing Turso CLI..."),e)await D`brew install tursodatabase/tap/turso`;else{let{stdout:t}=await D`curl -sSfL https://get.tur.so/install.sh`;await D`bash -c '${t}'`}return a.stop("Turso CLI installed successfully!"),!0}catch(t){throw t instanceof Error&&t.message.includes("User force closed")?(a.stop(),V.warn(F.yellow("Turso CLI installation cancelled by user")),new Error("Installation cancelled")):(a.stop(F.red("Failed to install Turso CLI")),t)}}async function na(){try{let{stdout:e}=await D`turso group list`,a=e.trim().split(`
|
|
122
|
+
`);return a.length<=1?[]:a.slice(1).map(r=>{let[n,s,i,o]=r.trim().split(/\s{2,}/);return{name:n,locations:s,version:i,status:o}})}catch(e){return console.error("Error fetching Turso groups:",e),[]}}async function sa(){let e=await na();if(e.length===0)return null;if(e.length===1)return e[0].name;let a=e.map(r=>({value:r.name,label:`${r.name} (${r.locations})`})),t=await Xt({message:"Select a Turso database group:",options:a});return ie(t)&&(se(F.red("Operation cancelled")),process.exit(0)),t}async function ia(e,a){try{a?await D`turso db create ${e} --group ${a}`:await D`turso db create ${e}`}catch(n){throw n instanceof Error&&n.message.includes("already exists")?new Error("DATABASE_EXISTS"):n}let{stdout:t}=await D`turso db show ${e} --url`,{stdout:r}=await D`turso db tokens create ${e}`;return{dbUrl:t.trim(),authToken:r.trim()}}async function J(e,a){let t=xe.join(e,"apps/server",".env"),r=a?`TURSO_CONNECTION_URL="${a.dbUrl}"
|
|
123
123
|
TURSO_AUTH_TOKEN="${a.authToken}"`:`TURSO_CONNECTION_URL=
|
|
124
|
-
TURSO_AUTH_TOKEN=`;await
|
|
124
|
+
TURSO_AUTH_TOKEN=`;await Zt.writeFile(t,r)}function Y(){V.info(`Manual Turso Setup Instructions:
|
|
125
125
|
|
|
126
126
|
1. Visit https://turso.tech and create an account
|
|
127
127
|
2. Create a new database from the dashboard
|
|
@@ -129,93 +129,94 @@ TURSO_AUTH_TOKEN=`;await Xt.writeFile(t,r)}function X(){G.info(`Manual Turso Set
|
|
|
129
129
|
4. Add these credentials to the .env file in apps/server/.env
|
|
130
130
|
|
|
131
131
|
TURSO_CONNECTION_URL=your_database_url
|
|
132
|
-
TURSO_AUTH_TOKEN=your_auth_token`)}async function
|
|
133
|
-
CORS_ORIGIN=${
|
|
134
|
-
BETTER_AUTH_SECRET=${
|
|
135
|
-
BETTER_AUTH_URL=http://localhost:3000`)),a.database!=="none"){if(a.orm==="prisma"&&!n.includes("DATABASE_URL")){let
|
|
136
|
-
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/mydb?schema=public"`;n+=
|
|
132
|
+
TURSO_AUTH_TOKEN=your_auth_token`)}async function $e(e,a){if(!a){await J(e),V.info(F.blue("Skipping Turso setup. Setting up empty configuration.")),Y();return}let t=Qt.platform(),r=t==="darwin";if(!(t!=="win32")){V.warn(F.yellow("Automatic Turso setup is not supported on Windows.")),await J(e),Y();return}try{if(!await ea()){let m=await Kt({message:"Would you like to install Turso CLI?",initialValue:!0});if(ie(m)&&(se(F.red("Operation cancelled")),process.exit(0)),!m){await J(e),Y();return}await ra(r)}await ta()||await aa();let o=await sa(),c=!1,p="",l=xe.basename(e);for(;!c;){let m=await Yt({message:"Enter a name for your database:",defaultValue:l,initialValue:l,placeholder:l});ie(m)&&(se(F.red("Operation cancelled")),process.exit(0)),p=m;let x=oe();try{x.start(`Creating Turso database "${p}"${o?` in group "${o}"`:""}...`);let y=await ia(p,o);await J(e,y),x.stop("Turso database configured successfully!"),c=!0}catch(y){if(y instanceof Error&&y.message==="DATABASE_EXISTS")x.stop(F.yellow(`Database "${F.red(p)}" already exists`)),l=`${p}-${Math.floor(Math.random()*1e3)}`;else throw x.stop(F.red("Failed to create Turso database")),y}}}catch(s){V.error(F.red(`Error during Turso setup: ${s}`)),await J(e),Y(),V.success("Setup completed with manual configuration required.")}}async function Ae(e,a,t,r,n,s){let i=ca(),o=Ee.join(e,"apps/server");if(a==="none"){await pa.remove(Ee.join(o,"src/db"));return}try{a==="sqlite"?(t==="drizzle"?b({dependencies:["drizzle-orm","@libsql/client"],devDependencies:["drizzle-kit"],projectDir:o}):t==="prisma"&&b({dependencies:["@prisma/client"],devDependencies:["prisma"],projectDir:o}),n&&await $e(e,!0)):a==="postgres"&&(t==="drizzle"?b({dependencies:["drizzle-orm","postgres"],devDependencies:["drizzle-kit"],projectDir:o}):t==="prisma"&&(b({dependencies:["@prisma/client"],devDependencies:["prisma"],projectDir:o}),a==="postgres"&&t==="prisma"&&s&&await ve(e,r)))}catch(c){throw i.stop(Te.red("Failed to set up database")),c instanceof Error&&oa.error(Te.red(c.message)),c}}import q from"node:path";import L from"fs-extra";async function Ce(e,a){let t=q.join(e,"apps/server"),r=q.join(t,".env"),n="";if(await L.pathExists(r)&&(n=await L.readFile(r,"utf8")),!n.includes("CORS_ORIGIN")){let p=a.frontend.includes("react-router"),l=a.frontend.includes("tanstack-router"),m=a.frontend.includes("tanstack-start"),x="http://localhost:3000";p?x="http://localhost:5173":(l||m)&&(x="http://localhost:3001"),n+=`
|
|
133
|
+
CORS_ORIGIN=${x}`}if(a.auth&&(n.includes("BETTER_AUTH_SECRET")||(n+=`
|
|
134
|
+
BETTER_AUTH_SECRET=${be()}`),n.includes("BETTER_AUTH_URL")||(n+=`
|
|
135
|
+
BETTER_AUTH_URL=http://localhost:3000`)),a.database!=="none"){if(a.orm==="prisma"&&!n.includes("DATABASE_URL")){let p=a.database==="sqlite"?"":`
|
|
136
|
+
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/mydb?schema=public"`;n+=p}a.database==="sqlite"&&!a.turso&&(n.includes("TURSO_CONNECTION_URL")||(n+=`
|
|
137
137
|
TURSO_CONNECTION_URL=http://127.0.0.1:8080`))}a.examples?.includes("ai")&&!n.includes("GOOGLE_GENERATIVE_AI_API_KEY")&&(n+=`
|
|
138
|
-
GOOGLE_GENERATIVE_AI_API_KEY=`),await
|
|
139
|
-
`),await
|
|
140
|
-
`),await
|
|
138
|
+
GOOGLE_GENERATIVE_AI_API_KEY=`),await L.writeFile(r,n.trim());let s=a.frontend.includes("react-router"),i=a.frontend.includes("tanstack-router"),o=a.frontend.includes("tanstack-start");if(s||i||o){let p=q.join(e,"apps/web");await la(p)}if(a.frontend.includes("native")){let p=q.join(e,"apps/native"),l=q.join(p,".env"),m="";await L.pathExists(l)&&(m=await L.readFile(l,"utf8")),m.includes("EXPO_PUBLIC_SERVER_URL")||(m+=`EXPO_PUBLIC_SERVER_URL=http://localhost:3000
|
|
139
|
+
`),await L.writeFile(l,m.trim())}}async function la(e){let a=q.join(e,".env"),t="";await L.pathExists(a)&&(t=await L.readFile(a,"utf8")),t.includes("VITE_SERVER_URL")||(t+=`VITE_SERVER_URL=http://localhost:3000
|
|
140
|
+
`),await L.writeFile(a,t.trim())}import T from"node:path";import P from"fs-extra";async function Re(e,a,t,r,n,s=["tanstack-router"]){let i=s.includes("tanstack-router"),o=s.includes("tanstack-start"),c=s.includes("react-router"),p=i||c||o,l;i?l="web-tanstack-router":o?l="web-tanstack-start":l="web-react-router";let m=await P.pathExists(T.join(e,"apps/web"));a.includes("todo")&&p&&m?await fa(e,t,r,l):await wa(e,t),a.includes("ai")&&n==="hono"&&p&&m&&await da(e,l)}async function da(e,a){let t=T.join($,"template/examples/ai");if(await P.pathExists(t)){let r=T.join(t,`apps/${a}/src/routes/ai.tsx`),n=T.join(e,"apps/web/src/routes/ai.tsx");await P.pathExists(r)&&await P.copy(r,n,{overwrite:!0}),await ma(e,a);let s=T.join(e,"apps/web");b({dependencies:["ai"],projectDir:s});let i=T.join(e,"apps/server");b({dependencies:["ai","@ai-sdk/google"],projectDir:i}),await ua(e)}}async function ua(e){let a=T.join(e,"apps/server/src/index.ts");if(await P.pathExists(a)){let t=await P.readFile(a,"utf8");if(t.includes("hono")){let n=`import { streamText } from "ai";
|
|
141
141
|
import { google } from "@ai-sdk/google";
|
|
142
|
-
import { stream } from "hono/streaming";`,
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
142
|
+
import { stream } from "hono/streaming";`,s=`
|
|
143
|
+
// AI chat endpoint
|
|
144
|
+
app.post("/ai", async (c) => {
|
|
145
|
+
const body = await c.req.json();
|
|
146
|
+
const messages = body.messages || [];
|
|
147
|
+
|
|
148
|
+
const result = streamText({
|
|
149
|
+
model: google("gemini-1.5-flash"),
|
|
150
|
+
messages,
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
c.header("X-Vercel-AI-Data-Stream", "v1");
|
|
154
|
+
c.header("Content-Type", "text/plain; charset=utf-8");
|
|
155
|
+
|
|
156
|
+
return stream(c, (stream) => stream.pipe(result.toDataStream()));
|
|
157
|
+
});`;if(t.includes("import {")){let o=t.lastIndexOf("import"),c=t.indexOf(`
|
|
157
158
|
`,o);t=`${t.substring(0,c+1)}
|
|
158
|
-
|
|
159
|
-
|
|
159
|
+
${n}
|
|
160
|
+
${t.substring(c+1)}`}else t=`${n}
|
|
160
161
|
|
|
161
|
-
${t}`;let
|
|
162
|
+
${t}`;let i=t.indexOf('app.use("/trpc"')||t.indexOf("app.use(trpc(");if(i!==-1)t=`${t.substring(0,i)}${s}
|
|
162
163
|
|
|
163
|
-
${t.substring(
|
|
164
|
+
${t.substring(i)}`;else{let o=t.indexOf("export default");o!==-1?t=`${t.substring(0,o)}${s}
|
|
164
165
|
|
|
165
166
|
${t.substring(o)}`:t=`${t}
|
|
166
167
|
|
|
167
|
-
${
|
|
168
|
-
${
|
|
168
|
+
${s}`}await P.writeFile(a,t)}}}async function ma(e,a){let t=T.join(e,"apps/web/src/components/header.tsx");if(await P.pathExists(t)){let r=await P.readFile(t,"utf8"),n=/const links = \[\s*([^;]*?)\s*\];/s,s=r.match(n);if(s){let i=s[1];if(!i.includes('"/ai"')){let o=`const links = [
|
|
169
|
+
${i}${i.trim().endsWith(",")?"":","}
|
|
169
170
|
{ to: "/ai", label: "AI Chat" },
|
|
170
|
-
];`;r=r.replace(n,o),await
|
|
171
|
+
];`;r=r.replace(n,o),await P.writeFile(t,r)}}}}async function fa(e,a,t,r){let n=T.join($,"template/examples/todo");if(await P.pathExists(n)){let s=T.join(n,`apps/${r}/src/routes/todos.tsx`),i=T.join(e,"apps/web/src/routes/todos.tsx");if(await P.pathExists(s)&&await P.copy(s,i,{overwrite:!0}),a!=="none"){let o=T.join(n,`apps/server/src/routers/with-${a}-todo.ts`),c=T.join(e,"apps/server/src/routers/todo.ts");await P.pathExists(o)&&await P.copy(o,c,{overwrite:!0}),await ha(e)}await ga(e,r)}}async function ha(e){let a=T.join(e,"apps/server/src/routers/index.ts");if(await P.pathExists(a)){let t=await P.readFile(a,"utf8");if(!t.includes("import { todoRouter }")){let r=t.lastIndexOf("import"),n=t.indexOf(`
|
|
171
172
|
|
|
172
173
|
`,r);n!==-1?t=`${t.slice(0,n)}
|
|
173
174
|
import { todoRouter } from "./todo";${t.slice(n)}`:t=`import { todoRouter } from "./todo";
|
|
174
|
-
${t}`;let
|
|
175
|
-
todo: todoRouter,${t.slice(
|
|
176
|
-
${
|
|
175
|
+
${t}`;let s=t.indexOf("export const appRouter = router({");if(s!==-1){let i=t.indexOf("{",s)+1;t=`${t.slice(0,i)}
|
|
176
|
+
todo: todoRouter,${t.slice(i)}`}await P.writeFile(a,t)}}}async function ga(e,a){let t=T.join(e,"apps/web/src/components/header.tsx");if(await P.pathExists(t)){let r=await P.readFile(t,"utf8"),n=/const links = \[\s*([^;]*?)\s*\];/s,s=r.match(n);if(s){let i=s[1];if(!i.includes('"/todos"')){let o=`const links = [
|
|
177
|
+
${i}${i.trim().endsWith(",")?"":","}
|
|
177
178
|
{ to: "/todos", label: "Todos" },
|
|
178
|
-
];`;r=r.replace(n,o),await
|
|
179
|
-
${r?"":`${
|
|
180
|
-
`}${
|
|
181
|
-
|
|
182
|
-
${
|
|
183
|
-
${vt?`${
|
|
184
|
-
`:""}`:`${
|
|
185
|
-
`}${
|
|
186
|
-
${
|
|
187
|
-
${
|
|
188
|
-
${
|
|
189
|
-
${
|
|
190
|
-
${
|
|
191
|
-
${
|
|
192
|
-
|
|
193
|
-
${
|
|
194
|
-
${
|
|
179
|
+
];`;r=r.replace(n,o),await P.writeFile(t,r)}}}}async function wa(e,a){if(a==="drizzle"){let r=T.join(e,"apps/server/src/db/schema/todo.ts");await P.pathExists(r)&&await P.remove(r)}else if(a==="prisma"){let r=T.join(e,"apps/server/prisma/schema/todo.prisma");await P.pathExists(r)&&await P.remove(r)}let t=T.join(e,"apps/server/src/routers/todo.ts");await P.pathExists(t)&&await P.remove(t),await ba(e)}async function ba(e){let a=T.join(e,"apps/server/src/routers/index.ts");if(await P.pathExists(a)){let t=await P.readFile(a,"utf8");t=t.replace(/import { todoRouter } from ".\/todo";/,""),t=t.replace(/todo: todoRouter,/,""),await P.writeFile(a,t)}}import{log as Se,spinner as Fe}from"@clack/prompts";import{$ as Ie}from"execa";import Z from"picocolors";async function Oe({projectDir:e,packageManager:a,addons:t=[]}){let r=Fe();try{r.start(`Running ${a} install...`),await Ie({cwd:e,stderr:"inherit"})`${a} install`,r.stop("Dependencies installed successfully"),(t.includes("biome")||t.includes("husky"))&&await Pa(e,a)}catch(n){throw r.stop(Z.red("Failed to install dependencies")),n instanceof Error&&Se.error(Z.red(`Installation error: ${n.message}`)),n}}async function Pa(e,a){let t=Fe();try{t.start("Running Biome format check..."),await Ie({cwd:e,stderr:"inherit"})`${a} biome check --write .`,t.stop("Biome check completed successfully")}catch{t.stop(Z.yellow("Biome check encountered issues")),Se.warn(Z.yellow("Some files may need manual formatting"))}}import{note as ya}from"@clack/prompts";import k from"picocolors";function De(e,a,t,r,n,s,i,o){let c=t==="npm"?"npm run":t,p=`cd ${a}`,l=s?.includes("husky")||s?.includes("biome"),m=e!=="none"?va(e,n,c,i):"",x=s?.includes("tauri")?xa(c):"",y=l?ka(c):"",C=o?.includes("native")?ja():"",j=s?.includes("pwa")&&o?.includes("react-router")?$a():"",A=o?.includes("tanstack-router"),I=o?.includes("tanstack-start"),O=o?.includes("react-router"),le=A||O||I,kt=o?.includes("native"),vt=le||kt,xt=O?"5173":"3001";ya(`${k.cyan("1.")} ${p}
|
|
180
|
+
${r?"":`${k.cyan("2.")} ${t} install
|
|
181
|
+
`}${k.cyan(r?"2.":"3.")} ${c} dev
|
|
182
|
+
|
|
183
|
+
${k.bold("Your project will be available at:")}
|
|
184
|
+
${vt?`${le?`${k.cyan("\u2022")} Frontend: http://localhost:${xt}
|
|
185
|
+
`:""}`:`${k.yellow("NOTE:")} You are creating a backend-only app (no frontend selected)
|
|
186
|
+
`}${k.cyan("\u2022")} API: http://localhost:3000
|
|
187
|
+
${C?`
|
|
188
|
+
${C.trim()}`:""}${m?`
|
|
189
|
+
${m.trim()}`:""}${x?`
|
|
190
|
+
${x.trim()}`:""}${y?`
|
|
191
|
+
${y.trim()}`:""}${j?`
|
|
192
|
+
${j.trim()}`:""}
|
|
193
|
+
|
|
194
|
+
${k.bold("Like Better-T Stack?")} Please consider giving us a star on GitHub:
|
|
195
|
+
${k.cyan("https://github.com/AmanVarshney01/create-better-t-stack")}`,"Next steps")}function ja(){return`${k.yellow("NOTE:")} For Expo connectivity issues, update apps/native/.env
|
|
195
196
|
with your local IP:
|
|
196
197
|
EXPO_PUBLIC_SERVER_URL=http://192.168.0.103:3000
|
|
197
|
-
`}function
|
|
198
|
-
${
|
|
198
|
+
`}function ka(e){return`${k.bold("Linting and formatting:")}
|
|
199
|
+
${k.cyan("\u2022")} Format and lint fix: ${`${e} check`}
|
|
199
200
|
|
|
200
|
-
`}function
|
|
201
|
-
follow the guidance provided in the error messages`),n.push(`${
|
|
201
|
+
`}function va(e,a,t,r){let n=[];return a==="prisma"?(e==="sqlite"&&n.push(`${k.yellow("NOTE:")} Turso support with Prisma is in Early Access and requires additional setup.`,"Learn more at: https://www.prisma.io/docs/orm/overview/databases/turso"),r==="bun"&&n.push(`${k.yellow("NOTE:")} Prisma with Bun may require additional configuration. If you encounter errors,
|
|
202
|
+
follow the guidance provided in the error messages`),n.push(`${k.cyan("\u2022")} Apply schema: ${`${t} db:push`}`),n.push(`${k.cyan("\u2022")} Database UI: ${`${t} db:studio`}`)):a==="drizzle"&&(e==="sqlite"&&n.push(`${k.cyan("\u2022")} Start local DB: ${`cd apps/server && ${t} db:local`}`),n.push(`${k.cyan("\u2022")} Apply schema: ${`${t} db:push`}`),n.push(`${k.cyan("\u2022")} Database UI: ${`${t} db:studio`}`)),n.length?`${k.bold("Database commands:")}
|
|
202
203
|
${n.join(`
|
|
203
204
|
`)}
|
|
204
205
|
|
|
205
|
-
`:""}function
|
|
206
|
-
${
|
|
207
|
-
${
|
|
208
|
-
${
|
|
209
|
-
${
|
|
206
|
+
`:""}function xa(e){return`
|
|
207
|
+
${k.bold("Desktop app with Tauri:")}
|
|
208
|
+
${k.cyan("\u2022")} Start desktop app: ${`cd apps/web && ${e} desktop:dev`}
|
|
209
|
+
${k.cyan("\u2022")} Build desktop app: ${`cd apps/web && ${e} desktop:build`}
|
|
210
|
+
${k.yellow("NOTE:")} Tauri requires Rust and platform-specific dependencies.
|
|
210
211
|
See: https://v2.tauri.app/start/prerequisites/
|
|
211
212
|
|
|
212
|
-
`}function
|
|
213
|
-
${
|
|
213
|
+
`}function $a(){return`${k.bold("PWA with React Router v7:")}
|
|
214
|
+
${k.yellow("NOTE:")} There is a known compatibility issue between VitePWA and React Router v7.
|
|
214
215
|
See: https://github.com/vite-pwa/vite-plugin-pwa/issues/809
|
|
215
|
-
`}import
|
|
216
|
+
`}import ee from"node:path";import{log as Ea}from"@clack/prompts";import{$ as Le,execa as Ta}from"execa";import M from"fs-extra";import Aa from"picocolors";async function Ne(e,a){await Ca(e,a),await Ra(e,a)}async function Ca(e,a){let t=ee.join(e,"package.json");if(await M.pathExists(t)){let r=await M.readJson(t);r.name=a.projectName;let{stdout:n}=await Ta(a.packageManager,["-v"],{cwd:e});if(r.packageManager=`${a.packageManager}@${n.trim()}`,await M.writeJson(t,r,{spaces:2}),a.packageManager==="pnpm"){let s=ee.join($,"template/with-pnpm/pnpm-workspace.yaml"),i=ee.join(e,"pnpm-workspace.yaml");await M.pathExists(s)&&await M.copy(s,i)}}}async function Ra(e,a){let t=ee.join(e,"apps/server/package.json");if(await M.pathExists(t)){let r=await M.readJson(t);a.database!=="none"&&(a.database==="sqlite"&&(r.scripts["db:local"]="turso dev --db-file local.db"),a.orm==="prisma"?(r.scripts["db:push"]="prisma db push --schema ./prisma/schema",r.scripts["db:studio"]="prisma studio"):a.orm==="drizzle"&&(r.scripts["db:push"]="drizzle-kit push",r.scripts["db:studio"]="drizzle-kit studio")),await M.writeJson(t,r,{spaces:2})}}async function _e(e,a){if(!a)return;if((await Le({cwd:e,reject:!1,stderr:"pipe"})`git --version`).exitCode!==0){Ea.warn(Aa.yellow("Git is not installed"));return}let r=await Le({cwd:e,reject:!1,stderr:"pipe"})`git init`;if(r.exitCode!==0)throw new Error(`Git initialization failed: ${r.stderr}`)}import te from"node:path";import B from"fs-extra";async function Ue(e,a,t){let r=te.join(e,"apps/server"),n=te.join(r,"src/index.ts"),s=await B.readFile(n,"utf-8");a==="bun"?await Sa(r,n,s,t):a==="node"&&await Fa(r,n,s,t)}async function Sa(e,a,t,r){let n=te.join(e,"package.json"),s=await B.readJson(n);if(s.scripts={...s.scripts,dev:"bun run --hot src/index.ts",start:"bun run dist/src/index.js"},await B.writeJson(n,s,{spaces:2}),b({devDependencies:["@types/bun"],projectDir:e}),r==="hono"){let i=`${t}
|
|
216
217
|
|
|
217
218
|
export default app;
|
|
218
|
-
`;await
|
|
219
|
+
`;await B.writeFile(a,i)}}async function Fa(e,a,t,r){let n=te.join(e,"package.json"),s=await B.readJson(n);if(s.scripts={...s.scripts,dev:"tsx watch src/index.ts",start:"node dist/src/index.js"},await B.writeJson(n,s,{spaces:2}),b({devDependencies:["tsx","@types/node"],projectDir:e}),r==="hono"){b({dependencies:["@hono/node-server"],projectDir:e});let i=`import { serve } from "@hono/node-server";
|
|
219
220
|
`,o=`
|
|
220
221
|
serve(
|
|
221
222
|
{
|
|
@@ -226,14 +227,14 @@ serve(
|
|
|
226
227
|
console.log(\`Server is running on http://localhost:\${info.port}\`);
|
|
227
228
|
},
|
|
228
229
|
);
|
|
229
|
-
`;if(!t.includes("@hono/node-server")){let c=t.lastIndexOf("import"),p=t.substring(0,c),
|
|
230
|
+
`;if(!t.includes("@hono/node-server")){let c=t.lastIndexOf("import"),p=t.substring(0,c),l=t.substring(c),m=p+i+l+o;await B.writeFile(a,m)}}else if(r==="elysia"&&(b({dependencies:["@elysiajs/node"],projectDir:e}),!t.includes("@elysiajs/node"))){let i=`import { node } from "@elysiajs/node";
|
|
230
231
|
`,o=t.indexOf(`
|
|
231
|
-
`,t.indexOf("import")),c=t.substring(0,o+1),p=t.substring(o+1),
|
|
232
|
-
`)}}async function
|
|
233
|
-
`,o=
|
|
234
|
-
`,o)+1;
|
|
235
|
-
});`),i.includes("my-better-t-app://")||(i=i.replace(/trustedOrigins: \[(.*?)\]/s,(s,o)=>`trustedOrigins: [${o}${o.trim()?", ":""}"my-better-t-app://"]`)),await l.writeFile(n,i)}}async function qe(e){let a=await Ve(e);for(let t of a)if(await l.pathExists(t)){let r=d.join(d.dirname(t),".gitignore");await l.move(t,r,{overwrite:!0})}}async function Ve(e){let a=[],t=d.join(e,"_gitignore");await l.pathExists(t)&&a.push(t);try{let r=await l.readdir(e,{withFileTypes:!0});for(let n of r)if(n.isDirectory()&&n.name!=="node_modules"){let i=d.join(e,n.name),s=await Ve(i);a.push(...s)}}catch{}return a}function Oa(e,a){return e==="drizzle"?a==="sqlite"?"template/with-drizzle-sqlite":"template/with-drizzle-postgres":e==="prisma"?a==="sqlite"?"template/with-prisma-sqlite":"template/with-prisma-postgres":"template/base"}function Ia(e,a){if(e==="drizzle")return a==="sqlite"?"with-drizzle-sqlite-lib":"with-drizzle-postgres-lib";if(e==="prisma")return a==="sqlite"?"with-prisma-sqlite-lib":"with-prisma-postgres-lib";throw new Error("Invalid ORM or database configuration for auth setup")}async function We(e){let a=La(),t=Sa.resolve(process.cwd(),e.projectName);try{return await Na.ensureDir(t),await Ue(t),await Me(t,e.frontend),await qe(t),await Be(t,e.backend),await Pe(t,e.backend,e.runtime),await ze(t,e.orm,e.database,e.auth),await Te(t,e.database,e.orm,e.packageManager,e.turso??e.database==="sqlite",e.prismaPostgres),await Ge(t,e.auth,e.backend,e.orm,e.database,e.frontend),await be(t,e.auth,e.frontend),await _e(t,e.runtime,e.backend),await Ae(t,e.examples,e.orm,e.auth,e.backend,e.frontend),await Ce(t,e),await Ne(t,e.git),e.addons.length>0&&await fe(t,e.addons,e.packageManager,e.frontend),await Le(t,e),await ye(t,e),e.noInstall||await Ie({projectDir:t,packageManager:e.packageManager,addons:e.addons}),Se(e.database,e.projectName,e.packageManager,!e.noInstall,e.orm,e.addons,e.runtime,e.frontend),t}catch(r){throw a.message(Je.red("Failed")),r instanceof Error&&(Da(Je.red(`Error during project creation: ${r.message}`)),process.exit(1)),r}}import{cancel as _r,group as Ur}from"@clack/prompts";import Mr from"picocolors";import{cancel as _a,isCancel as Ua,multiselect as Ma}from"@clack/prompts";import Ba from"picocolors";async function He(e,a){if(e!==void 0)return e;let t=a?.includes("react-router")||a?.includes("tanstack-router"),r=[{value:"biome",label:"Biome",hint:"Add Biome for linting and formatting"},{value:"husky",label:"Husky",hint:"Add Git hooks with Husky, lint-staged (requires Biome)"}],i=t?[...[{value:"pwa",label:"PWA (Progressive Web App)",hint:"Make your app installable and work offline"},{value:"tauri",label:"Tauri Desktop App",hint:"Build native desktop apps from your web frontend"}],...r]:r,s=g.addons.filter(c=>t||c!=="pwa"&&c!=="tauri"),o=await Ma({message:"Select addons",options:i,initialValues:s,required:!1});return Ua(o)&&(_a(Ba.red("Operation cancelled")),process.exit(0)),o.includes("husky")&&!o.includes("biome")&&o.push("biome"),o}import{cancel as za,confirm as Ga,isCancel as qa}from"@clack/prompts";import Va from"picocolors";async function Qe(e,a,t){if(!a)return!1;if(e!==void 0)return e;let r=await Ga({message:"Add authentication with Better-Auth?",initialValue:g.auth});return qa(r)&&(za(Va.red("Operation cancelled")),process.exit(0)),r}import{cancel as Ja,isCancel as Wa,select as Ha}from"@clack/prompts";import Qa from"picocolors";async function Ke(e){if(e!==void 0)return e;let a=await Ha({message:"Select backend framework",options:[{value:"hono",label:"Hono",hint:"Lightweight, ultrafast web framework"},{value:"elysia",label:"Elysia",hint:"Ergonomic web framework for building backend servers"}],initialValue:g.backend});return Wa(a)&&(Ja(Qa.red("Operation cancelled")),process.exit(0)),a}import{cancel as Ka,isCancel as Xa,select as Ya}from"@clack/prompts";import Za from"picocolors";async function Xe(e){if(e!==void 0)return e;let a=await Ya({message:"Select database",options:[{value:"none",label:"None",hint:"No database setup"},{value:"sqlite",label:"SQLite",hint:"by Turso"},{value:"postgres",label:"PostgreSQL",hint:"Traditional relational database"}],initialValue:g.database});return Xa(a)&&(Ka(Za.red("Operation cancelled")),process.exit(0)),a}import{cancel as er,isCancel as tr,multiselect as Ye}from"@clack/prompts";import ar from"picocolors";async function Ze(e,a,t,r){if(e!==void 0)return e;if(a==="none")return[];if(!(t?.includes("react-router")||t?.includes("tanstack-router")))return[];let i=[];return r==="elysia"&&(i=await Ye({message:"Include examples",options:[{value:"todo",label:"Todo App",hint:"A simple CRUD example app"}],required:!1,initialValues:g.examples})),r==="hono"&&(i=await Ye({message:"Include examples",options:[{value:"todo",label:"Todo App",hint:"A simple CRUD example app"},{value:"ai",label:"AI Chat",hint:"A simple AI chat interface using AI SDK"}],required:!1,initialValues:g.examples})),tr(i)&&(er(ar.red("Operation cancelled")),process.exit(0)),i}import{cancel as et,isCancel as tt,multiselect as rr,select as nr}from"@clack/prompts";import at from"picocolors";async function rt(e){if(e!==void 0)return e;let a=await rr({message:"Select platforms to develop for",options:[{value:"web",label:"Web",hint:"React Web Application"},{value:"native",label:"Native",hint:"Create a React Native/Expo app"}],initialValues:g.frontend.some(r=>r==="tanstack-router"||r==="react-router")?["web"]:[]});tt(a)&&(et(at.red("Operation cancelled")),process.exit(0));let t=[];if(a.includes("web")){let r=await nr({message:"Choose frontend framework",options:[{value:"tanstack-router",label:"TanStack Router",hint:"Modern and scalable routing for React Applications"},{value:"react-router",label:"React Router",hint:"A user\u2011obsessed, standards\u2011focused, multi\u2011strategy router you can deploy anywhere."}],initialValue:g.frontend.find(n=>n==="tanstack-router"||n==="react-router")||"tanstack-router"});tt(r)&&(et(at.red("Operation cancelled")),process.exit(0)),t.push(r)}return a.includes("native")&&t.push("native"),t}import{cancel as ir,confirm as sr,isCancel as or}from"@clack/prompts";import cr from"picocolors";async function nt(e){if(e!==void 0)return e;let a=await sr({message:"Initialize git repository?",initialValue:g.git});return or(a)&&(ir(cr.red("Operation cancelled")),process.exit(0)),a}import{cancel as pr,confirm as lr,isCancel as dr}from"@clack/prompts";import ur from"picocolors";async function it(e){if(e!==void 0)return e;let a=await lr({message:"Install dependencies?",initialValue:!g.noInstall});return dr(a)&&(pr(ur.red("Operation cancelled")),process.exit(0)),!a}import{cancel as mr,isCancel as fr,select as hr}from"@clack/prompts";import gr from"picocolors";async function st(e,a){if(!a)return"none";if(e!==void 0)return e;let t=await hr({message:"Select ORM",options:[{value:"drizzle",label:"Drizzle",hint:"Type-safe, lightweight ORM"},{value:"prisma",label:"Prisma",hint:"Powerful, feature-rich ORM"}],initialValue:g.orm});return fr(t)&&(mr(gr.red("Operation cancelled")),process.exit(0)),t}import{cancel as wr,isCancel as br,select as Pr}from"@clack/prompts";import yr from"picocolors";async function ot(e){if(e!==void 0)return e;let a=H(),t=await Pr({message:"Choose package manager",options:[{value:"npm",label:"npm",hint:"Node Package Manager"},{value:"pnpm",label:"pnpm",hint:"Fast, disk space efficient package manager"},{value:"bun",label:"bun",hint:"All-in-one JavaScript runtime & toolkit"}],initialValue:a});return br(t)&&(wr(yr.red("Operation cancelled")),process.exit(0)),t}import{cancel as jr,confirm as vr,isCancel as kr}from"@clack/prompts";import xr from"picocolors";async function ct(e){if(e!==void 0)return e;let a=await vr({message:"Set up Prisma Postgres database?",initialValue:g.prismaPostgres});return kr(a)&&(jr(xr.red("Operation cancelled")),process.exit(0)),a}import W from"node:path";import{cancel as $r,isCancel as Er,text as Tr}from"@clack/prompts";import B from"fs-extra";import Cr from"picocolors";var Ar=["<",">",":",'"',"|","?","*"],pt=255;function lt(e){if(e!=="."){if(!e)return"Project name cannot be empty";if(e.length>pt)return`Project name must be less than ${pt} characters`;if(Ar.some(a=>e.includes(a)))return"Project name contains invalid characters";if(e.startsWith(".")||e.startsWith("-"))return"Project name cannot start with a dot or dash";if(e.toLowerCase()==="node_modules"||e.toLowerCase()==="favicon.ico")return"Project name is reserved"}}async function dt(e){if(e)if(e==="."){let i=process.cwd();if(B.readdirSync(i).length===0)return e}else{let i=W.basename(e);if(!lt(i)){let o=W.resolve(process.cwd(),e);if(!B.pathExistsSync(o)||B.readdirSync(o).length===0)return e}}let a=!1,t="",r=g.projectName,n=1;for(;B.pathExistsSync(W.resolve(process.cwd(),r));)r=`${g.projectName}-${n}`,n++;for(;!a;){let i=await Tr({message:"Enter your project name or path (relative to current directory)",placeholder:r,initialValue:e,defaultValue:r,validate:s=>{let o=s.trim()||r;if(o==="."){if(B.readdirSync(process.cwd()).length>0)return"Current directory is not empty. Please choose a different directory.";a=!0;return}let c=W.resolve(process.cwd(),o),p=W.basename(c),u=lt(p);if(u)return u;if(!c.startsWith(process.cwd()))return"Project path must be within current directory";if(B.pathExistsSync(c)&&B.readdirSync(c).length>0)return`Directory "${o}" already exists and is not empty. Please choose a different name or path.`;a=!0}});Er(i)&&($r(Cr.red("Operation cancelled.")),process.exit(0)),t=i||r}return t}import{cancel as Rr,isCancel as Fr,select as Or}from"@clack/prompts";import Ir from"picocolors";async function ut(e){if(e!==void 0)return e;let a=await Or({message:"Select runtime",options:[{value:"bun",label:"Bun",hint:"Fast all-in-one JavaScript runtime"},{value:"node",label:"Node.js",hint:"Traditional Node.js runtime"}],initialValue:g.runtime});return Fr(a)&&(Rr(Ir.red("Operation cancelled")),process.exit(0)),a}import{cancel as Sr,confirm as Dr,isCancel as Lr}from"@clack/prompts";import Nr from"picocolors";async function mt(e){if(e!==void 0)return e;let a=await Dr({message:"Set up Turso database?",initialValue:g.turso});return Lr(a)&&(Sr(Nr.red("Operation cancelled")),process.exit(0)),a}async function ft(e){let a=await Ur({projectName:async()=>dt(e.projectName),frontend:()=>rt(e.frontend),backend:()=>Ke(e.backend),runtime:()=>ut(e.runtime),database:()=>Xe(e.database),orm:({results:t})=>st(e.orm,t.database!=="none"),auth:({results:t})=>Qe(e.auth,t.database!=="none",t.frontend),turso:({results:t})=>t.database==="sqlite"&&t.orm!=="prisma"?mt(e.turso):Promise.resolve(!1),prismaPostgres:({results:t})=>t.database==="postgres"&&t.orm==="prisma"?ct(e.prismaPostgres):Promise.resolve(!1),addons:({results:t})=>He(e.addons,t.frontend),examples:({results:t})=>Ze(e.examples,t.database,t.frontend,t.backend),git:()=>nt(e.git),packageManager:()=>ot(e.packageManager),noInstall:()=>it(e.noInstall)},{onCancel:()=>{_r(Mr.red("Operation cancelled")),process.exit(0)}});return{projectName:a.projectName,frontend:a.frontend,database:a.database,orm:a.orm,auth:a.auth,addons:a.addons,examples:a.examples,git:a.git,packageManager:a.packageManager,noInstall:a.noInstall,turso:a.turso,prismaPostgres:a.prismaPostgres,backend:a.backend,runtime:a.runtime}}import A from"picocolors";function oe(e){let a=[];if(e.projectName&&a.push(`${A.blue("Project Name:")} ${e.projectName}`),e.frontend!==void 0){let t=e.frontend.length>0?e.frontend.join(", "):"none";a.push(`${A.blue("Frontend:")} ${t}`)}if(e.backend!==void 0&&a.push(`${A.blue("Backend Framework:")} ${e.backend}`),e.runtime!==void 0&&a.push(`${A.blue("Runtime:")} ${e.runtime}`),e.database!==void 0&&a.push(`${A.blue("Database:")} ${e.database}`),e.orm!==void 0&&a.push(`${A.blue("ORM:")} ${e.orm}`),e.auth!==void 0&&a.push(`${A.blue("Authentication:")} ${e.auth}`),e.addons!==void 0){let t=e.addons.length>0?e.addons.join(", "):"none";a.push(`${A.blue("Addons:")} ${t}`)}if(e.examples!==void 0){let t=e.examples.length>0?e.examples.join(", "):"none";a.push(`${A.blue("Examples:")} ${t}`)}return e.git!==void 0&&a.push(`${A.blue("Git Init:")} ${e.git}`),e.packageManager!==void 0&&a.push(`${A.blue("Package Manager:")} ${e.packageManager}`),e.noInstall!==void 0&&a.push(`${A.blue("Skip Install:")} ${e.noInstall}`),e.turso!==void 0&&a.push(`${A.blue("Turso Setup:")} ${e.turso}`),e.prismaPostgres!==void 0&&a.push(`${A.blue("Prisma Postgres Setup:")} ${e.prismaPostgres?"Yes":"No"}`),a.join(`
|
|
236
|
-
`)}function
|
|
232
|
+
`,t.indexOf("import")),c=t.substring(0,o+1),p=t.substring(o+1),l=c+i+p;l=l.replace(/const app = new Elysia\([^)]*\)/,"const app = new Elysia({ adapter: node() })"),await B.writeFile(a,l)}}import u from"node:path";import d from"fs-extra";async function Me(e){let a=u.join($,"template/base");if(!await d.pathExists(a))throw new Error(`Template directory not found: ${a}`);await d.ensureDir(e);let t=await d.readdir(a);for(let s of t){let i=u.join(a,s),o=u.join(e,s);s!=="apps"&&(await d.stat(i).then(c=>c.isDirectory())?await d.copy(i,o):await d.copy(i,o))}await d.ensureDir(u.join(e,"apps"));let r=u.join(a,"apps/server"),n=u.join(e,"apps/server");await d.pathExists(r)&&await d.copy(r,n)}async function Be(e,a){let t=a.includes("tanstack-router"),r=a.includes("tanstack-start"),n=a.includes("react-router"),s=a.includes("native");if(t||n||r){let i=u.join(e,"apps/web");await d.ensureDir(i);let o=u.join($,"template/base/apps/web-base");await d.pathExists(o)&&await d.copy(o,i);let c="web-react-router";t?c="web-tanstack-router":r&&(c="web-tanstack-start");let p=u.join($,`template/base/apps/${c}`);await d.pathExists(p)&&await d.copy(p,i,{overwrite:!0});let l=u.join(i,"package.json");if(await d.pathExists(l)){let m=await d.readJson(l);m.name="web",await d.writeJson(l,m,{spaces:2})}}if(s){let i=u.join($,"template/base/apps/native"),o=u.join(e,"apps/native");await d.pathExists(i)&&await d.copy(i,o),await d.writeFile(u.join(e,".npmrc"),`node-linker=hoisted
|
|
233
|
+
`)}}async function ze(e,a){let t=u.join($,`template/with-${a}`);await d.pathExists(t)&&await d.copy(t,e,{overwrite:!0})}async function Ge(e,a,t,r){if(a==="none"||t==="none")return;let n=u.join($,Oa(a,t));if(await d.pathExists(n)&&(await d.copy(n,e,{overwrite:!0}),!r)){if(a==="prisma"){let s=u.join(e,"apps/server/prisma/schema/auth.prisma");await d.pathExists(s)&&await d.remove(s)}else if(a==="drizzle"){let s=u.join(e,"apps/server/src/db/schema/auth.ts");await d.pathExists(s)&&await d.remove(s)}}}async function Ve(e,a,t,r,n,s){if(!a)return;let i=u.join($,"template/with-auth");if(await d.pathExists(i)){let o=s.includes("react-router"),c=s.includes("tanstack-router"),p=s.includes("tanstack-start");if(o||c||p){let A=u.join(e,"apps/web"),I=u.join(i,"apps/web-base");if(await d.pathExists(I)&&await d.copy(I,A,{overwrite:!0}),o){let O=u.join(i,"apps/web-react-router");await d.pathExists(O)&&await d.copy(O,A,{overwrite:!0})}if(c){let O=u.join(i,"apps/web-tanstack-router");await d.pathExists(O)&&await d.copy(O,A,{overwrite:!0})}if(p){let O=u.join(i,"apps/web-tanstack-start");await d.pathExists(O)&&await d.copy(O,A,{overwrite:!0})}}let l=u.join(i,"apps/server/src"),m=u.join(e,"apps/server/src");await d.copy(u.join(l,"lib/trpc.ts"),u.join(m,"lib/trpc.ts"),{overwrite:!0}),await d.copy(u.join(l,"routers/index.ts"),u.join(m,"routers/index.ts"),{overwrite:!0});let x=`with-${t}-context.ts`;await d.copy(u.join(l,"lib",x),u.join(m,"lib/context.ts"),{overwrite:!0});let y=`with-${t}-index.ts`;await d.copy(u.join(l,y),u.join(m,"index.ts"),{overwrite:!0});let C=Da(r,n),j=u.join(l,C);if(await d.pathExists(j)){let A=await d.readdir(j);for(let I of A)await d.copy(u.join(j,I),u.join(m,"lib",I),{overwrite:!0})}if(s.includes("native")){let A=u.join(i,"apps/native"),I=u.join(e,"apps/native");await d.pathExists(A)&&await d.copy(A,I,{overwrite:!0}),b({dependencies:["@better-auth/expo"],projectDir:u.join(e,"apps/server")}),await Ia(e,r,n)}}}async function Ia(e,a,t){let r=u.join(e,"apps/server"),n;if(a==="drizzle"?t==="sqlite"?n=u.join(r,"src/lib/auth.ts"):t==="postgres"&&(n=u.join(r,"src/lib/auth.ts")):a==="prisma"&&(t==="sqlite"?n=u.join(r,"src/lib/auth.ts"):t==="postgres"&&(n=u.join(r,"src/lib/auth.ts"))),n&&await d.pathExists(n)){let s=await d.readFile(n,"utf8");if(!s.includes("@better-auth/expo")){let i=`import { expo } from "@better-auth/expo";
|
|
234
|
+
`,o=s.lastIndexOf("import"),c=s.indexOf(`
|
|
235
|
+
`,o)+1;s=s.substring(0,c)+i+s.substring(c)}s.includes("plugins:")?s.includes("expo()")||(s=s.replace(/plugins: \[(.*?)\]/s,(i,o)=>`plugins: [${o}${o.trim()?", ":""}expo()]`)):s=s.replace(/}\);/,` plugins: [expo()],
|
|
236
|
+
});`),s.includes("my-better-t-app://")||(s=s.replace(/trustedOrigins: \[(.*?)\]/s,(i,o)=>`trustedOrigins: [${o}${o.trim()?", ":""}"my-better-t-app://"]`)),await d.writeFile(n,s)}}async function qe(e){let a=await We(e);for(let t of a)if(await d.pathExists(t)){let r=u.join(u.dirname(t),".gitignore");await d.move(t,r,{overwrite:!0})}}async function We(e){let a=[],t=u.join(e,"_gitignore");await d.pathExists(t)&&a.push(t);try{let r=await d.readdir(e,{withFileTypes:!0});for(let n of r)if(n.isDirectory()&&n.name!=="node_modules"){let s=u.join(e,n.name),i=await We(s);a.push(...i)}}catch{}return a}function Oa(e,a){return e==="drizzle"?a==="sqlite"?"template/with-drizzle-sqlite":"template/with-drizzle-postgres":e==="prisma"?a==="sqlite"?"template/with-prisma-sqlite":"template/with-prisma-postgres":"template/base"}function Da(e,a){if(e==="drizzle")return a==="sqlite"?"with-drizzle-sqlite-lib":"with-drizzle-postgres-lib";if(e==="prisma")return a==="sqlite"?"with-prisma-sqlite-lib":"with-prisma-postgres-lib";throw new Error("Invalid ORM or database configuration for auth setup")}async function He(e){let a=_a(),t=La.resolve(process.cwd(),e.projectName);try{return await Ua.ensureDir(t),await Me(t),await Be(t,e.frontend),await qe(t),await ze(t,e.backend),await ye(t,e.backend,e.runtime),await Ge(t,e.orm,e.database,e.auth),await Ae(t,e.database,e.orm,e.packageManager,e.turso??e.database==="sqlite",e.prismaPostgres),await Ve(t,e.auth,e.backend,e.orm,e.database,e.frontend),await Pe(t,e.auth,e.frontend),await Ue(t,e.runtime,e.backend),await Re(t,e.examples,e.orm,e.auth,e.backend,e.frontend),await Ce(t,e),await _e(t,e.git),e.addons.length>0&&await he(t,e.addons,e.packageManager,e.frontend),await Ne(t,e),await je(t,e),e.noInstall||await Oe({projectDir:t,packageManager:e.packageManager,addons:e.addons}),De(e.database,e.projectName,e.packageManager,!e.noInstall,e.orm,e.addons,e.runtime,e.frontend),t}catch(r){throw a.message(Je.red("Failed")),r instanceof Error&&(Na(Je.red(`Error during project creation: ${r.message}`)),process.exit(1)),r}}import{cancel as Mr,group as Br}from"@clack/prompts";import zr from"picocolors";import{cancel as Ma,isCancel as Ba,multiselect as za}from"@clack/prompts";import Ga from"picocolors";async function Qe(e,a){if(e!==void 0)return e;let t=a?.includes("react-router")||a?.includes("tanstack-router"),r=[{value:"biome",label:"Biome",hint:"Add Biome for linting and formatting"},{value:"husky",label:"Husky",hint:"Add Git hooks with Husky, lint-staged (requires Biome)"}],s=t?[...[{value:"pwa",label:"PWA (Progressive Web App)",hint:"Make your app installable and work offline"},{value:"tauri",label:"Tauri Desktop App",hint:"Build native desktop apps from your web frontend"}],...r]:r,i=w.addons.filter(c=>t||c!=="pwa"&&c!=="tauri"),o=await za({message:"Select addons",options:s,initialValues:i,required:!1});return Ba(o)&&(Ma(Ga.red("Operation cancelled")),process.exit(0)),o.includes("husky")&&!o.includes("biome")&&o.push("biome"),o}import{cancel as Va,confirm as qa,isCancel as Wa}from"@clack/prompts";import Ja from"picocolors";async function Ke(e,a,t){if(!a)return!1;if(e!==void 0)return e;let r=await qa({message:"Add authentication with Better-Auth?",initialValue:w.auth});return Wa(r)&&(Va(Ja.red("Operation cancelled")),process.exit(0)),r}import{cancel as Ha,isCancel as Qa,select as Ka}from"@clack/prompts";import Xa from"picocolors";async function Xe(e){if(e!==void 0)return e;let a=await Ka({message:"Select backend framework",options:[{value:"hono",label:"Hono",hint:"Lightweight, ultrafast web framework"},{value:"elysia",label:"Elysia",hint:"Ergonomic web framework for building backend servers"}],initialValue:w.backend});return Qa(a)&&(Ha(Xa.red("Operation cancelled")),process.exit(0)),a}import{cancel as Ya,isCancel as Za,select as er}from"@clack/prompts";import tr from"picocolors";async function Ye(e){if(e!==void 0)return e;let a=await er({message:"Select database",options:[{value:"none",label:"None",hint:"No database setup"},{value:"sqlite",label:"SQLite",hint:"by Turso"},{value:"postgres",label:"PostgreSQL",hint:"Traditional relational database"}],initialValue:w.database});return Za(a)&&(Ya(tr.red("Operation cancelled")),process.exit(0)),a}import{cancel as ar,isCancel as rr,multiselect as Ze}from"@clack/prompts";import nr from"picocolors";async function et(e,a,t,r){if(e!==void 0)return e;if(a==="none")return[];if(!(t?.includes("react-router")||t?.includes("tanstack-router")||t?.includes("tanstack-start")))return[];let s=[];return r==="elysia"&&(s=await Ze({message:"Include examples",options:[{value:"todo",label:"Todo App",hint:"A simple CRUD example app"}],required:!1,initialValues:w.examples})),r==="hono"&&(s=await Ze({message:"Include examples",options:[{value:"todo",label:"Todo App",hint:"A simple CRUD example app"},{value:"ai",label:"AI Chat",hint:"A simple AI chat interface using AI SDK"}],required:!1,initialValues:w.examples})),rr(s)&&(ar(nr.red("Operation cancelled")),process.exit(0)),s}import{cancel as tt,isCancel as at,multiselect as sr,select as ir}from"@clack/prompts";import rt from"picocolors";async function nt(e){if(e!==void 0)return e;let a=await sr({message:"Select platforms to develop for",options:[{value:"web",label:"Web",hint:"React Web Application"},{value:"native",label:"Native",hint:"Create a React Native/Expo app"}],initialValues:w.frontend.some(r=>r==="tanstack-router"||r==="react-router"||r==="tanstack-start")?["web"]:[]});at(a)&&(tt(rt.red("Operation cancelled")),process.exit(0));let t=[];if(a.includes("web")){let r=await ir({message:"Choose frontend framework",options:[{value:"tanstack-router",label:"TanStack Router",hint:"Modern and scalable routing for React Applications"},{value:"react-router",label:"React Router",hint:"A user\u2011obsessed, standards\u2011focused, multi\u2011strategy router you can deploy anywhere."},{value:"tanstack-start",label:"TanStack Start (beta)",hint:"SSR, Streaming, Server Functions, API Routes, bundling and more powered by TanStack Router and Vite."}],initialValue:w.frontend.find(n=>n==="tanstack-router"||n==="react-router"||n==="tanstack-start")||"tanstack-router"});at(r)&&(tt(rt.red("Operation cancelled")),process.exit(0)),t.push(r)}return a.includes("native")&&t.push("native"),t}import{cancel as or,confirm as cr,isCancel as pr}from"@clack/prompts";import lr from"picocolors";async function st(e){if(e!==void 0)return e;let a=await cr({message:"Initialize git repository?",initialValue:w.git});return pr(a)&&(or(lr.red("Operation cancelled")),process.exit(0)),a}import{cancel as dr,confirm as ur,isCancel as mr}from"@clack/prompts";import fr from"picocolors";async function it(e){if(e!==void 0)return e;let a=await ur({message:"Install dependencies?",initialValue:!w.noInstall});return mr(a)&&(dr(fr.red("Operation cancelled")),process.exit(0)),!a}import{cancel as hr,isCancel as gr,select as wr}from"@clack/prompts";import br from"picocolors";async function ot(e,a){if(!a)return"none";if(e!==void 0)return e;let t=await wr({message:"Select ORM",options:[{value:"drizzle",label:"Drizzle",hint:"Type-safe, lightweight ORM"},{value:"prisma",label:"Prisma",hint:"Powerful, feature-rich ORM"}],initialValue:w.orm});return gr(t)&&(hr(br.red("Operation cancelled")),process.exit(0)),t}import{cancel as Pr,isCancel as yr,select as jr}from"@clack/prompts";import kr from"picocolors";async function ct(e){if(e!==void 0)return e;let a=Q(),t=await jr({message:"Choose package manager",options:[{value:"npm",label:"npm",hint:"Node Package Manager"},{value:"pnpm",label:"pnpm",hint:"Fast, disk space efficient package manager"},{value:"bun",label:"bun",hint:"All-in-one JavaScript runtime & toolkit"}],initialValue:a});return yr(t)&&(Pr(kr.red("Operation cancelled")),process.exit(0)),t}import{cancel as vr,confirm as xr,isCancel as $r}from"@clack/prompts";import Er from"picocolors";async function pt(e){if(e!==void 0)return e;let a=await xr({message:"Set up Prisma Postgres database?",initialValue:w.prismaPostgres});return $r(a)&&(vr(Er.red("Operation cancelled")),process.exit(0)),a}import H from"node:path";import{cancel as Tr,isCancel as Ar,text as Cr}from"@clack/prompts";import z from"fs-extra";import Rr from"picocolors";var Sr=["<",">",":",'"',"|","?","*"],lt=255;function dt(e){if(e!=="."){if(!e)return"Project name cannot be empty";if(e.length>lt)return`Project name must be less than ${lt} characters`;if(Sr.some(a=>e.includes(a)))return"Project name contains invalid characters";if(e.startsWith(".")||e.startsWith("-"))return"Project name cannot start with a dot or dash";if(e.toLowerCase()==="node_modules"||e.toLowerCase()==="favicon.ico")return"Project name is reserved"}}async function ut(e){if(e)if(e==="."){let s=process.cwd();if(z.readdirSync(s).length===0)return e}else{let s=H.basename(e);if(!dt(s)){let o=H.resolve(process.cwd(),e);if(!z.pathExistsSync(o)||z.readdirSync(o).length===0)return e}}let a=!1,t="",r=w.projectName,n=1;for(;z.pathExistsSync(H.resolve(process.cwd(),r));)r=`${w.projectName}-${n}`,n++;for(;!a;){let s=await Cr({message:"Enter your project name or path (relative to current directory)",placeholder:r,initialValue:e,defaultValue:r,validate:i=>{let o=i.trim()||r;if(o==="."){if(z.readdirSync(process.cwd()).length>0)return"Current directory is not empty. Please choose a different directory.";a=!0;return}let c=H.resolve(process.cwd(),o),p=H.basename(c),l=dt(p);if(l)return l;if(!c.startsWith(process.cwd()))return"Project path must be within current directory";if(z.pathExistsSync(c)&&z.readdirSync(c).length>0)return`Directory "${o}" already exists and is not empty. Please choose a different name or path.`;a=!0}});Ar(s)&&(Tr(Rr.red("Operation cancelled.")),process.exit(0)),t=s||r}return t}import{cancel as Fr,isCancel as Ir,select as Or}from"@clack/prompts";import Dr from"picocolors";async function mt(e){if(e!==void 0)return e;let a=await Or({message:"Select runtime",options:[{value:"bun",label:"Bun",hint:"Fast all-in-one JavaScript runtime"},{value:"node",label:"Node.js",hint:"Traditional Node.js runtime"}],initialValue:w.runtime});return Ir(a)&&(Fr(Dr.red("Operation cancelled")),process.exit(0)),a}import{cancel as Lr,confirm as Nr,isCancel as _r}from"@clack/prompts";import Ur from"picocolors";async function ft(e){if(e!==void 0)return e;let a=await Nr({message:"Set up Turso database?",initialValue:w.turso});return _r(a)&&(Lr(Ur.red("Operation cancelled")),process.exit(0)),a}async function ht(e){let a=await Br({projectName:async()=>ut(e.projectName),frontend:()=>nt(e.frontend),backend:()=>Xe(e.backend),runtime:()=>mt(e.runtime),database:()=>Ye(e.database),orm:({results:t})=>ot(e.orm,t.database!=="none"),auth:({results:t})=>Ke(e.auth,t.database!=="none",t.frontend),turso:({results:t})=>t.database==="sqlite"&&t.orm!=="prisma"?ft(e.turso):Promise.resolve(!1),prismaPostgres:({results:t})=>t.database==="postgres"&&t.orm==="prisma"?pt(e.prismaPostgres):Promise.resolve(!1),addons:({results:t})=>Qe(e.addons,t.frontend),examples:({results:t})=>et(e.examples,t.database,t.frontend,t.backend),git:()=>st(e.git),packageManager:()=>ct(e.packageManager),noInstall:()=>it(e.noInstall)},{onCancel:()=>{Mr(zr.red("Operation cancelled")),process.exit(0)}});return{projectName:a.projectName,frontend:a.frontend,database:a.database,orm:a.orm,auth:a.auth,addons:a.addons,examples:a.examples,git:a.git,packageManager:a.packageManager,noInstall:a.noInstall,turso:a.turso,prismaPostgres:a.prismaPostgres,backend:a.backend,runtime:a.runtime}}import R from"picocolors";function ce(e){let a=[];if(e.projectName&&a.push(`${R.blue("Project Name:")} ${e.projectName}`),e.frontend!==void 0){let t=e.frontend.length>0?e.frontend.join(", "):"none";a.push(`${R.blue("Frontend:")} ${t}`)}if(e.backend!==void 0&&a.push(`${R.blue("Backend Framework:")} ${e.backend}`),e.runtime!==void 0&&a.push(`${R.blue("Runtime:")} ${e.runtime}`),e.database!==void 0&&a.push(`${R.blue("Database:")} ${e.database}`),e.orm!==void 0&&a.push(`${R.blue("ORM:")} ${e.orm}`),e.auth!==void 0&&a.push(`${R.blue("Authentication:")} ${e.auth}`),e.addons!==void 0){let t=e.addons.length>0?e.addons.join(", "):"none";a.push(`${R.blue("Addons:")} ${t}`)}if(e.examples!==void 0){let t=e.examples.length>0?e.examples.join(", "):"none";a.push(`${R.blue("Examples:")} ${t}`)}return e.git!==void 0&&a.push(`${R.blue("Git Init:")} ${e.git}`),e.packageManager!==void 0&&a.push(`${R.blue("Package Manager:")} ${e.packageManager}`),e.noInstall!==void 0&&a.push(`${R.blue("Skip Install:")} ${e.noInstall}`),e.turso!==void 0&&a.push(`${R.blue("Turso Setup:")} ${e.turso}`),e.prismaPostgres!==void 0&&a.push(`${R.blue("Prisma Postgres Setup:")} ${e.prismaPostgres?"Yes":"No"}`),a.join(`
|
|
237
|
+
`)}function gt(e){let a=[];e.database==="none"?a.push("--database none"):(a.push(`--database ${e.database}`),e.orm&&a.push(`--orm ${e.orm}`),e.database==="sqlite"&&a.push(e.turso?"--turso":"--no-turso")),a.push(e.auth?"--auth":"--no-auth"),a.push(e.git?"--git":"--no-git"),a.push(e.noInstall?"--no-install":"--install"),e.runtime&&a.push(`--runtime ${e.runtime}`),e.backend&&a.push(`--backend ${e.backend}`),e.frontend&&e.frontend.length>0&&a.push(`--frontend ${e.frontend.join(" ")}`),e.addons&&e.addons.length>0?a.push(`--addons ${e.addons.join(" ")}`):a.push("--addons none"),e.examples&&e.examples.length>0?a.push(`--examples ${e.examples.join(" ")}`):a.push("--no-examples"),e.packageManager&&a.push(`--package-manager ${e.packageManager}`);let t="",r=e.packageManager;r==="npm"?t="npx create-better-t-stack@latest":r==="pnpm"?t="pnpm create better-t-stack@latest":r==="bun"&&(t="bun create better-t-stack@latest");let n=e.projectName?` ${e.projectName}`:"";return`${t}${n} ${a.join(" ")}`}import Gr from"node:path";import Vr from"fs-extra";var wt=()=>{let e=Gr.join($,"package.json");return Vr.readJSONSync(e).version??"1.0.0"};import bt from"gradient-string";var Pt=`
|
|
237
238
|
\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557
|
|
238
239
|
\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2588\u2588\u2554\u2550\u2550\u255D\u255A\u2550\u2550\u2588\u2588\u2554\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557
|
|
239
240
|
\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D
|
|
@@ -247,10 +248,10 @@ serve(
|
|
|
247
248
|
\u2588\u2588\u2551 \u255A\u2550\u2550\u2550\u2550\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2588\u2588\u2557
|
|
248
249
|
\u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2557
|
|
249
250
|
\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D
|
|
250
|
-
`,
|
|
251
|
-
`),t=Math.max(...a.map(r=>r.length));e<t?console.log(
|
|
251
|
+
`,yt={pink:"#F5C2E7",mauve:"#CBA6F7",red:"#F38BA8",maroon:"#E78284",peach:"#FAB387",yellow:"#F9E2AF",green:"#A6E3A1",teal:"#94E2D5",sky:"#89DCEB",sapphire:"#74C7EC",lavender:"#B4BEFE"},jt=()=>{let e=process.stdout.columns||80,a=Pt.split(`
|
|
252
|
+
`),t=Math.max(...a.map(r=>r.length));e<t?console.log(bt(Object.values(yt)).multiline(`
|
|
252
253
|
\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557
|
|
253
254
|
\u2551 Better T-Stack \u2551
|
|
254
255
|
\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D
|
|
255
|
-
`)):console.log(
|
|
256
|
-
${
|
|
256
|
+
`)):console.log(bt(Object.values(yt)).multiline(Pt))};process.on("SIGINT",()=>{S.error(g.red("Operation cancelled")),process.exit(0)});var pe=new Hr;async function Qr(){let e=Date.now();pe.name("create-better-t-stack").description("Create a new Better-T Stack project").version(wt()).argument("[project-directory]","Project name/directory").option("-y, --yes","Use default configuration").option("--database <type>","Database type (none, sqlite, postgres)").option("--orm <type>","ORM type (none, drizzle, prisma)").option("--auth","Include authentication").option("--no-auth","Exclude authentication").option("--frontend <types...>","Frontend types (tanstack-router, react-router, tanstack-start, native, none)").option("--addons <types...>","Additional addons (pwa, tauri, biome, husky, none)").option("--examples <types...>","Examples to include (todo, ai)").option("--no-examples","Skip all examples").option("--git","Initialize git repository").option("--no-git","Skip git initialization").option("--package-manager <pm>","Package manager (npm, pnpm, bun)").option("--install","Install dependencies").option("--no-install","Skip installing dependencies").option("--turso","Set up Turso for SQLite database").option("--no-turso","Skip Turso setup").option("--prisma-postgres","Set up Prisma Postgres").option("--no-prisma-postgres","Skip Prisma Postgres setup").option("--backend <framework>","Backend framework (hono, elysia)").option("--runtime <runtime>","Runtime (bun, node)").parse();let a=Jr();try{jt(),qr(g.magenta("Creating a new Better-T-Stack project"));let t=pe.opts(),r=pe.args[0];Kr(t);let n=Xr(t,r);!t.yes&&Object.keys(n).length>0&&(S.info(g.yellow("Using these pre-selected options:")),S.message(ce(n)),S.message(""));let s=t.yes?{...w,projectName:r??w.projectName,...n}:await ht(n);t.yes&&(S.info(g.yellow("Using these default options:")),S.message(ce(s)),S.message("")),await He(s),S.success(g.blue(`You can reproduce this setup with the following command:
|
|
257
|
+
${g.white(gt(s))}`));let i=((Date.now()-e)/1e3).toFixed(2);Wr(g.magenta(`Project created successfully in ${g.bold(i)} seconds!`))}catch(t){a.stop(g.red("Failed")),t instanceof Error&&(v(g.red(`An unexpected error occurred: ${t.message}`)),process.exit(1))}}function Kr(e){if(e.database&&!["none","sqlite","postgres"].includes(e.database)&&(v(g.red(`Invalid database type: ${e.database}. Must be none, sqlite, or postgres.`)),process.exit(1)),e.orm&&!["none","drizzle","prisma"].includes(e.orm)&&(v(g.red(`Invalid ORM type: ${e.orm}. Must be none, drizzle, or prisma.`)),process.exit(1)),e.database==="none"&&(e.auth===!0&&(v(g.red("Authentication requires a database. Cannot use --auth with --database none.")),process.exit(1)),e.orm&&e.orm!=="none"&&(v(g.red(`Cannot use ORM with no database. Cannot use --orm ${e.orm} with --database none.`)),process.exit(1)),"turso"in e&&e.turso===!0&&(v(g.red("Turso setup requires a SQLite database. Cannot use --turso with --database none.")),process.exit(1))),"turso"in e&&e.turso===!0&&e.database&&e.database!=="sqlite"&&(v(g.red(`Turso setup requires a SQLite database. Cannot use --turso with --database ${e.database}`)),process.exit(1)),"turso"in e&&e.turso===!0&&e.orm==="prisma"&&(v(g.red("Turso setup is not compatible with Prisma. Cannot use --turso with --orm prisma")),process.exit(1)),"prismaPostgres"in e&&e.prismaPostgres===!0&&(e.database&&e.database!=="postgres"||e.orm&&e.orm!=="prisma")&&(v(g.red("Prisma PostgreSQL setup requires PostgreSQL database with Prisma ORM. Cannot use --prisma-postgres with incompatible database or ORM options.")),process.exit(1)),e.packageManager&&!["npm","pnpm","bun"].includes(e.packageManager)&&(v(g.red(`Invalid package manager: ${e.packageManager}. Must be npm, pnpm, or bun.`)),process.exit(1)),e.backend&&!["hono","elysia"].includes(e.backend)&&(v(g.red(`Invalid backend framework: ${e.backend}. Must be hono or elysia.`)),process.exit(1)),e.runtime&&!["bun","node"].includes(e.runtime)&&(v(g.red(`Invalid runtime: ${e.runtime}. Must be bun or node.`)),process.exit(1)),e.examples&&Array.isArray(e.examples)&&e.examples.length>0){let a=["todo","ai"],t=e.examples.filter(r=>!a.includes(r));t.length>0&&(v(g.red(`Invalid example(s): ${t.join(", ")}. Valid options are: ${a.join(", ")}.`)),process.exit(1)),e.examples.includes("ai")&&e.backend==="elysia"&&(v(g.red("AI example is only compatible with Hono backend. Cannot use --examples ai with --backend elysia")),process.exit(1)),e.frontend&&!e.frontend.some(r=>["tanstack-router","react-router","tanstack-start"].includes(r))&&!e.frontend.includes("none")&&(v(g.red("Examples require a web frontend. Cannot use --examples with --frontend native only")),process.exit(1))}if(e.frontend&&e.frontend.length>0){let a=["tanstack-router","react-router","tanstack-start","native","none"],t=e.frontend.filter(n=>!a.includes(n));t.length>0&&(v(g.red(`Invalid frontend(s): ${t.join(", ")}. Valid options are: ${a.join(", ")}.`)),process.exit(1)),e.frontend.filter(n=>n==="tanstack-router"||n==="react-router"||n==="tanstack-start").length>1&&(v(g.red("Cannot select multiple web frameworks. Choose only one of: tanstack-router, tanstack-start, react-router")),process.exit(1)),e.frontend.includes("none")&&e.frontend.length>1&&(v(g.red("Cannot combine 'none' with other frontend options.")),process.exit(1))}if(e.addons&&Array.isArray(e.addons)&&e.addons.length>0){let a=["pwa","tauri","biome","husky","none"],t=e.addons.filter(s=>!a.includes(s));t.length>0&&(v(g.red(`Invalid addon(s): ${t.join(", ")}. Valid options are: ${a.join(", ")}.`)),process.exit(1)),e.addons.includes("none")&&e.addons.length>1&&(v(g.red("Cannot combine 'none' with other addons.")),process.exit(1));let r=["pwa","tauri"];e.addons.some(s=>r.includes(s))&&e.frontend&&!e.frontend.some(s=>["tanstack-router","react-router"].includes(s))&&(v(g.red(`PWA and Tauri addons require tanstack-router or react-router. Cannot use --addons ${e.addons.filter(s=>r.includes(s)).join(", ")} with incompatible frontend options.`)),process.exit(1))}}function Xr(e,a){let t;if(e.frontend)if(e.frontend.includes("none"))t=[];else{t=e.frontend.filter(j=>j==="tanstack-router"||j==="react-router"||j==="tanstack-start"||j==="native");let C=t.filter(j=>j==="tanstack-router"||j==="react-router"||j==="tanstack-start");if(C.length>1){let j=C[0];t=t.filter(A=>A==="native"||A===j)}}let r=e.database,n;e.orm&&(n=e.orm),"prismaPostgres"in e&&e.prismaPostgres===!0&&(r||(r="postgres"),n||(n="prisma"));let s="auth"in e?e.auth:void 0,i="turso"in e?e.turso:void 0,o="prismaPostgres"in e?e.prismaPostgres:void 0;(r==="none"||r==="sqlite"&&r!==void 0||n!==void 0&&n!=="prisma")&&(o=!1),r==="none"&&(n="none",s=!1,i=!1);let c;"examples"in e&&(e.examples===!1?c=[]:Array.isArray(e.examples)&&(c=e.examples.filter(C=>C==="todo"||C==="ai"),t&&t.length>0&&!t.some(C=>["tanstack-router","react-router","tanstack-start"].includes(C))&&(c=[],S.warn(g.yellow("Examples require web frontend - ignoring examples flag"))),c.includes("ai")&&e.backend==="elysia"&&(c=c.filter(C=>C!=="ai"),S.warn(g.yellow("AI example is not compatible with Elysia - removing AI example")))));let p;if(e.addons&&Array.isArray(e.addons))if(e.addons.includes("none"))p=[];else{if(p=e.addons.filter(j=>j==="pwa"||j==="tauri"||j==="biome"||j==="husky"),!t?.some(j=>j==="tanstack-router"||j==="react-router")){let j=["pwa","tauri"],A=p.filter(I=>!j.includes(I));A.length!==p.length&&(S.warn(g.yellow("PWA and Tauri addons require tanstack-router or react-router - removing these addons")),p=A)}p.includes("husky")&&!p.includes("biome")&&p.push("biome")}let l=e.backend,m=e.runtime,x=e.packageManager,y={};return a&&(y.projectName=a),r!==void 0&&(y.database=r),n!==void 0&&(y.orm=n),s!==void 0&&(y.auth=s),x&&(y.packageManager=x),"git"in e&&(y.git=e.git),"install"in e&&(y.noInstall=!e.install),i!==void 0&&(y.turso=i),o!==void 0&&(y.prismaPostgres=o),l&&(y.backend=l),m&&(y.runtime=m),t!==void 0&&(y.frontend=t),p!==void 0&&(y.addons=p),c!==void 0&&(y.examples=c),y}Qr().catch(e=>{S.error("Aborting installation..."),e instanceof Error?S.error(e.message):(S.error("An unknown error has occurred. Please open an issue on GitHub with the below:"),console.log(e)),process.exit(1)});
|