create-better-t-stack 2.4.0 → 2.4.1
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/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -133,7 +133,7 @@ DATABASE_AUTH_TOKEN=`;await h.ensureDir(e.dirname(r)),await h.writeFile(r,i)}fun
|
|
|
133
133
|
4. Add these credentials to the .env file in apps/server/.env
|
|
134
134
|
|
|
135
135
|
DATABASE_URL=your_database_url
|
|
136
|
-
DATABASE_AUTH_TOKEN=your_auth_token`)}async function ke(r){let{projectName:i,orm:s}=r,c=e.resolve(process.cwd(),i),l=s===`drizzle`,u=d();u.start(`Setting up Turso database`);try{let r=S.platform(),i=r===`darwin`,s=r===`linux`,l=r===`win32`;if(l){u.stop(g.yellow(`Turso setup not supported on Windows`)),o.warn(g.yellow(`Automatic Turso setup is not supported on Windows.`)),await z(c),B();return}u.stop(`Checking Turso CLI`);let p=await Se();if(!p){let e=await n({message:`Would you like to install Turso CLI?`,initialValue:!0});if(a(e)&&(t(g.red(`Operation cancelled`)),process.exit(0)),!e){await z(c),B();return}await Te(i)}let m=await Ce();m||await we();let h=await De(),_=!1,v=``,y=e.basename(c);for(;!_;){let e=await f({message:`Enter a name for your database:`,defaultValue:y,initialValue:y,placeholder:y});a(e)&&(t(g.red(`Operation cancelled`)),process.exit(0)),v=e;try{let e=await Oe(v,h),t=d();t.start(`Writing configuration to .env file`),await z(c,e),t.stop(`Turso database configured successfully!`),_=!0}catch(e){e instanceof Error&&e.message===`DATABASE_EXISTS`&&(o.warn(g.yellow(`Database "${g.red(v)}" already exists`)),y=`${v}-${Math.floor(Math.random()*1e3)}`)}}}catch(e){u.stop(g.red(`Failed to set up Turso database`)),p.error(g.red(`Error during Turso setup: ${e instanceof Error?e.message:String(e)}`)),await z(c),B(),o.success(`Setup completed with manual configuration required.`)}}async function V(e,t,n){let r=d();try{let i=N(e,t);
|
|
136
|
+
DATABASE_AUTH_TOKEN=your_auth_token`)}async function ke(r){let{projectName:i,orm:s}=r,c=e.resolve(process.cwd(),i),l=s===`drizzle`,u=d();u.start(`Setting up Turso database`);try{let r=S.platform(),i=r===`darwin`,s=r===`linux`,l=r===`win32`;if(l){u.stop(g.yellow(`Turso setup not supported on Windows`)),o.warn(g.yellow(`Automatic Turso setup is not supported on Windows.`)),await z(c),B();return}u.stop(`Checking Turso CLI`);let p=await Se();if(!p){let e=await n({message:`Would you like to install Turso CLI?`,initialValue:!0});if(a(e)&&(t(g.red(`Operation cancelled`)),process.exit(0)),!e){await z(c),B();return}await Te(i)}let m=await Ce();m||await we();let h=await De(),_=!1,v=``,y=e.basename(c);for(;!_;){let e=await f({message:`Enter a name for your database:`,defaultValue:y,initialValue:y,placeholder:y});a(e)&&(t(g.red(`Operation cancelled`)),process.exit(0)),v=e;try{let e=await Oe(v,h),t=d();t.start(`Writing configuration to .env file`),await z(c,e),t.stop(`Turso database configured successfully!`),_=!0}catch(e){e instanceof Error&&e.message===`DATABASE_EXISTS`&&(o.warn(g.yellow(`Database "${g.red(v)}" already exists`)),y=`${v}-${Math.floor(Math.random()*1e3)}`)}}}catch(e){u.stop(g.red(`Failed to set up Turso database`)),p.error(g.red(`Error during Turso setup: ${e instanceof Error?e.message:String(e)}`)),await z(c),B(),o.success(`Setup completed with manual configuration required.`)}}async function V(e,t,n){let r=d();try{let i=N(e,t);n&&r.start(n);let a=await x(i,{shell:!0});return n&&r.stop(g.green(`Completed`)),a}catch(e){throw r&&r.stop(g.red(`Failed: ${n}`)),e}}async function Ae(e){try{let t=`neonctl projects list`,n=await V(e,t);return!n.stdout.includes(`not authenticated`)&&!n.stdout.includes(`error`)}catch{return!1}}async function je(e){try{return await V(e,`neonctl auth`,`Authenticating with Neon...`),o.success(`Authenticated with Neon successfully!`),!0}catch{m.error(g.red(`Failed to authenticate with Neon`))}}async function Me(e,t){try{let n=`neonctl projects create --name "${e}" --output json`,{stdout:r}=await V(t,n,`Creating Neon project "${e}"...`),i=JSON.parse(r);if(i.project&&i.connection_uris&&i.connection_uris.length>0){let e=i.project.id,t=i.connection_uris[0].connection_uri,n=i.connection_uris[0].connection_parameters;return{connectionString:t,projectId:e,dbName:n.database,roleName:n.role}}return m.error(g.red(`Failed to extract connection information from response`)),null}catch{m.error(g.red(`Failed to create Neon project`))}}async function H(t,n){let r=e.join(t,`apps/server`,`.env`),i=n?`DATABASE_URL="${n.connectionString}"`:`DATABASE_URL="postgresql://postgres:postgres@localhost:5432/mydb?schema=public"`;return await h.ensureDir(e.dirname(r)),await h.writeFile(r,i),!0}function Ne(){o.info(`Manual Neon PostgreSQL Setup Instructions:
|
|
137
137
|
|
|
138
138
|
1. Visit https://neon.tech and create an account
|
|
139
139
|
2. Create a new project from the dashboard
|
package/package.json
CHANGED