create-lx2-app 0.11.5-beta.c6e566f → 0.11.5-beta.d3a3f4c

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 +5 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
- import bt from"path";import{execa as ei}from"execa";import vt from"fs-extra";import ke from"path";import{fileURLToPath as wt}from"url";var xt=wt(import.meta.url),Pt=ke.dirname(xt),m=ke.join(Pt,"../"),Se=` ___ ___ ___ _ _____ ___ _ ___ _ ___ ___
2
+ import bt from"path";import{execa as Zt}from"execa";import vt from"fs-extra";import Pe from"path";import{fileURLToPath as wt}from"url";var xt=wt(import.meta.url),kt=Pe.dirname(xt),m=Pe.join(kt,"../"),Se=` ___ ___ ___ _ _____ ___ _ ___ _ ___ ___
3
3
  / __| _ \\ __| /_\\_ _| __| | | __ __|_ ) /_\\ | _ \\ _ \\
4
4
  | (__| / _| / _ \\| | | _| | |__\\ \\ / / / / _ \\| _/ _/
5
5
  \\___|_|_\\___/_/ \\_\\_| |___| |____/_\\_\\/___| /_/ \\_\\_| |_|
6
- `,F="my-lx2-app",le="create-lx2-app",R=[{packages:["payload"],message:"Our Payload CMS integration does not yet support other packages."},{packages:["trpc","payload"]}];import{confirm as ee,input as He,select as U}from"@inquirer/prompts";import{Command as Ut}from"commander";import je from"path";import kt from"fs-extra";var _e=({projectDir:e,packages:t})=>{let n=t?.payload.inUse,s=je.join(m,"template/packages/config/next",`${n?"with-payload":"base"}.ts`),i=je.join(e,"next.config.ts");kt.copyFileSync(s,i)};var v=()=>{let e=process.env.npm_config_user_agent;return e?e.startsWith("yarn")?"yarn":e.startsWith("pnpm")?"pnpm":e.startsWith("bun")?"bun":"npm":"npm"};import I from"path";import ce from"fs-extra";var Ae={"next-auth":"^5.0.0-beta.25","@auth/prisma-adapter":"^2.11.1","@auth/drizzle-adapter":"^1.11.1","better-auth":"^1.4.6","better-sqlite3":"^12.5.0","@types/better-sqlite3":"^7.6.13",prisma:"^7.1.0","@prisma/client":"^7.1.0","@prisma/client-runtime-utils":"^7.2.0","@prisma/adapter-better-sqlite3":"^7.2.0","@prisma/adapter-libsql":"^7.2.0","@prisma/adapter-mariadb":"^7.2.0","@prisma/adapter-pg":"^7.2.0","drizzle-orm":"^0.45.0","drizzle-kit":"^0.31.8","@libsql/client":"^0.15.15",mysql2:"^3.15.3",postgres:"^3.4.7","@trpc/server":"^11.7.2","@trpc/client":"^11.7.2","@trpc/react-query":"^11.7.2","@tanstack/react-query":"^5.90.10","server-only":"^0.0.1",superjson:"^2.2.5","@t3-oss/env-nextjs":"^0.13.8",zod:"^4.1.13",prettier:"^3.7.4","prettier-plugin-tailwindcss":"^0.7.2","@ianvs/prettier-plugin-sort-imports":"^4.7.0",eslint:"^9.39.1","eslint-config-next":"^16.0.8","@eslint/eslintrc":"^3.3.3","@biomejs/biome":"^2.3.8",typescript:"^5.9.3","@types/node":"^24.10.2","@types/react":"^19.2.7","@types/react-dom":"^19.2.3",payload:"^3.67.0","@payloadcms/next":"^3.67.0","@payloadcms/payload-cloud":"^3.67.0","@payloadcms/richtext-lexical":"^3.67.0","@payloadcms/db-vercel-postgres":"^3.67.0","@payloadcms/db-sqlite":"^3.67.0",graphql:"^16.12.0",sharp:"^0.34.5"};import Ie from"path";import Ce from"fs-extra";import St from"sort-package-json";var u=e=>{let{dependencies:t,devMode:n,projectDir:s}=e,i=Ce.readJsonSync(Ie.join(s,"package.json"));t.forEach(o=>{let r=Ae[o];n&&i.devDependencies?i.devDependencies[o]=r:i.dependencies&&(i.dependencies[o]=r)});let a=St(i);Ce.writeJsonSync(Ie.join(s,"package.json"),a,{spaces:2})};var ze=({projectDir:e,packages:t})=>{let n=t?.prisma.inUse,s=t?.drizzle.inUse,i=["next-auth"];n&&i.push("@auth/prisma-adapter"),s&&i.push("@auth/drizzle-adapter"),u({projectDir:e,dependencies:i,devMode:!1});let a=I.join(m,"template/packages"),o="src/app/api/auth/[...nextauth]/route.ts",r=I.join(a,o),l=I.join(e,o),g=I.join(a,"src/server/auth/config",n?"authjs-with-prisma.ts":s?"authjs-with-drizzle.ts":"authjs.ts"),f=I.join(e,"src/server/auth/config.ts"),p=I.join(a,"src/server/auth/authjs.ts"),d=I.join(e,"src/server/auth/index.ts");ce.copySync(r,l),ce.copySync(g,f),ce.copySync(p,d)};import j from"path";import L from"fs-extra";import jt from"path";import De from"fs-extra";import{sortPackageJson as _t}from"sort-package-json";function w(e){let{scripts:t,projectDir:n}=e,s=jt.join(n,"package.json"),i=De.readJSONSync(s);i.scripts={...i.scripts,...t};let a=_t(i);De.writeJSONSync(s,a,{spaces:2})}var Re=({projectDir:e,packages:t,databaseProvider:n})=>{let s=t?.prisma.inUse,i=t?.drizzle.inUse,a=s||i,o=["better-auth"],r=[];a||o.push("better-sqlite3"),a||r.push("@types/better-sqlite3"),u({projectDir:e,dependencies:o,devMode:!1}),u({projectDir:e,dependencies:r,devMode:!0});let l=j.join(m,"template/packages"),g=j.join(l,"src/app/api/auth/[...betterauth]/route.ts"),f=j.join(e,"src/app/api/auth/[...all]/route.ts"),p=j.join(l,"src/server/auth",s?"better-auth-with-prisma.ts":i?"better-auth-with-drizzle.ts":"better-auth.ts"),d=L.readFileSync(p,"utf-8");(s||i)&&n!=="sqlite"&&(d=d.replace('provider: "sqlite",',`provider: "${{mysql:"mysql",postgresql:i?"pg":"postgresql"}[n]}",`));let b=j.join(e,"src/server/auth/index.ts");L.mkdirSync(j.dirname(b),{recursive:!0}),L.writeFileSync(b,d);let P=j.join(l,"src/lib/auth/better-auth-client.ts"),D=j.join(e,"src/lib/auth/client.ts");w({projectDir:e,scripts:{"auth:generate":"npx @better-auth/cli@latest generate --config ./src/server/auth/index.ts --yes",...!s&&!i&&{"auth:migrate":"npx @better-auth/cli@latest migrate --config ./src/server/auth/index.ts --yes"}}}),L.copySync(g,f),L.copySync(P,D)};import pe from"path";import At from"fs-extra";var Te=({projectDir:e})=>{u({projectDir:e,dependencies:["@biomejs/biome"],devMode:!0});let t=pe.join(m,"template/packages"),n=pe.join(t,"config/biome.jsonc"),s=pe.join(e,"biome.jsonc");At.copyFileSync(n,s),w({projectDir:e,scripts:{"lint:unsafe":"biome check --write --unsafe .","lint:write":"biome check --write .",lint:"biome check .",format:"biome format --write ."}})};import _ from"path";import C from"fs-extra";var Oe=({projectDir:e,packages:t,scopedAppName:n,databaseProvider:s})=>{let i=t?.authjs.inUse,a=t?.betterAuth.inUse;u({projectDir:e,dependencies:["drizzle-kit"],devMode:!0}),u({projectDir:e,dependencies:["drizzle-orm",{sqlite:"@libsql/client",mysql:"mysql2",postgresql:"postgres"}[s]],devMode:!1});let o=_.join(m,"template/packages"),r=_.join(o,"config/drizzle",{sqlite:"with-sqlite",mysql:"with-mysql",postgresql:"with-postgresql"}[s]+".ts"),l=_.join(e,"drizzle.config.ts"),g=_.join(o,"src/server/db/schema-drizzle",i?`with-authjs-${s}.ts`:a?`with-better-auth-${s}.ts`:`base-${s}.ts`),f=_.join(e,"src/server/db/schema.ts"),p=C.readFileSync(g,"utf-8");p=p.replace("project1_${name}",`${n}_\${name}`);let d=C.readFileSync(r,"utf-8");d=d.replace("project1_*",`${n}_*`);let b=_.join(o,`src/server/db/index-drizzle/with-${s}.ts`),P=_.join(e,"src/server/db/index.ts");w({projectDir:e,scripts:{"db:generate":"drizzle-kit generate","db:migrate":"drizzle-kit migrate","db:push":"drizzle-kit push","db:studio":"drizzle-kit studio"}}),C.copySync(r,l),C.mkdirSync(_.dirname(f),{recursive:!0}),C.writeFileSync(f,p),C.writeFileSync(l,d),C.copySync(b,P)};import V from"path";import de from"fs-extra";var Ue=({projectDir:e,scopedAppName:t,packages:n,databaseProvider:s})=>{let i=n?.envVariables.inUse,a=n?.authjs.inUse,o=n?.betterAuth.inUse,r=n?.trpc.inUse,l=n?.prisma.inUse,g=n?.drizzle.inUse,f=n?.payload.inUse,p=[];i&&(p.push("@t3-oss/env-nextjs"),p.push("zod")),u({projectDir:e,dependencies:p,devMode:!1});let d=l||g,b=It(!!a,!!o,!!r,!!l,!!g,!!f,t,s),D=[{condition:d&&r&&o,file:"with-trpc-better-auth-db.js"},{condition:d&&r&&a,file:"with-trpc-authjs-db.js"},{condition:d&&r,file:"with-trpc-db.js"},{condition:d&&a,file:"with-authjs-db.js"},{condition:d&&o,file:"with-better-auth-db.js"},{condition:r&&a,file:"with-trpc-authjs.js"},{condition:r&&o,file:"with-trpc-better-auth.js"},{condition:f,file:"with-payload.js"},{condition:d,file:"with-db.js"},{condition:r,file:"with-trpc.js"},{condition:a,file:"with-authjs.js"},{condition:o,file:"with-better-auth.js"}].find(q=>q.condition)?.file||"";if(D!==""){let q=V.join(m,"template/packages/src/env",D),J=V.join(e,"src/env.ts");de.copyFileSync(q,J)}let ie=V.join(e,".env"),se=V.join(e,".env.example"),ne=Ct+b,E=Buffer.from(crypto.getRandomValues(new Uint8Array(32))).toString("base64"),ae=b.replace('AUTH_SECRET=""',`AUTH_SECRET="${E}" # Generated by create-lx2-app`).replace('BETTER_AUTH_SECRET=""',`BETTER_AUTH_SECRET="${E}" # Generated by create-lx2-app`).replace('PAYLOAD_SECRET=""',`PAYLOAD_SECRET="${E}" # Generated by create-lx2-app`);de.writeFileSync(ie,ae,"utf-8"),de.writeFileSync(se,ne,"utf-8")};function It(e,t,n,s,i,a,o,r){let l=`
6
+ `,F="my-lx2-app",le="create-lx2-app",R=[{packages:["payload"],message:"Our Payload CMS integration does not yet support other packages."},{packages:["trpc","payload"]}];import{confirm as ee,input as He,select as U}from"@inquirer/prompts";import{Command as Ut}from"commander";import je from"path";import Pt from"fs-extra";var _e=({projectDir:e,packages:t})=>{let n=t?.payload.inUse,s=je.join(m,"template/packages/config/next",`${n?"with-payload":"base"}.ts`),i=je.join(e,"next.config.ts");Pt.copyFileSync(s,i)};var v=()=>{let e=process.env.npm_config_user_agent;return e?e.startsWith("yarn")?"yarn":e.startsWith("pnpm")?"pnpm":e.startsWith("bun")?"bun":"npm":"npm"};import I from"path";import ce from"fs-extra";var Ae={"next-auth":"^5.0.0-beta.25","@auth/prisma-adapter":"^2.11.1","@auth/drizzle-adapter":"^1.11.1","better-auth":"^1.4.6","better-sqlite3":"^12.5.0","@types/better-sqlite3":"^7.6.13",prisma:"^7.1.0","@prisma/client":"^7.1.0","@prisma/client-runtime-utils":"^7.2.0","@prisma/adapter-better-sqlite3":"^7.2.0","@prisma/adapter-libsql":"^7.2.0","@prisma/adapter-mariadb":"^7.2.0","@prisma/adapter-pg":"^7.2.0","drizzle-orm":"^0.45.0","drizzle-kit":"^0.31.8","@libsql/client":"^0.15.15",mysql2:"^3.15.3",postgres:"^3.4.7","@trpc/server":"^11.7.2","@trpc/client":"^11.7.2","@trpc/react-query":"^11.7.2","@tanstack/react-query":"^5.90.10","server-only":"^0.0.1",superjson:"^2.2.5","@t3-oss/env-nextjs":"^0.13.8",zod:"^4.1.13",prettier:"^3.7.4","prettier-plugin-tailwindcss":"^0.7.2","@ianvs/prettier-plugin-sort-imports":"^4.7.0",eslint:"^9.39.1","eslint-config-next":"^16.0.8","@eslint/eslintrc":"^3.3.3","@biomejs/biome":"^2.3.8",typescript:"^5.9.3","@types/node":"^24.10.2","@types/react":"^19.2.7","@types/react-dom":"^19.2.3",payload:"^3.67.0","@payloadcms/next":"^3.67.0","@payloadcms/payload-cloud":"^3.67.0","@payloadcms/richtext-lexical":"^3.67.0","@payloadcms/db-vercel-postgres":"^3.67.0","@payloadcms/db-sqlite":"^3.67.0",graphql:"^16.12.0",sharp:"^0.34.5"};import Ie from"path";import Ce from"fs-extra";import St from"sort-package-json";var u=e=>{let{dependencies:t,devMode:n,projectDir:s}=e,i=Ce.readJsonSync(Ie.join(s,"package.json"));t.forEach(o=>{let r=Ae[o];n&&i.devDependencies?i.devDependencies[o]=r:i.dependencies&&(i.dependencies[o]=r)});let a=St(i);Ce.writeJsonSync(Ie.join(s,"package.json"),a,{spaces:2})};var ze=({projectDir:e,packages:t})=>{let n=t?.prisma.inUse,s=t?.drizzle.inUse,i=["next-auth"];n&&i.push("@auth/prisma-adapter"),s&&i.push("@auth/drizzle-adapter"),u({projectDir:e,dependencies:i,devMode:!1});let a=I.join(m,"template/packages"),o="src/app/api/auth/[...nextauth]/route.ts",r=I.join(a,o),l=I.join(e,o),g=I.join(a,"src/server/auth/config",n?"authjs-with-prisma.ts":s?"authjs-with-drizzle.ts":"authjs.ts"),f=I.join(e,"src/server/auth/config.ts"),p=I.join(a,"src/server/auth/authjs.ts"),d=I.join(e,"src/server/auth/index.ts");ce.copySync(r,l),ce.copySync(g,f),ce.copySync(p,d)};import j from"path";import L from"fs-extra";import jt from"path";import De from"fs-extra";import{sortPackageJson as _t}from"sort-package-json";function w(e){let{scripts:t,projectDir:n}=e,s=jt.join(n,"package.json"),i=De.readJSONSync(s);i.scripts={...i.scripts,...t};let a=_t(i);De.writeJSONSync(s,a,{spaces:2})}var Re=({projectDir:e,packages:t,databaseProvider:n})=>{let s=t?.prisma.inUse,i=t?.drizzle.inUse,a=s||i,o=["better-auth"],r=[];a||o.push("better-sqlite3"),a||r.push("@types/better-sqlite3"),u({projectDir:e,dependencies:o,devMode:!1}),u({projectDir:e,dependencies:r,devMode:!0});let l=j.join(m,"template/packages"),g=j.join(l,"src/app/api/auth/[...betterauth]/route.ts"),f=j.join(e,"src/app/api/auth/[...all]/route.ts"),p=j.join(l,"src/server/auth",s?"better-auth-with-prisma.ts":i?"better-auth-with-drizzle.ts":"better-auth.ts"),d=L.readFileSync(p,"utf-8");(s||i)&&n!=="sqlite"&&(d=d.replace('provider: "sqlite",',`provider: "${{mysql:"mysql",postgresql:i?"pg":"postgresql"}[n]}",`));let b=j.join(e,"src/server/auth/index.ts");L.mkdirSync(j.dirname(b),{recursive:!0}),L.writeFileSync(b,d);let k=j.join(l,"src/lib/auth/better-auth-client.ts"),D=j.join(e,"src/lib/auth/client.ts");w({projectDir:e,scripts:{"auth:generate":"npx @better-auth/cli@latest generate --config ./src/server/auth/index.ts --yes",...!s&&!i&&{"auth:migrate":"npx @better-auth/cli@latest migrate --config ./src/server/auth/index.ts --yes"}}}),L.copySync(g,f),L.copySync(k,D)};import pe from"path";import At from"fs-extra";var Te=({projectDir:e})=>{u({projectDir:e,dependencies:["@biomejs/biome"],devMode:!0});let t=pe.join(m,"template/packages"),n=pe.join(t,"config/biome.jsonc"),s=pe.join(e,"biome.jsonc");At.copyFileSync(n,s),w({projectDir:e,scripts:{"lint:unsafe":"biome check --write --unsafe .","lint:write":"biome check --write .",lint:"biome check .",format:"biome format --write ."}})};import _ from"path";import C from"fs-extra";var Oe=({projectDir:e,packages:t,scopedAppName:n,databaseProvider:s})=>{let i=t?.authjs.inUse,a=t?.betterAuth.inUse;u({projectDir:e,dependencies:["drizzle-kit"],devMode:!0}),u({projectDir:e,dependencies:["drizzle-orm",{sqlite:"@libsql/client",mysql:"mysql2",postgresql:"postgres"}[s]],devMode:!1});let o=_.join(m,"template/packages"),r=_.join(o,"config/drizzle",{sqlite:"with-sqlite",mysql:"with-mysql",postgresql:"with-postgresql"}[s]+".ts"),l=_.join(e,"drizzle.config.ts"),g=_.join(o,"src/server/db/schema-drizzle",i?`with-authjs-${s}.ts`:a?`with-better-auth-${s}.ts`:`base-${s}.ts`),f=_.join(e,"src/server/db/schema.ts"),p=C.readFileSync(g,"utf-8");p=p.replace("project1_${name}",`${n}_\${name}`);let d=C.readFileSync(r,"utf-8");d=d.replace("project1_*",`${n}_*`);let b=_.join(o,`src/server/db/index-drizzle/with-${s}.ts`),k=_.join(e,"src/server/db/index.ts");w({projectDir:e,scripts:{"db:generate":"drizzle-kit generate","db:migrate":"drizzle-kit migrate","db:push":"drizzle-kit push","db:studio":"drizzle-kit studio"}}),C.copySync(r,l),C.mkdirSync(_.dirname(f),{recursive:!0}),C.writeFileSync(f,p),C.writeFileSync(l,d),C.copySync(b,k)};import V from"path";import de from"fs-extra";var Ue=({projectDir:e,scopedAppName:t,packages:n,databaseProvider:s})=>{let i=n?.envVariables.inUse,a=n?.authjs.inUse,o=n?.betterAuth.inUse,r=n?.trpc.inUse,l=n?.prisma.inUse,g=n?.drizzle.inUse,f=n?.payload.inUse,p=[];i&&(p.push("@t3-oss/env-nextjs"),p.push("zod")),u({projectDir:e,dependencies:p,devMode:!1});let d=l||g,b=It(!!a,!!o,!!r,!!l,!!g,!!f,t,s),D=[{condition:d&&r&&o,file:"with-trpc-better-auth-db.js"},{condition:d&&r&&a,file:"with-trpc-authjs-db.js"},{condition:d&&r,file:"with-trpc-db.js"},{condition:d&&a,file:"with-authjs-db.js"},{condition:d&&o,file:"with-better-auth-db.js"},{condition:r&&a,file:"with-trpc-authjs.js"},{condition:r&&o,file:"with-trpc-better-auth.js"},{condition:f,file:"with-payload.js"},{condition:d,file:"with-db.js"},{condition:r,file:"with-trpc.js"},{condition:a,file:"with-authjs.js"},{condition:o,file:"with-better-auth.js"}].find(q=>q.condition)?.file||"";if(D!==""){let q=V.join(m,"template/packages/src/env",D),J=V.join(e,"src/env.ts");de.copyFileSync(q,J)}let ie=V.join(e,".env"),se=V.join(e,".env.example"),ne=Ct+b,E=Buffer.from(crypto.getRandomValues(new Uint8Array(32))).toString("base64"),ae=b.replace('AUTH_SECRET=""',`AUTH_SECRET="${E}" # Generated by create-lx2-app`).replace('BETTER_AUTH_SECRET=""',`BETTER_AUTH_SECRET="${E}" # Generated by create-lx2-app`).replace('PAYLOAD_SECRET=""',`PAYLOAD_SECRET="${E}" # Generated by create-lx2-app`);de.writeFileSync(ie,ae,"utf-8"),de.writeFileSync(se,ne,"utf-8")};function It(e,t,n,s,i,a,o,r){let l=`
7
7
  # When adding additional environment variables, the schema in "/src/env.ts"
8
8
  # should be updated accordingly.
9
9
  `.trim().concat(`
@@ -55,7 +55,7 @@ NEXT_PUBLIC_URL="http://localhost:3000"
55
55
  # ".env" and populate it with your secrets.
56
56
  `.trim().concat(`
57
57
 
58
- `);import H from"path";import Ee from"fs-extra";var qe=({projectDir:e,packages:t})=>{let n=t?.["eslint/prettier"].inUse,s=[];n&&(s.push("eslint"),s.push("eslint-config-next"),s.push("@eslint/eslintrc"),s.push("prettier"),s.push("prettier-plugin-tailwindcss"),s.push("@ianvs/prettier-plugin-sort-imports")),u({projectDir:e,dependencies:s,devMode:!0});let i=H.join(m,"template/packages/config","eslint.config.mjs"),a=H.join(m,"template/packages/config","prettier.config.mjs"),o=H.join(e,"eslint.config.mjs"),r=H.join(e,"prettier.config.mjs");w({projectDir:e,scripts:{"lint:write":"eslint --fix",lint:"eslint",format:"prettier --write ."}}),Ee.copyFileSync(i,o),Ee.copyFileSync(a,r)};import x from"path";import T from"fs-extra";var Me=({projectDir:e,packages:t,databaseProvider:n})=>{let s=[],i=[];if(t?.payload.inUse)switch(s.push("payload"),s.push("@payloadcms/next"),s.push("@payloadcms/payload-cloud"),s.push("@payloadcms/richtext-lexical"),s.push("graphql"),n){case"sqlite":i.push("@payloadcms/db-sqlite");break;case"postgresql":i.push("@payloadcms/db-vercel-postgres");break}u({projectDir:e,dependencies:s,devMode:!1}),u({projectDir:e,dependencies:i,devMode:!1});let a=x.join(m,"template/packages"),o=x.join(a,"config/payload",`${n==="postgresql"?"with-postgres":"with-sqlite"}.ts`),r=x.join(e,"payload.config.ts");T.copyFileSync(o,r);let l=x.join(a,"src/payload/collections"),g=x.join(e,"src/collections");T.mkdirSync(g,{recursive:!0}),T.copyFileSync(x.join(l,"Media.ts"),x.join(g,"Media.ts")),T.copyFileSync(x.join(l,"Users.ts"),x.join(g,"Users.ts"));let f=x.join(a,"src/app/(payload)"),p=x.join(e,"src/app/(payload)");T.mkdirSync(p,{recursive:!0}),T.copySync(f,p),w({projectDir:e,scripts:{payload:"payload","generate:importmap":"payload generate:importmap","generate:types":"payload generate:types"}})};import k from"path";import A from"fs-extra";var $e=({projectDir:e,packages:t,databaseProvider:n,pkgManager:s})=>{let i=t?.authjs.inUse,a=t?.betterAuth.inUse;u({projectDir:e,dependencies:["prisma"],devMode:!0});let o={sqlite:s==="bun"?"@prisma/adapter-libsql":"@prisma/adapter-better-sqlite3",mysql:"@prisma/adapter-mariadb",postgresql:"@prisma/adapter-pg"}[n];u({projectDir:e,dependencies:["@prisma/client",o],devMode:!1}),n==="sqlite"&&s!=="bun"&&u({projectDir:e,dependencies:["@types/better-sqlite3"],devMode:!0}),s==="pnpm"&&u({projectDir:e,dependencies:["@prisma/client-runtime-utils"],devMode:!1});let r=k.join(m,"template/packages"),l=k.join(r,"config/prisma.config.ts"),g=k.join(e,"prisma.config.ts");A.writeFileSync(g,A.readFileSync(l,"utf-8"));let f=k.join(r,"prisma/schema",`${i?"with-authjs":a?"with-better-auth":"base"}.prisma`),p=A.readFileSync(f,"utf-8");n!=="sqlite"&&(p=p.replace('provider = "sqlite"',`provider = "${{mysql:"mysql",postgresql:"postgresql"}[n]}"`),["mysql"].includes(n)&&(p=p.replace("// @db.Text","@db.Text")));let d=k.join(e,"prisma/schema.prisma");A.mkdirSync(k.dirname(d),{recursive:!0}),A.writeFileSync(d,p);let b=k.join(r,`src/server/db/prisma/with-${n}${s==="bun"?"-bun":""}.ts`),P=k.join(e,"src/server/db/index.ts");A.mkdirSync(k.dirname(P),{recursive:!0}),A.writeFileSync(P,A.readFileSync(b,"utf-8")),w({projectDir:e,scripts:{postinstall:"prisma generate","db:push":"prisma db push","db:studio":"prisma studio","db:generate":"prisma migrate dev","db:migrate":"prisma migrate deploy"}})};import h from"path";import zt from"fs-extra";var Fe=({projectDir:e,packages:t})=>{let n=t?.authjs.inUse,s=t?.betterAuth.inUse,i=t?.prisma.inUse,a=t?.drizzle.inUse,o=i||a;u({projectDir:e,dependencies:["@trpc/server","@trpc/client","@trpc/react-query","@tanstack/react-query","server-only","superjson"],devMode:!1});let r=h.join(m,"template/packages"),l="src/app/api/trpc/[trpc]/route.ts",g=h.join(r,l),f=h.join(e,l),p=n&&o?"with-authjs-db.ts":n?"with-authjs.ts":s&&o?"with-betterauth-db.ts":s?"with-betterauth.ts":o?"with-db.ts":"base.ts",d=h.join(r,"src/server/api/init",p),b=h.join(e,"src/server/api/init.ts"),P=h.join(r,"src/server/api/root.ts"),D=h.join(e,"src/server/api/root.ts");function ie({usingAuthjs:M,usingBetterAuth:$,usingPrisma:xe,usingDrizzle:Pe}){return(M||$)&&xe?"with-auth-prisma.ts":(M||$)&&Pe?"with-auth-drizzle.ts":M||$?"with-auth.ts":xe?"with-prisma.ts":Pe?"with-drizzle.ts":"base.ts"}let se=ie({usingAuthjs:n,usingBetterAuth:s,usingPrisma:i,usingDrizzle:a}),ne=h.join(r,"src/server/api/routers/post",se),E=h.join(e,"src/server/api/routers/post.ts"),ae=h.join(r,"src/lib/utils.ts"),q=h.join(e,"src/lib/utils.ts"),J=[[g,f],[d,b],[P,D],[ne,E],[ae,q]],oe=h.join(r,"src/lib/api"),re=h.join(e,"src/lib/api");J.push([h.join(oe,"client.tsx"),h.join(re,"client.tsx")],[h.join(oe,"query-client.ts"),h.join(re,"query-client.ts")],[h.join(oe,"server.ts"),h.join(re,"server.ts")],[h.join(r,"src/components/greeting.tsx"),h.join(e,"src/components/greeting.tsx")]),J.forEach(([M,$])=>{zt.copySync(M,$)})};import Le from"path";import Dt from"fs-extra";var Be=({projectDir:e,packages:t})=>{let n=t?.typescript.inUse,s=t?.payload.inUse,i=[];n&&(i.push("typescript"),i.push("@types/node"),i.push("@types/react"),i.push("@types/react-dom")),u({projectDir:e,dependencies:i,devMode:!0});let a=Le.join(m,"template/packages/config/tsconfig",`${s?"with-payload":"base"}.json`),o=Le.join(e,"tsconfig.json");Dt.copyFileSync(a,o)};var Ne=["authjs","betterAuth","trpc","prisma","drizzle","envVariables","eslint/prettier","biome","typescript","nextjs","payload"],Ge=["nextjs","payload"],me=["none","authjs","betterAuth"],fe=["none","prisma","drizzle"],K=["sqlite","mysql","postgresql"];var We=e=>({authjs:{inUse:e.includes("authjs"),installer:ze},betterAuth:{inUse:e.includes("betterAuth"),installer:Re},trpc:{inUse:e.includes("trpc"),installer:Fe},prisma:{inUse:e.includes("prisma"),installer:$e},drizzle:{inUse:e.includes("drizzle"),installer:Oe},envVariables:{inUse:!0,installer:Ue},"eslint/prettier":{inUse:e.includes("eslint/prettier"),installer:qe},biome:{inUse:e.includes("biome"),installer:Te},typescript:{inUse:!0,installer:Be},nextjs:{inUse:!0,installer:_e},payload:{inUse:e.includes("payload"),installer:Me}});function Y(e){return Ne.includes(e)}function X(e){let t=[];e.backend!=="nextjs"&&Y(e.backend)&&t.push(e.backend),e.trpc&&t.push("trpc"),e.authentication!=="none"&&Y(e.authentication)&&t.push(e.authentication),e.orm!=="none"&&Y(e.orm)&&t.push(e.orm),Y(e.linter)&&t.push(e.linter);let n=t.includes("prisma")||t.includes("drizzle")?e.dbProvider:"sqlite";return{packages:t,databaseProvider:n}}import Rt from"path";import Tt from"fs-extra";function O(){let e=Rt.join(m,"package.json");return Tt.readJSONSync(e).version??"1.0.0"}var B=class extends Error{constructor(t){super(t)}};import Q from"chalk";var c={error(...e){console.log(Q.red(...e))},warn(...e){console.log(Q.yellow(...e))},info(...e){console.log(Q.cyan(...e))},success(...e){console.log(Q.green(...e))}};var Z=e=>(e.length>1&&e.endsWith("/")&&(e=e.slice(0,-1)),e);var Ot=/^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/;function Je(e){let t=Z(e),n=t.split("/"),s=n.findIndex(a=>a.startsWith("@")),i=n[n.length-1];return n.findIndex(a=>a.startsWith("@"))!==-1&&(i=n.slice(s).join("/")),t=="."||Ot.test(i??"")?!0:"App name must consist of only lowercase alphanumeric characters, '-', and '_'"}var Ve=e=>e.startsWith(".")||e.startsWith("/")?"Import alias can't start with '.' or '/'":!0;var y={appName:F,packages:[],flags:{git:!1,install:!1,default:!1,CI:!1,trpc:!1,authentication:"none",orm:"none",linter:"eslint/prettier",importAlias:"@/",dbProvider:"sqlite",backend:"nextjs"},databaseProvider:"sqlite"};async function Ke(){let e=y,t=new Ut().name(le).description("CLI for scaffolding new web apps with the Lx2 stack").version(O(),"-v, --version","Output the current version of Create Lx2 App").argument("[dir]","The name of the application, as well as the name of the directory to create").option("--git","Boolean flag to explicitly tell the CLI to initialize a new git repo in the project",!1).option("--install","Boolean flag to explicitly tell the CLI to run the package manager's install command",!1).option("-d, --default","Bypass the CLI and use all default options to bootstrap a new lx2-app",!1).option("--CI","Boolean value if we're running in CI",!1).option("--backend [framework]",`Choose a backend framework to use. Possible values: ${Ge.join(", ")}`,y.flags.backend).option("--trpc [boolean]","Boolean flag to explicitly tell the CLI to set up tRPC in the project",s=>!!s&&s!=="false").option("--authProvider [provider]",`Choose an authentication provider to use. Possible values: ${me.join(", ")}`,y.flags.authentication).option("--databaseORM [orm]",`Choose a database ORM to use. Possible values: ${fe.join(", ")}`,y.flags.orm).option("--linter [linter]",`Choose what linter and formatter to use. Possible values: ${y.flags.linter}`,y.flags.linter).option("-i, --import-alias [alias]","Explicitly tell the CLI to use a custom import alias",y.flags.importAlias).option("--dbProvider [provider]",`Choose a database provider to use. Possible values: ${K.join(", ")}`,y.flags.dbProvider).parse(process.argv);process.env.npm_config_user_agent?.startsWith("yarn/3")&&c.warn(` WARNING: It looks like you are using Yarn 3. This is currently not supported,
58
+ `);import H from"path";import Ee from"fs-extra";var qe=({projectDir:e,packages:t})=>{let n=t?.["eslint/prettier"].inUse,s=[];n&&(s.push("eslint"),s.push("eslint-config-next"),s.push("@eslint/eslintrc"),s.push("prettier"),s.push("prettier-plugin-tailwindcss"),s.push("@ianvs/prettier-plugin-sort-imports")),u({projectDir:e,dependencies:s,devMode:!0});let i=H.join(m,"template/packages/config","eslint.config.mjs"),a=H.join(m,"template/packages/config","prettier.config.mjs"),o=H.join(e,"eslint.config.mjs"),r=H.join(e,"prettier.config.mjs");w({projectDir:e,scripts:{"lint:write":"eslint --fix",lint:"eslint",format:"prettier --write ."}}),Ee.copyFileSync(i,o),Ee.copyFileSync(a,r)};import x from"path";import T from"fs-extra";var Me=({projectDir:e,packages:t,databaseProvider:n})=>{let s=[],i=[];if(t?.payload.inUse)switch(s.push("payload"),s.push("@payloadcms/next"),s.push("@payloadcms/payload-cloud"),s.push("@payloadcms/richtext-lexical"),s.push("graphql"),n){case"sqlite":i.push("@payloadcms/db-sqlite");break;case"postgresql":i.push("@payloadcms/db-vercel-postgres");break}u({projectDir:e,dependencies:s,devMode:!1}),u({projectDir:e,dependencies:i,devMode:!1});let a=x.join(m,"template/packages"),o=x.join(a,"config/payload",`${n==="postgresql"?"with-postgres":"with-sqlite"}.ts`),r=x.join(e,"payload.config.ts");T.copyFileSync(o,r);let l=x.join(a,"src/payload/collections"),g=x.join(e,"src/collections");T.mkdirSync(g,{recursive:!0}),T.copyFileSync(x.join(l,"Media.ts"),x.join(g,"Media.ts")),T.copyFileSync(x.join(l,"Users.ts"),x.join(g,"Users.ts"));let f=x.join(a,"src/app/(payload)"),p=x.join(e,"src/app/(payload)");T.mkdirSync(p,{recursive:!0}),T.copySync(f,p),w({projectDir:e,scripts:{payload:"payload","generate:importmap":"payload generate:importmap","generate:types":"payload generate:types"}})};import P from"path";import A from"fs-extra";var $e=({projectDir:e,packages:t,databaseProvider:n,pkgManager:s})=>{let i=t?.authjs.inUse,a=t?.betterAuth.inUse;u({projectDir:e,dependencies:["prisma"],devMode:!0});let o={sqlite:s==="bun"?"@prisma/adapter-libsql":"@prisma/adapter-better-sqlite3",mysql:"@prisma/adapter-mariadb",postgresql:"@prisma/adapter-pg"}[n];u({projectDir:e,dependencies:["@prisma/client",o],devMode:!1}),n==="sqlite"&&s!=="bun"&&u({projectDir:e,dependencies:["@types/better-sqlite3"],devMode:!0}),s==="pnpm"&&u({projectDir:e,dependencies:["@prisma/client-runtime-utils"],devMode:!1});let r=P.join(m,"template/packages"),l=P.join(r,"config/prisma.config.ts"),g=P.join(e,"prisma.config.ts");A.writeFileSync(g,A.readFileSync(l,"utf-8"));let f=P.join(r,"prisma/schema",`${i?"with-authjs":a?"with-better-auth":"base"}.prisma`),p=A.readFileSync(f,"utf-8");n!=="sqlite"&&(p=p.replace('provider = "sqlite"',`provider = "${{mysql:"mysql",postgresql:"postgresql"}[n]}"`),["mysql"].includes(n)&&(p=p.replace("// @db.Text","@db.Text")));let d=P.join(e,"prisma/schema.prisma");A.mkdirSync(P.dirname(d),{recursive:!0}),A.writeFileSync(d,p);let b=P.join(r,`src/server/db/prisma/with-${n}${s==="bun"?"-bun":""}.ts`),k=P.join(e,"src/server/db/index.ts");A.mkdirSync(P.dirname(k),{recursive:!0}),A.writeFileSync(k,A.readFileSync(b,"utf-8")),w({projectDir:e,scripts:{postinstall:"prisma generate","db:push":"prisma db push","db:studio":"prisma studio","db:generate":"prisma migrate dev","db:migrate":"prisma migrate deploy"}})};import h from"path";import zt from"fs-extra";var Fe=({projectDir:e,packages:t})=>{let n=t?.authjs.inUse,s=t?.betterAuth.inUse,i=t?.prisma.inUse,a=t?.drizzle.inUse,o=i||a;u({projectDir:e,dependencies:["@trpc/server","@trpc/client","@trpc/react-query","@tanstack/react-query","server-only","superjson"],devMode:!1});let r=h.join(m,"template/packages"),l="src/app/api/trpc/[trpc]/route.ts",g=h.join(r,l),f=h.join(e,l),p=n&&o?"with-authjs-db.ts":n?"with-authjs.ts":s&&o?"with-betterauth-db.ts":s?"with-betterauth.ts":o?"with-db.ts":"base.ts",d=h.join(r,"src/server/api/init",p),b=h.join(e,"src/server/api/init.ts"),k=h.join(r,"src/server/api/root.ts"),D=h.join(e,"src/server/api/root.ts");function ie({usingAuthjs:M,usingBetterAuth:$,usingPrisma:xe,usingDrizzle:ke}){return(M||$)&&xe?"with-auth-prisma.ts":(M||$)&&ke?"with-auth-drizzle.ts":M||$?"with-auth.ts":xe?"with-prisma.ts":ke?"with-drizzle.ts":"base.ts"}let se=ie({usingAuthjs:n,usingBetterAuth:s,usingPrisma:i,usingDrizzle:a}),ne=h.join(r,"src/server/api/routers/post",se),E=h.join(e,"src/server/api/routers/post.ts"),ae=h.join(r,"src/lib/utils.ts"),q=h.join(e,"src/lib/utils.ts"),J=[[g,f],[d,b],[k,D],[ne,E],[ae,q]],oe=h.join(r,"src/lib/api"),re=h.join(e,"src/lib/api");J.push([h.join(oe,"client.tsx"),h.join(re,"client.tsx")],[h.join(oe,"query-client.ts"),h.join(re,"query-client.ts")],[h.join(oe,"server.ts"),h.join(re,"server.ts")],[h.join(r,"src/components/greeting.tsx"),h.join(e,"src/components/greeting.tsx")]),J.forEach(([M,$])=>{zt.copySync(M,$)})};import Le from"path";import Dt from"fs-extra";var Be=({projectDir:e,packages:t})=>{let n=t?.typescript.inUse,s=t?.payload.inUse,i=[];n&&(i.push("typescript"),i.push("@types/node"),i.push("@types/react"),i.push("@types/react-dom")),u({projectDir:e,dependencies:i,devMode:!0});let a=Le.join(m,"template/packages/config/tsconfig",`${s?"with-payload":"base"}.json`),o=Le.join(e,"tsconfig.json");Dt.copyFileSync(a,o)};var Ne=["authjs","betterAuth","trpc","prisma","drizzle","envVariables","eslint/prettier","biome","typescript","nextjs","payload"],Ge=["nextjs","payload"],me=["none","authjs","betterAuth"],fe=["none","prisma","drizzle"],K=["sqlite","mysql","postgresql"];var We=e=>({authjs:{inUse:e.includes("authjs"),installer:ze},betterAuth:{inUse:e.includes("betterAuth"),installer:Re},trpc:{inUse:e.includes("trpc"),installer:Fe},prisma:{inUse:e.includes("prisma"),installer:$e},drizzle:{inUse:e.includes("drizzle"),installer:Oe},envVariables:{inUse:!0,installer:Ue},"eslint/prettier":{inUse:e.includes("eslint/prettier"),installer:qe},biome:{inUse:e.includes("biome"),installer:Te},typescript:{inUse:!0,installer:Be},nextjs:{inUse:!0,installer:_e},payload:{inUse:e.includes("payload"),installer:Me}});function Y(e){return Ne.includes(e)}function X(e){let t=[];e.backend!=="nextjs"&&Y(e.backend)&&t.push(e.backend),e.trpc&&t.push("trpc"),e.authentication!=="none"&&Y(e.authentication)&&t.push(e.authentication),e.orm!=="none"&&Y(e.orm)&&t.push(e.orm),Y(e.linter)&&t.push(e.linter);let n=t.includes("prisma")||t.includes("drizzle")?e.dbProvider:"sqlite";return{packages:t,databaseProvider:n}}import Rt from"path";import Tt from"fs-extra";function O(){let e=Rt.join(m,"package.json");return Tt.readJSONSync(e).version??"1.0.0"}var B=class extends Error{constructor(t){super(t)}};import Q from"chalk";var c={error(...e){console.log(Q.red(...e))},warn(...e){console.log(Q.yellow(...e))},info(...e){console.log(Q.cyan(...e))},success(...e){console.log(Q.green(...e))}};var Z=e=>(e.length>1&&e.endsWith("/")&&(e=e.slice(0,-1)),e);var Ot=/^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/;function Je(e){let t=Z(e),n=t.split("/"),s=n.findIndex(a=>a.startsWith("@")),i=n[n.length-1];return n.findIndex(a=>a.startsWith("@"))!==-1&&(i=n.slice(s).join("/")),t=="."||Ot.test(i??"")?!0:"App name must consist of only lowercase alphanumeric characters, '-', and '_'"}var Ve=e=>e.startsWith(".")||e.startsWith("/")?"Import alias can't start with '.' or '/'":!0;var y={appName:F,packages:[],flags:{git:!1,install:!1,default:!1,CI:!1,trpc:!1,authentication:"none",orm:"none",linter:"eslint/prettier",importAlias:"@/",dbProvider:"sqlite",backend:"nextjs"},databaseProvider:"sqlite"};async function Ke(){let e=y,t=new Ut().name(le).description("CLI for scaffolding new web apps with the Lx2 stack").version(O(),"-v, --version","Output the current version of Create Lx2 App").argument("[dir]","The name of the application, as well as the name of the directory to create").option("--git","Boolean flag to explicitly tell the CLI to initialize a new git repo in the project",!1).option("--install","Boolean flag to explicitly tell the CLI to run the package manager's install command",!1).option("-d, --default","Bypass the CLI and use all default options to bootstrap a new lx2-app",!1).option("--CI","Boolean value if we're running in CI",!1).option("--backend [framework]",`Choose a backend framework to use. Possible values: ${Ge.join(", ")}`,y.flags.backend).option("--trpc [boolean]","Boolean flag to explicitly tell the CLI to set up tRPC in the project",s=>!!s&&s!=="false").option("--authProvider [provider]",`Choose an authentication provider to use. Possible values: ${me.join(", ")}`,y.flags.authentication).option("--databaseORM [orm]",`Choose a database ORM to use. Possible values: ${fe.join(", ")}`,y.flags.orm).option("--linter [linter]",`Choose what linter and formatter to use. Possible values: ${y.flags.linter}`,y.flags.linter).option("-i, --import-alias [alias]","Explicitly tell the CLI to use a custom import alias",y.flags.importAlias).option("--dbProvider [provider]",`Choose a database provider to use. Possible values: ${K.join(", ")}`,y.flags.dbProvider).parse(process.argv);process.env.npm_config_user_agent?.startsWith("yarn/3")&&c.warn(` WARNING: It looks like you are using Yarn 3. This is currently not supported,
59
59
  and likely to result in a crash. Please run create-lx2-app with another
60
60
  package manager such as pnpm, npm, or Yarn Classic.
61
61
  See: https://github.com/t3-oss/create-t3-app/issues/57`);let n=t.args[0];if(n&&(e.appName=n),e.flags=t.opts(),e.flags.CI){let{packages:s,databaseProvider:i}=X({backend:e.flags.backend,trpc:e.flags.trpc,authentication:e.flags.authentication,orm:e.flags.orm,linter:e.flags.linter,dbProvider:e.flags.dbProvider});return e.packages=s,e.packages.includes("authjs")&&e.packages.includes("betterAuth")&&(c.warn(`Incompatible authentication providers provided. Use either ${me.join(", or ")}. Exiting.`),process.exit(0)),e.packages.includes("prisma")&&e.packages.includes("drizzle")&&(c.warn(`Incompatible database ORMs provided. Use either ${fe.join(", or ")}. Exiting.`),process.exit(0)),K.includes(e.flags.dbProvider)===!1&&(c.warn(`Incompatible database provided. Use either ${K.join(", or ")}. Exiting.`),process.exit(0)),e.flags.backend==="payload"&&e.flags.dbProvider==="mysql"&&(c.warn("Payload CMS does not support MySQL. Exiting."),process.exit(0)),e.packages.includes("eslint/prettier")&&e.packages.includes("biome")&&(c.warn(`Incompatible linters provided. Use either ${y.flags.linter}. Exiting.`),process.exit(0)),e.databaseProvider=i,e}if(e.flags.default){let{packages:s,databaseProvider:i}=X({backend:e.flags.backend,trpc:e.flags.trpc,authentication:e.flags.authentication,orm:e.flags.orm,linter:e.flags.linter,dbProvider:e.flags.dbProvider});return e.packages=s,e.databaseProvider=i,e}try{if(process.env.TERM_PROGRAM?.toLowerCase().includes("mintty"))throw c.warn(` WARNING: It looks like you are using MinTTY, which is non-interactive. This is most likely because you are
@@ -69,5 +69,5 @@ Using: ${z.cyan.bold(n)}
69
69
  `)}import S from"path";import ge from"fs-extra";function Ze({packages:e,projectDir:t}){let n=S.join(m,"template/packages/src/app/layout"),s=e.payload.inUse,i=e.trpc.inUse,a="base.tsx";i&&(a="with-trpc.tsx");let o=S.join(n,a),r=S.join(t,`src/app/${s?"(frontend)":""}/layout.tsx`);ge.copySync(o,r)}function et({packages:e,projectDir:t}){let n=S.join(m,"template/packages/src/app/page"),s=e.payload.inUse,i=e.authjs.inUse,a=e.betterAuth.inUse,o=e.trpc.inUse,r=e.prisma.inUse,l=e.drizzle.inUse,f=[{condition:o&&l&&a,file:"with-trpc.tsx"},{condition:o&&l&&i,file:"with-trpc.tsx"},{condition:o&&l,file:"with-trpc.tsx"},{condition:o&&r&&a,file:"with-trpc.tsx"},{condition:o&&r&&i,file:"with-trpc.tsx"},{condition:o&&r,file:"with-trpc.tsx"},{condition:s,file:"with-payload.tsx"},{condition:l&&a,file:"with-better-auth-drizzle.tsx"},{condition:l&&i,file:"with-authjs-drizzle.tsx"},{condition:l,file:"with-drizzle.tsx"},{condition:r&&a,file:"with-better-auth-prisma.tsx"},{condition:r&&i,file:"with-authjs-prisma.tsx"},{condition:r,file:"with-prisma.tsx"},{condition:o&&a,file:"with-trpc.tsx"},{condition:o&&i,file:"with-trpc.tsx"},{condition:o,file:"with-trpc.tsx"},{condition:a,file:"with-better-auth.tsx"},{condition:i,file:"with-authjs.tsx"},{condition:!0,file:"base.tsx"}].find(b=>b.condition)?.file||"base.tsx",p=S.join(n,f),d=S.join(t,`src/app/${s?"(frontend)":""}/page.tsx`);ge.copySync(p,d)}function tt({projectDir:e}){let t=S.join(m,"template/packages/src/styles"),s=S.join(t,"base.css"),i=S.join(e,"src/styles/globals.css");ge.copySync(s,i)}async function it({projectName:e,scopedAppName:t,packages:n,install:s,databaseProvider:i}){let a=v(),o=Ft.resolve(process.cwd(),e);return await Qe({projectName:e,projectDir:o,pkgManager:a,scopedAppName:t,install:s,databaseProvider:i}),Xe({projectName:e,scopedAppName:t,projectDir:o,pkgManager:a,packages:n,install:s,databaseProvider:i}),Ze({packages:n,projectDir:o}),et({packages:n,projectDir:o}),tt({packages:n,projectDir:o}),o}import{execSync as ye}from"child_process";import he from"path";import{confirm as st}from"@inquirer/prompts";import G from"chalk";import{execa as W}from"execa";import nt from"fs-extra";import Lt from"ora";function Bt(e){try{return ye("git --version",{cwd:e}),!0}catch{return!1}}function be(e){return nt.existsSync(he.join(e,".git"))}async function ve(e){try{return await W("git",["rev-parse","--is-inside-work-tree"],{cwd:e,stdout:"ignore"}),!0}catch{return!1}}function Nt(){let t=ye("git --version").toString().trim().split(" ")[2],n=t?.split(".")[0],s=t?.split(".")[1];return{major:Number(n),minor:Number(s)}}function Gt(){return ye("git config --global init.defaultBranch || echo main").toString().trim()}async function at(e){if(c.info("Initializing Git..."),!Bt(e)){c.warn("Git is not installed. Skipping Git initialization.");return}let t=Lt(`Creating a new git repo...
70
70
  `).start(),n=be(e),s=await ve(e),i=he.parse(e).name;if(s&&n){if(t.stop(),!await st({message:`${G.redBright.bold("Warning:")} Git is already initialized in "${i}". Initializing a new git repository would delete the previous history. Would you like to continue anyways?`,default:!1})){t.info("Skipping Git initialization.");return}nt.removeSync(he.join(e,".git"))}else if(s&&!n&&(t.stop(),!await st({message:`${G.redBright.bold("Warning:")} "${i}" is already in a git worktree. Would you still like to initialize a new git repository in this directory?`,default:!1}))){t.info("Skipping Git initialization.");return}try{let a=Gt(),{major:o,minor:r}=Nt();o<2||o==2&&r<28?(await W("git",["init"],{cwd:e}),await W("git",["symbolic-ref","HEAD",`refs/heads/${a}`],{cwd:e})):await W("git",["init",`--initial-branch=${a}`],{cwd:e}),await W("git",["add","."],{cwd:e}),t.succeed(`${G.green("Successfully initialized and staged")} ${G.green.bold("git")}
71
71
  `)}catch{t.fail(`${G.bold.red("Failed:")} could not initialize git. Update git to the latest version!
72
- `)}}import Wt from"chalk";import{execa as ot}from"execa";import rt from"ora";var we=async(e,t,n)=>{let{onDataHandle:s,args:i=["install"],stdout:a="pipe"}=n,o=rt(`Running ${t} install...`).start(),r=ot(t,i,{cwd:e,stdout:a});return await new Promise((l,g)=>{s&&r.stdout?.on("data",s(o)),r.on("error",f=>g(f)),r.on("close",()=>l())}),o},Jt=(e,t)=>{if(!t)return["install"];switch(e){case"npm":return["install","--legacy-peer-deps"];case"pnpm":return["install","--strict-peer-dependencies=false"];case"yarn":return["install"];case"bun":return["install"]}},Vt=async(e,t,n)=>{let s=Jt(e,n);switch(e){case"npm":return await ot(e,s,{cwd:t,stderr:"inherit"}),null;case"pnpm":return we(t,e,{args:s,onDataHandle:i=>a=>{let o=a.toString();o.includes("Progress")&&(i.text=o.includes("|")?o.split(" | ")[1]??"":o)}});case"yarn":return we(t,e,{args:s,onDataHandle:i=>a=>{i.text=a.toString()}});case"bun":return we(t,e,{args:s,stdout:"ignore"})}},lt=async({projectDir:e,withPayload:t=!1})=>{c.info("Installing dependencies...");let n=v();(await Vt(n,e,t)??rt()).succeed(Wt.green(`Successfully installed dependencies!
73
- `))};var ct=async({projectName:e=F,packages:t,install:n,projectDir:s,databaseProvider:i})=>{let a=v(),o=["npm"].includes(a),r=t?.authjs.inUse||t?.betterAuth.inUse,l=t?.prisma.inUse||t?.drizzle.inUse;c.info("Next steps:"),e!=="."&&c.info(` cd ${e}`),n===!1&&(a==="yarn"?c.info(` ${a}`):c.info(` ${a} install`)),["postgresql","mysql"].includes(i)&&c.info(" Add your database connection string to .env"),r&&c.info(" Fill in your .env with necessary values. See https://create.lx2.dev/docs/first-steps for more info."),l&&c.info(` Run "${a} ${o?"run ":""}db:push" to create you database tables.`),o?c.info(` ${a} run dev`):c.info(` ${a} dev`),!await ve(s)&&!be(s)&&c.info(" git init"),c.info(' git commit -m "initial commit"')};import te from"fs";import Ht from"path";function pt(e,t,n){te.readdirSync(e).forEach(i=>{let a=Ht.join(e,i);if(te.statSync(a).isDirectory())pt(a,t,n);else{let r=te.readFileSync(a,"utf8").replace(new RegExp(t,"g"),n);te.writeFileSync(a,r,"utf8")}})}function dt(e,t){let n=t.replace(/\*/g,"").replace(/[^\/]$/,"$&/");pt(e,"@/",n)}import mt from"path";function ft(e){let n=Z(e).split("/"),s=n[n.length-1];if(s==="."){let o=mt.resolve(process.cwd());s=mt.basename(o)}let i=n.findIndex(o=>o.startsWith("@"));n.findIndex(o=>o.startsWith("@"))!==-1&&(s=n.slice(i).join("/"));let a=n.filter(o=>!o.startsWith("@")).join("/");return[s,a]}function ut(){c.warn(" Compatibility Warnings:");for(let e of R){let t=e.packages,n="";e.message?n=` - ${e.message}`:t.length===2?n=` - Using ${t[0]} with ${t[1]} is not supported yet.`:t.length>2&&(n=` - Using ${t[0]} with ${t.slice(1,-1).join(", ")}, or ${t.slice(-1)} is not supported yet.`),c.warn(n)}console.log("")}import Kt from"gradient-string";var Yt={primary:"#bf95f9",accent:"#6071a4",secondary:"#ff7ac5"};function gt(){let e=Kt(Object.values(Yt)),t=v();(t==="yarn"||t==="pnpm")&&console.log(""),console.log(e.multiline(Se))}import{execSync as Xt}from"child_process";import Qt from"https";function ht(e){let t=O();t.includes("beta")?(c.warn(" You are using a beta version of create-lx2-app."),c.warn(" Please report any bugs you encounter.")):t!==e&&(c.warn(" You are using an outdated version of create-lx2-app."),c.warn(" Your version:",t+".","Latest version in the npm registry:",e),c.warn(" Please run the CLI with @latest to get the latest updates.")),console.log("")}function Zt(){return new Promise((e,t)=>{Qt.get("https://registry.npmjs.org/-/package/create-lx2-app/dist-tags",n=>{if(n.statusCode===200){let s="";n.on("data",i=>s+=i),n.on("end",()=>{e(JSON.parse(s).latest)})}else t()}).on("error",()=>{t()})})}var yt=()=>Zt().catch(()=>{try{return Xt("npm view create-lx2-app version").toString().trim()}catch{return null}});async function ti(){let e=await yt(),t=v();gt(),e&&ht(e),R.length>0&&ut();let{appName:n,packages:s,flags:{git:i,install:a,importAlias:o},databaseProvider:r}=await Ke(),l=We(s),[g,f]=ft(n),p=await it({projectName:f,scopedAppName:g,packages:l,install:a,databaseProvider:r}),d=vt.readJsonSync(bt.join(p,"package.json"));if(d.name=g,d.clx2aMetadata={initVersion:O()},t!=="bun"){let{stdout:b}=await ei(t,["-v"],{cwd:p});d.packageManager=`${t}@${b.trim()}`}vt.writeJSONSync(bt.join(p,"package.json"),d,{spaces:2}),o!=="@/"&&dt(p,o),a&&await lt({projectDir:p,withPayload:l.payload.inUse}),i&&await at(p),await ct({projectDir:p,projectName:f,packages:l,install:a,databaseProvider:r}),process.exit(0)}ti().catch(e=>{c.error("Aborting installation..."),e instanceof Error?c.error(e.message):(c.error("An unknown error occurred. Please open an issue on GitHub with the below:"),console.error(e)),process.exit(1)});
72
+ `)}}import Wt from"chalk";import{execa as ot}from"execa";import rt from"ora";var we=async(e,t,n)=>{let{onDataHandle:s,args:i=["install"],stdout:a="pipe"}=n,o=rt(`Running ${t} install...`).start(),r=ot(t,i,{cwd:e,stdout:a});return await new Promise((l,g)=>{s&&r.stdout?.on("data",s(o)),r.on("error",f=>g(f)),r.on("close",()=>l())}),o},Jt=async(e,t,n)=>{let s=n?["install","--legacy-peer-deps"]:["install"];switch(e){case"npm":return await ot(e,s,{cwd:t,stderr:"inherit"}),null;case"pnpm":return we(t,e,{args:s,onDataHandle:i=>a=>{let o=a.toString();o.includes("Progress")&&(i.text=o.includes("|")?o.split(" | ")[1]??"":o)}});case"yarn":return we(t,e,{args:s,onDataHandle:i=>a=>{i.text=a.toString()}});case"bun":return we(t,e,{args:s,stdout:"ignore"})}},lt=async({projectDir:e,withPayload:t=!1})=>{c.info("Installing dependencies...");let n=v();(await Jt(n,e,t)??rt()).succeed(Wt.green(`Successfully installed dependencies!
73
+ `))};var ct=async({projectName:e=F,packages:t,install:n,projectDir:s,databaseProvider:i})=>{let a=v(),o=["npm"].includes(a),r=t?.authjs.inUse||t?.betterAuth.inUse,l=t?.prisma.inUse||t?.drizzle.inUse;c.info("Next steps:"),e!=="."&&c.info(` cd ${e}`),n===!1&&(a==="yarn"?c.info(` ${a}`):c.info(` ${a} install`)),["postgresql","mysql"].includes(i)&&c.info(" Add your database connection string to .env"),r&&c.info(" Fill in your .env with necessary values. See https://create.lx2.dev/docs/first-steps for more info."),l&&c.info(` Run "${a} ${o?"run ":""}db:push" to create you database tables.`),o?c.info(` ${a} run dev`):c.info(` ${a} dev`),!await ve(s)&&!be(s)&&c.info(" git init"),c.info(' git commit -m "initial commit"')};import te from"fs";import Vt from"path";function pt(e,t,n){te.readdirSync(e).forEach(i=>{let a=Vt.join(e,i);if(te.statSync(a).isDirectory())pt(a,t,n);else{let r=te.readFileSync(a,"utf8").replace(new RegExp(t,"g"),n);te.writeFileSync(a,r,"utf8")}})}function dt(e,t){let n=t.replace(/\*/g,"").replace(/[^\/]$/,"$&/");pt(e,"@/",n)}import mt from"path";function ft(e){let n=Z(e).split("/"),s=n[n.length-1];if(s==="."){let o=mt.resolve(process.cwd());s=mt.basename(o)}let i=n.findIndex(o=>o.startsWith("@"));n.findIndex(o=>o.startsWith("@"))!==-1&&(s=n.slice(i).join("/"));let a=n.filter(o=>!o.startsWith("@")).join("/");return[s,a]}function ut(){c.warn(" Compatibility Warnings:");for(let e of R){let t=e.packages,n="";e.message?n=` - ${e.message}`:t.length===2?n=` - Using ${t[0]} with ${t[1]} is not supported yet.`:t.length>2&&(n=` - Using ${t[0]} with ${t.slice(1,-1).join(", ")}, or ${t.slice(-1)} is not supported yet.`),c.warn(n)}console.log("")}import Ht from"gradient-string";var Kt={primary:"#bf95f9",accent:"#6071a4",secondary:"#ff7ac5"};function gt(){let e=Ht(Object.values(Kt)),t=v();(t==="yarn"||t==="pnpm")&&console.log(""),console.log(e.multiline(Se))}import{execSync as Yt}from"child_process";import Xt from"https";function ht(e){let t=O();t.includes("beta")?(c.warn(" You are using a beta version of create-lx2-app."),c.warn(" Please report any bugs you encounter.")):t!==e&&(c.warn(" You are using an outdated version of create-lx2-app."),c.warn(" Your version:",t+".","Latest version in the npm registry:",e),c.warn(" Please run the CLI with @latest to get the latest updates.")),console.log("")}function Qt(){return new Promise((e,t)=>{Xt.get("https://registry.npmjs.org/-/package/create-lx2-app/dist-tags",n=>{if(n.statusCode===200){let s="";n.on("data",i=>s+=i),n.on("end",()=>{e(JSON.parse(s).latest)})}else t()}).on("error",()=>{t()})})}var yt=()=>Qt().catch(()=>{try{return Yt("npm view create-lx2-app version").toString().trim()}catch{return null}});async function ei(){let e=await yt(),t=v();gt(),e&&ht(e),R.length>0&&ut();let{appName:n,packages:s,flags:{git:i,install:a,importAlias:o},databaseProvider:r}=await Ke(),l=We(s),[g,f]=ft(n),p=await it({projectName:f,scopedAppName:g,packages:l,install:a,databaseProvider:r}),d=vt.readJsonSync(bt.join(p,"package.json"));if(d.name=g,d.clx2aMetadata={initVersion:O()},t!=="bun"){let{stdout:b}=await Zt(t,["-v"],{cwd:p});d.packageManager=`${t}@${b.trim()}`}vt.writeJSONSync(bt.join(p,"package.json"),d,{spaces:2}),o!=="@/"&&dt(p,o),a&&await lt({projectDir:p,withPayload:l.payload.inUse}),i&&await at(p),await ct({projectDir:p,projectName:f,packages:l,install:a,databaseProvider:r}),process.exit(0)}ei().catch(e=>{c.error("Aborting installation..."),e instanceof Error?c.error(e.message):(c.error("An unknown error occurred. Please open an issue on GitHub with the below:"),console.error(e)),process.exit(1)});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-lx2-app",
3
- "version": "0.11.5-beta.c6e566f",
3
+ "version": "0.11.5-beta.d3a3f4c",
4
4
  "description": "The Most Opinionated Way to Build Next.js Apps",
5
5
  "license": "MIT",
6
6
  "repository": {