create-lx2-app 0.8.0 → 0.9.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/LICENSE.md +20 -0
- package/README.md +2 -1
- package/dist/index.js +14 -15
- package/package.json +17 -23
- package/template/packages/src/app/api/auth/[...betterauth]/route.ts +1 -1
- package/template/packages/src/app/page/base.tsx +2 -2
- package/template/packages/src/app/page/with-authjs-prisma.tsx +7 -19
- package/template/packages/src/app/page/with-authjs.tsx +6 -14
- package/template/packages/src/app/page/with-better-auth-prisma.tsx +1 -5
- package/template/packages/src/server/auth/config/better-auth-with-drizzle.ts +0 -20
package/LICENSE.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Lasse Lammers
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
7
|
+
the Software without restriction, including without limitation the rights to
|
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
10
|
+
subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -45,6 +45,7 @@ Create Lx2 App installs **TypeScript, Next.js, Tailwind CSS**, along with:
|
|
|
45
45
|
- ✅ **Better Auth** - The most comprehensive authentication framework for
|
|
46
46
|
TypeScript.
|
|
47
47
|
- ✅ **Prisma ORM** - Database management with full type safety
|
|
48
|
+
- ✅ **Drizzle ORM** - A next gen TypeScript ORM for you to ship (ship ship)
|
|
48
49
|
- ✅ **And many more coming soon...**
|
|
49
50
|
|
|
50
51
|
<h2 id="getting-started">🚀 Getting Started</h2>
|
|
@@ -115,7 +116,7 @@ so you understand the branching strategy and local development environment.
|
|
|
115
116
|
|
|
116
117
|
<div align="center">
|
|
117
118
|
<a
|
|
118
|
-
href="https://vercel.com/?utm_source=
|
|
119
|
+
href="https://vercel.com/?utm_source=lx2&utm_campaign=oss"
|
|
119
120
|
target="_blank"
|
|
120
121
|
rel="noopener noreferrer"
|
|
121
122
|
>
|
package/dist/index.js
CHANGED
|
@@ -1,25 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import Ve from"path";import{execa as Ct}from"execa";import He from"fs-extra";import{confirm as K,input as
|
|
2
|
+
import Ve from"path";import{execa as Ct}from"execa";import He from"fs-extra";import{confirm as K,input as xe,select as C}from"@inquirer/prompts";import{Command as mt}from"commander";import ae from"path";import{fileURLToPath as et}from"url";var tt=et(import.meta.url),st=ae.dirname(tt),m=ae.join(st,"../"),ne=` ___ ___ ___ _ _____ ___ _ ___ _ ___ ___
|
|
3
3
|
/ __| _ \\ __| /_\\_ _| __| | | __ __|_ ) /_\\ | _ \\ _ \\
|
|
4
4
|
| (__| / _| / _ \\| | | _| | |__\\ \\ / / / / _ \\| _/ _/
|
|
5
5
|
\\___|_|_\\___/_/ \\_\\_| |___| |____/_\\_\\/___| /_/ \\_\\_| |_|
|
|
6
|
-
`,
|
|
6
|
+
`,O="my-lx2-app",W="create-lx2-app";import w from"path";import T from"fs-extra";import oe from"path";import re from"fs-extra";import at from"sort-package-json";var ie={"next-auth":"^5.0.0-beta.25","@auth/prisma-adapter":"^2.8.0","@auth/drizzle-adapter":"^1.10.0","better-auth":"^1.2.7","better-sqlite3":"^11.9.1","@types/better-sqlite3":"^7.6.13",prisma:"^6.5.0","@prisma/client":"^6.5.0","drizzle-orm":"^0.44.4","drizzle-kit":"^0.31.4","@libsql/client":"^0.15.10",mysql2:"^3.14.3",postgres:"^3.4.7","@t3-oss/env-nextjs":"^0.12.0",zod:"^3.24.2",prettier:"^3.5.3","prettier-plugin-tailwindcss":"^0.6.11","@ianvs/prettier-plugin-sort-imports":"^4.4.1",eslint:"^9","eslint-config-next":"^15.2.4","@eslint/eslintrc":"^3.3.1",typescript:"^5.8.2","@types/node":"^22","@types/react":"^19","@types/react-dom":"^19",payload:"^3.33.0","@payloadcms/next":"^3.33.0","@payloadcms/payload-cloud":"^3.33.0","@payloadcms/richtext-lexical":"^3.33.0","@payloadcms/db-vercel-postgres":"^3.33.0","@payloadcms/db-sqlite":"^3.33.0",graphql:"^16.10.0",sharp:"^0.34.1"};var g=e=>{let{dependencies:s,devMode:n,projectDir:a}=e,t=re.readJsonSync(oe.join(a,"package.json"));s.forEach(o=>{let r=ie[o];n&&t.devDependencies?t.devDependencies[o]=r:t.dependencies&&(t.dependencies[o]=r)});let i=at(t);re.writeJsonSync(oe.join(a,"package.json"),i,{spaces:2})};var le=({projectDir:e,packages:s,databaseProvider:n})=>{let a=s?.prisma.inUse,t=s?.drizzle.inUse,i=["better-auth"],o=[];(!a||!t)&&i.push("better-sqlite3"),(!a||!t)&&o.push("@types/better-sqlite3"),g({projectDir:e,dependencies:i,devMode:!1}),g({projectDir:e,dependencies:o,devMode:!0});let r=w.join(m,"template/packages"),c=w.join(r,"src/app/api/auth/[...betterauth]/route.ts"),p=w.join(e,"src/app/api/auth/[...all]/route.ts"),u=w.join(r,"src/server/auth/config",a?"better-auth-with-prisma.ts":t?"better-auth-with-drizzle.ts":"better-auth.ts"),d=T.readFileSync(u,"utf-8");(a||t)&&n!=="sqlite"&&(d=d.replace('provider: "sqlite",',`provider: "${{mysql:"mysql",postgresql:"postgresql"}[n]}",`));let f=w.join(e,"src/server/auth/index.ts");T.mkdirSync(w.dirname(f),{recursive:!0}),T.writeFileSync(f,d);let h=w.join(r,"src/lib/auth/better-auth-client.ts"),D=w.join(e,"src/lib/auth/client.ts");T.copySync(c,p),T.copySync(h,D)};import b from"path";import S from"fs-extra";var ce=({projectDir:e,packages:s,databaseProvider:n})=>{let a=[],t=[];if(s?.payload.inUse)switch(a.push("payload"),a.push("@payloadcms/next"),a.push("@payloadcms/payload-cloud"),a.push("@payloadcms/richtext-lexical"),a.push("graphql"),n){case"sqlite":t.push("@payloadcms/db-sqlite");break;case"postgresql":t.push("@payloadcms/db-vercel-postgres");break}g({projectDir:e,dependencies:a,devMode:!1}),g({projectDir:e,dependencies:t,devMode:!1});let i=b.join(m,"template/packages"),o=b.join(i,"config/payload",`${n==="postgresql"?"with-postgres":"with-sqlite"}.ts`),r=b.join(e,"payload.config.ts");S.copyFileSync(o,r);let c=b.join(i,"src/payload/collections"),p=b.join(e,"src/collections");S.mkdirSync(p,{recursive:!0}),S.copyFileSync(b.join(c,"Media.ts"),b.join(p,"Media.ts")),S.copyFileSync(b.join(c,"Users.ts"),b.join(p,"Users.ts"));let u=b.join(i,"src/app/(payload)"),d=b.join(e,"src/app/(payload)");S.mkdirSync(d,{recursive:!0}),S.copySync(u,d);let f=b.join(e,"package.json"),h=S.readJSONSync(f);h.scripts={...h.scripts,payload:"payload","generate:importmap":"payload generate:importmap","generate:types":"payload generate:types"},S.writeJSONSync(f,h,{spaces:2})};import pe from"path";import nt from"fs-extra";var de=({projectDir:e,packages:s})=>{let n=s?.typescript.inUse,a=s?.payload.inUse,t=[];n&&(t.push("typescript"),t.push("@types/node"),t.push("@types/react"),t.push("@types/react-dom")),g({projectDir:e,dependencies:t,devMode:!0});let i=pe.join(m,"template/packages/config/tsconfig",`${a?"with-payload":"base"}.json`),o=pe.join(e,"tsconfig.json");nt.copyFileSync(i,o)};import A from"path";import V from"fs-extra";var me=({projectDir:e,packages:s})=>{let n=s?.prisma.inUse,a=s?.drizzle.inUse,t=["next-auth"];n&&t.push("@auth/prisma-adapter"),a&&t.push("@auth/drizzle-adapter"),g({projectDir:e,dependencies:t,devMode:!1});let i=A.join(m,"template/packages"),o="src/app/api/auth/[...nextauth]/route.ts",r=A.join(i,o),c=A.join(e,o),p=A.join(i,"src/server/auth/config",n?"authjs-with-prisma.ts":a?"authjs-with-drizzle.ts":"authjs.ts"),u=A.join(e,"src/server/auth/config.ts"),d=A.join(i,"src/server/auth/authjs.ts"),f=A.join(e,"src/server/auth/index.ts");V.copySync(r,c),V.copySync(p,u),V.copySync(d,f)};import P from"path";import I from"fs-extra";import it from"path";import fe from"fs-extra";import{sortPackageJson as ot}from"sort-package-json";function ue(e){let{scripts:s,projectDir:n}=e,a=it.join(n,"package.json"),t=fe.readJSONSync(a);t.scripts={...t.scripts,...s};let i=ot(t);fe.writeJSONSync(a,i,{spaces:2})}var ge=({projectDir:e,packages:s,scopedAppName:n,databaseProvider:a})=>{let t=s?.authjs.inUse,i=s?.betterAuth.inUse;g({projectDir:e,dependencies:["drizzle-kit"],devMode:!0}),g({projectDir:e,dependencies:["drizzle-orm",{sqlite:"@libsql/client",mysql:"mysql2",postgresql:"postgres"}[a]],devMode:!1});let o=P.join(m,"template/packages"),r=P.join(o,"config/drizzle",{sqlite:"with-sqlite",mysql:"with-mysql",postgresql:"with-postgres"}[a]+".ts"),c=P.join(e,"drizzle.config.ts"),p=P.join(o,"src/server/db/schema-drizzle",t?`with-authjs-${a}.ts`:i?`with-better-auth-${a}.ts`:`base-${a}.ts`),u=P.join(e,"src/server/db/schema.ts"),d=I.readFileSync(p,"utf-8");d=d.replace("project1_${name}",`${n}_\${name}`);let f=I.readFileSync(r,"utf-8");f=f.replace("project1_*",`${n}_*`);let h=P.join(o,`src/server/db/index-drizzle/with-${a}.ts`),D=P.join(e,"src/server/db/index.ts");ue({projectDir:e,scripts:{"db:generate":"drizzle-kit generate","db:migrate":"drizzle-kit migrate","db:push":"drizzle-kit push","db:studio":"drizzle-kit studio"}}),I.copySync(r,c),I.mkdirSync(P.dirname(u),{recursive:!0}),I.writeFileSync(u,d),I.writeFileSync(c,f),I.copySync(h,D)};import q from"path";import H from"fs-extra";var he=({projectDir:e,scopedAppName:s,packages:n,databaseProvider:a})=>{let t=n?.envVariables.inUse,i=n?.authjs.inUse,o=n?.betterAuth.inUse,r=n?.prisma.inUse,c=n?.drizzle.inUse,p=n?.payload.inUse,u=[];t&&(u.push("@t3-oss/env-nextjs"),u.push("zod")),g({projectDir:e,dependencies:u,devMode:!1});let d=r||c||p,f=rt(!!i,!!o,!!r,!!c,!!p,s,a),h="";if(d?i?h="with-authjs-db.js":o?h="with-better-auth-db.js":p?h="with-payload.js":h="with-db.js":i?h="with-authjs.js":o&&(h="with-better-auth.js"),h!==""){let Xe=q.join(m,"template/packages/src/env",h),Ze=q.join(e,"src/env.ts");H.copyFileSync(Xe,Ze)}let D=q.join(e,".env"),Ke=q.join(e,".env.example"),Ye=lt+f,B=Buffer.from(crypto.getRandomValues(new Uint8Array(32))).toString("base64"),Qe=f.replace('AUTH_SECRET=""',`AUTH_SECRET="${B}" # Generated by create-lx2-app`).replace('BETTER_AUTH_SECRET=""',`BETTER_AUTH_SECRET="${B}" # Generated by create-lx2-app`).replace('PAYLOAD_SECRET=""',`PAYLOAD_SECRET="${B}" # Generated by create-lx2-app`);H.writeFileSync(D,Qe,"utf-8"),H.writeFileSync(Ke,Ye,"utf-8")};function rt(e,s,n,a,t,i,o){let r=`
|
|
7
7
|
# When adding additional environment variables, the schema in "/src/env.ts"
|
|
8
8
|
# should be updated accordingly.
|
|
9
9
|
`.trim().concat(`
|
|
10
10
|
`);return n&&(r+=`
|
|
11
11
|
# Prisma
|
|
12
12
|
# https://www.prisma.io/docs/reference/database-reference/connection-urls#env
|
|
13
|
-
`),n&&(o==="mysql"?r+=`DATABASE_URL="mysql://root:password@localhost:3306/${i}"`:o==="postgres"?r+=`DATABASE_URL="postgresql://postgres:password@localhost:5432/${i}"`:o==="sqlite"&&(r+='DATABASE_URL="file:./db.sqlite"'),r+=`
|
|
14
13
|
`),a&&(r+=`
|
|
15
14
|
# Drizzle ORM
|
|
16
15
|
# https://orm.drizzle.team/docs/connect-overview
|
|
17
|
-
`),a&&(o==="mysql"?r+=`DATABASE_URL="mysql://root:password@localhost:3306/${i}"`:o==="
|
|
16
|
+
`),(n||a)&&(o==="mysql"?r+=`DATABASE_URL="mysql://root:password@localhost:3306/${i}"`:o==="postgresql"?r+=`DATABASE_URL="postgresql://postgres:password@localhost:5432/${i}"`:o==="sqlite"&&(r+='DATABASE_URL="file:./db.sqlite"'),r+=`
|
|
18
17
|
`),t&&(r+=`
|
|
19
18
|
# Payload CMS
|
|
20
19
|
# https://payloadcms.com/docs/database/overview
|
|
21
20
|
`,r+=`PAYLOAD_SECRET=""
|
|
22
|
-
`,o==="
|
|
21
|
+
`,o==="postgresql"?r+=`DATABASE_URL="postgresql://postgres:password@localhost:5432/${i}"`:o==="sqlite"&&(r+='DATABASE_URL="file:./db.sqlite"'),r+=`
|
|
23
22
|
`),e&&(r+=`
|
|
24
23
|
# Next Auth
|
|
25
24
|
# You can generate a new secret on the command line with:
|
|
@@ -54,19 +53,19 @@ DISCORD_CLIENT_SECRET=""
|
|
|
54
53
|
# ".env" and populate it with your secrets.
|
|
55
54
|
`.trim().concat(`
|
|
56
55
|
|
|
57
|
-
`);import E from"path";import G from"fs-extra";var ye=({projectDir:e,packages:s})=>{let n=s?.["eslint/prettier"].inUse,a=[];n&&(a.push("eslint"),a.push("eslint-config-next"),a.push("@eslint/eslintrc"),a.push("prettier"),a.push("prettier-plugin-tailwindcss"),a.push("@ianvs/prettier-plugin-sort-imports")),g({projectDir:e,dependencies:a,devMode:!0});let t=E.join(m,"template/packages/config","eslint.config.mjs"),i=E.join(m,"template/packages/config","prettier.config.mjs"),o=E.join(e,"eslint.config.mjs"),r=E.join(e,"prettier.config.mjs"),c=E.join(e,"package.json"),p=G.readJSONSync(c);p.scripts={...p.scripts,lint:"next lint"},G.copyFileSync(t,o),G.writeJSONSync(c,p,{spaces:2}),G.copyFileSync(i,r)};import
|
|
56
|
+
`);import E from"path";import G from"fs-extra";var ye=({projectDir:e,packages:s})=>{let n=s?.["eslint/prettier"].inUse,a=[];n&&(a.push("eslint"),a.push("eslint-config-next"),a.push("@eslint/eslintrc"),a.push("prettier"),a.push("prettier-plugin-tailwindcss"),a.push("@ianvs/prettier-plugin-sort-imports")),g({projectDir:e,dependencies:a,devMode:!0});let t=E.join(m,"template/packages/config","eslint.config.mjs"),i=E.join(m,"template/packages/config","prettier.config.mjs"),o=E.join(e,"eslint.config.mjs"),r=E.join(e,"prettier.config.mjs"),c=E.join(e,"package.json"),p=G.readJSONSync(c);p.scripts={...p.scripts,lint:"next lint"},G.copyFileSync(t,o),G.writeJSONSync(c,p,{spaces:2}),G.copyFileSync(i,r)};import x from"path";import _ from"fs-extra";var be=({projectDir:e,packages:s,databaseProvider:n})=>{let a=s?.authjs.inUse,t=s?.betterAuth.inUse;g({projectDir:e,dependencies:["prisma"],devMode:!0}),g({projectDir:e,dependencies:["@prisma/client"],devMode:!1});let i=x.join(m,"template/packages"),o=x.join(i,"prisma/schema",`${a?"with-authjs":t?"with-better-auth":"base"}.prisma`),r=_.readFileSync(o,"utf-8");n!=="sqlite"&&(r=r.replace('provider = "sqlite"',`provider = "${{mysql:"mysql",postgresql:"postgresql"}[n]}"`),["mysql"].includes(n)&&(r=r.replace("// @db.Text","@db.Text")));let c=x.join(e,"prisma/schema.prisma");_.mkdirSync(x.dirname(c),{recursive:!0}),_.writeFileSync(c,r);let p=x.join(i,"src/server/db/db-prisma.ts"),u=x.join(e,"src/server/db/index.ts");_.mkdirSync(x.dirname(u),{recursive:!0}),_.writeFileSync(u,_.readFileSync(p,"utf-8"));let d=x.join(e,"package.json"),f=_.readJSONSync(d);f.scripts={...f.scripts,postinstall:"prisma generate","db:push":"prisma db push","db:studio":"prisma studio","db:generate":"prisma migrate dev","db:migrate":"prisma migrate deploy"},_.writeJSONSync(d,f,{spaces:2})};var ve=["none","authjs","betterAuth"],ke=["none","prisma","drizzle"],L=["sqlite","mysql","postgresql"];var we=e=>({authjs:{inUse:e.includes("authjs"),installer:me},betterAuth:{inUse:e.includes("betterAuth"),installer:le},prisma:{inUse:e.includes("prisma"),installer:be},drizzle:{inUse:e.includes("drizzle"),installer:ge},envVariables:{inUse:!0,installer:he},"eslint/prettier":{inUse:e.includes("eslint/prettier"),installer:ye},typescript:{inUse:!0,installer:de},payload:{inUse:e.includes("payload"),installer:ce}});import ct from"path";import pt from"fs-extra";function z(){let e=ct.join(m,"package.json");return pt.readJSONSync(e).version??"1.0.0"}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"};var R=class extends Error{constructor(s){super(s)}};import N from"chalk";var l={error(...e){console.log(N.red(...e))},warn(...e){console.log(N.yellow(...e))},info(...e){console.log(N.cyan(...e))},success(...e){console.log(N.green(...e))}};var F=e=>(e.length>1&&e.endsWith("/")&&(e=e.slice(0,-1)),e);var dt=/^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/;function Se(e){let s=F(e),n=s.split("/"),a=n.findIndex(i=>i.startsWith("@")),t=n[n.length-1];return n.findIndex(i=>i.startsWith("@"))!==-1&&(t=n.slice(a).join("/")),s=="."||dt.test(t??"")?!0:"App name must consist of only lowercase alphanumeric characters, '-', and '_'"}var Pe=e=>e.startsWith(".")||e.startsWith("/")?"Import alias can't start with '.' or '/'":!0;var y={appName:O,packages:[],flags:{noGit:!1,noInstall:!1,default:!1,CI:!1,authentication:"none",orm:"none",linter:"eslint/prettier",importAlias:"@/",dbProvider:"sqlite",backend:"nextjs"},databaseProvider:"sqlite"};async function _e(){let e=y,s=new mt().name(W).description("CLI for scaffolding new web apps with the Lx2 stack").version(z(),"-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("--noGit","Explicitly tell the CLI to not initialize a new git repo in the project",!1).option("--noInstall","Explicitly tell the CLI to not run the package manager's install command",!1).option("-y, --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: ${y.flags.backend}`,y.flags.backend).option("--authProvider [provider]",`Choose an authentication provider to use. Possible values: ${ve.join(", ")}`,y.flags.authentication).option("--databaseORM [orm]",`Choose a database ORM to use. Possible values: ${ke.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: ${L.join(", ")}`,y.flags.dbProvider).parse(process.argv);process.env.npm_config_user_agent?.startsWith("yarn/3")&&l.warn(` WARNING: It looks like you are using Yarn 3. This is currently not supported,
|
|
58
57
|
and likely to result in a crash. Please run create-lx2-app with another
|
|
59
58
|
package manager such as pnpm, npm, or Yarn Classic.
|
|
60
|
-
See: https://github.com/t3-oss/create-t3-app/issues/57`);let n=s.args[0];if(n&&(e.appName=n),e.flags=s.opts(),e.flags.CI){switch(e.packages=[],e.flags.backend){case"payload":e.packages.push("payload");break;default:break}switch(e.flags.authentication){case"authjs":e.packages.push("authjs");break;case"betterAuth":e.packages.push("betterAuth");break;default:break}switch(e.flags.orm){case"prisma":e.packages.push("prisma");break;case"drizzle":e.packages.push("drizzle");break;default:break}switch(e.flags.linter){case"eslint/prettier":e.packages.push("eslint/prettier");break;default:break}return
|
|
59
|
+
See: https://github.com/t3-oss/create-t3-app/issues/57`);let n=s.args[0];if(n&&(e.appName=n),e.flags=s.opts(),e.flags.CI){switch(e.packages=[],e.flags.backend){case"payload":e.packages.push("payload");break;default:break}switch(e.flags.authentication){case"authjs":e.packages.push("authjs");break;case"betterAuth":e.packages.push("betterAuth");break;default:break}switch(e.flags.orm){case"prisma":e.packages.push("prisma");break;case"drizzle":e.packages.push("drizzle");break;default:break}switch(e.flags.linter){case"eslint/prettier":e.packages.push("eslint/prettier");break;default:break}return L.includes(e.flags.dbProvider)===!1&&(l.warn(`Incompatible database provided. Use: ${L.join(", ")}. Exiting.`),process.exit(0)),e.flags.backend==="payload"&&e.flags.dbProvider==="mysql"&&(l.warn("Payload CMS does not support MySQL. Exiting."),process.exit(0)),e}if(e.flags.default)return e;try{if(process.env.TERM_PROGRAM?.toLowerCase().includes("mintty"))throw l.warn(` WARNING: It looks like you are using MinTTY, which is non-interactive. This is most likely because you are
|
|
61
60
|
using Git Bash. If that's that case, please use Git Bash from another terminal, such as Windows Terminal. Alternatively, you
|
|
62
|
-
can provide the arguments from the CLI directly: https://create.lx2.dev/docs/getting-started#experimental-ci-flags to skip the prompts.`),new R("Non-interactive environment");let a=v(),t={};n||(t.name=await
|
|
61
|
+
can provide the arguments from the CLI directly: https://create.lx2.dev/docs/getting-started#experimental-ci-flags to skip the prompts.`),new R("Non-interactive environment");let a=v(),t={};n||(t.name=await xe({message:"What will your project be called?",default:O,validate:o=>Se(o)})),t.backend=await C({message:"What backend framework would you like to use?",choices:[{value:"nextjs",name:"Next.js"},{value:"payload",name:"Payload CMS"}],default:!y.flags.backend}),t.backend==="payload"&&(t.databaseProvider=await C({message:"What database provider would you like to use?",choices:[{value:"sqlite",name:"SQLite"},{value:"postgresql",name:"PostgreSQL"}],default:!y.flags.dbProvider})),t.backend==="nextjs"&&(t.authentication=await C({message:"What authentication provider would you like to use?",choices:[{value:"none",name:"None"},{value:"authjs",name:"Auth.js"},{value:"betterAuth",name:"Better Auth"}],default:!y.flags.authentication}),t.orm=await C({message:"What database ORM would you like to use?",choices:[{value:"none",name:"None"},{value:"prisma",name:"Prisma"},{value:"drizzle",name:"Drizzle"}],default:!y.flags.orm}),t.orm!=="none"&&(t.databaseProvider=await C({message:"What database provider would you like to use?",choices:[{value:"sqlite",name:"SQLite"},{value:"mysql",name:"MySQL"},{value:"postgresql",name:"PostgreSQL"}],default:!y.flags.dbProvider}))),t.linter=await C({message:"What linter and formatter would you like to use?",choices:[{value:"eslint/prettier",name:"ESLint/Prettier"}],default:!y.flags.linter}),e.flags.noGit||(t.noGit=await K({message:"Should we initialize a Git repository and stage the changes?",default:!y.flags.noGit})),e.flags.noInstall||(t.noInstall=await K({message:`Should we run '${a}`+(a==="yarn"?"'?":" install' for you?"),default:!y.flags.noInstall})),t.importAlias=await xe({message:"What import alias would you like to use?",default:y.flags.importAlias,validate:Pe});let i=[];switch(t.backend){case"payload":i.push("payload");break;default:break}switch(t.authentication){case"authjs":i.push("authjs");break;case"betterAuth":i.push("betterAuth");break;default:break}switch(t.orm){case"prisma":i.push("prisma");break;case"drizzle":i.push("drizzle");break;default:break}switch(t.linter){case"eslint/prettier":i.push("eslint/prettier");break;default:break}return{appName:t.name??e.appName,packages:i,flags:{...e.flags,noGit:!t.noGit||e.flags.noGit,noInstall:!t.noInstall||e.flags.noInstall,importAlias:t.importAlias??e.flags.importAlias},databaseProvider:t.databaseProvider||"sqlite"}}catch(a){if(a instanceof R)l.warn(`${W} needs an interactive terminal to run.`),await K({message:"Continue scaffolding with default options?",default:!0})||(l.info("Exiting..."),process.exit(0)),l.info(`Scaffolding default lx2 app in ./${e.appName}`);else throw a}return e}import yt from"path";import Ae from"chalk";import ft from"ora";function Ie(e){let{packages:s}=e;l.info("Adding boilerplate...");for(let[n,a]of Object.entries(s))if(a.inUse){let t=ft(`Boilerplating ${n}...`).start();a.installer(e),t.succeed(Ae.green(`${Ae.green.bold(n)}`))}l.info("")}import Y from"path";import{confirm as ut,select as gt}from"@inquirer/prompts";import j from"chalk";import M from"fs-extra";import ht from"ora";async function je({projectName:e,projectDir:s,pkgManager:n,noInstall:a}){let t=Y.join(m,"template/base");a?l.info(""):l.info(`
|
|
63
62
|
Using: ${j.cyan.bold(n)}
|
|
64
63
|
`);let i=ht(`Scaffolding in: ${s}...
|
|
65
|
-
`).start();if(
|
|
64
|
+
`).start();if(M.existsSync(s))if(M.readdirSync(s).length===0)e!=="."&&i.info(`${j.cyan.bold(e)} exists but is empty, continuing...
|
|
66
65
|
`);else{i.stopAndPersist();let r=await gt({message:`${j.redBright.bold("Warning:")} ${j.cyan.bold(e)} already exists and isn't empty. How would you like to proceed?`,choices:[{value:"abort",name:"Abort installation (recommended)"},{value:"clear",name:"Clear the directory and continue installation"},{value:"overwrite",name:"Continue installation and overwrite conflicting files"}],default:"abort"});r==="abort"&&(i.fail("Aborting installation..."),process.exit(1)),await ut({message:`Are you sure you want to ${r==="clear"?"clear the directory":"overwrite conflicting files"}`,default:!1})||(i.fail("Aborting installation..."),process.exit(1)),r==="clear"&&(i.info(`Emptying ${j.cyan.bold(e)} and creating lx2 app...
|
|
67
|
-
`),
|
|
68
|
-
`)}import k from"path";import Q from"fs-extra";function ze({packages:e,projectDir:s}){let n=k.join(m,"template/packages/src/app/layout"),a=e.payload.inUse,i=k.join(n,"base.tsx"),o=k.join(s,`src/app/${a?"(frontend)":""}/layout.tsx`);Q.copySync(i,o)}function Ce({packages:e,projectDir:s}){let n=k.join(m,"template/packages/src/app/page"),a=e.payload.inUse,t=e.authjs.inUse,i=e.betterAuth.inUse,o=e.prisma.inUse,r=e.drizzle.inUse,c="base.tsx";a&&(c="with-payload.tsx"),t&&(c="with-authjs.tsx"),i&&(c="with-better-auth.tsx"),o&&(c="with-prisma.tsx"),t&&o&&(c="with-authjs-prisma.tsx"),i&&o&&(c="with-better-auth-prisma.tsx"),r&&(c="with-drizzle.tsx"),t&&r&&(c="with-authjs-drizzle.tsx"),i&&r&&(c="with-better-auth-drizzle.tsx");let p=k.join(n,c),u=k.join(s,`src/app/${a?"(frontend)":""}/page.tsx`);Q.copySync(p,u)}function De({packages:e,projectDir:s}){let n=k.join(m,"template/packages/src/app/globals"),a=e.payload.inUse,i=k.join(n,"base.css"),o=k.join(s,`src/app/${a?"(frontend)":""}/globals.css`);Q.copySync(i,o)}async function
|
|
69
|
-
`).start(),n=ee(e),a=await te(e),t=X.parse(e).name;if(a&&n){if(s.stop(),!await
|
|
70
|
-
`)}catch{s.fail(`${
|
|
71
|
-
`)}}import St from"chalk";import{execa as
|
|
72
|
-
`))};var
|
|
66
|
+
`),M.emptyDirSync(s))}i.start(),M.copySync(t,s),M.renameSync(Y.join(s,"_gitignore"),Y.join(s,".gitignore"));let o=e==="."?"App":j.cyan.bold(e);i.succeed(`${o} ${j.green.bold("scaffolded successfully!")}
|
|
67
|
+
`)}import k from"path";import Q from"fs-extra";function ze({packages:e,projectDir:s}){let n=k.join(m,"template/packages/src/app/layout"),a=e.payload.inUse,i=k.join(n,"base.tsx"),o=k.join(s,`src/app/${a?"(frontend)":""}/layout.tsx`);Q.copySync(i,o)}function Ce({packages:e,projectDir:s}){let n=k.join(m,"template/packages/src/app/page"),a=e.payload.inUse,t=e.authjs.inUse,i=e.betterAuth.inUse,o=e.prisma.inUse,r=e.drizzle.inUse,c="base.tsx";a&&(c="with-payload.tsx"),t&&(c="with-authjs.tsx"),i&&(c="with-better-auth.tsx"),o&&(c="with-prisma.tsx"),t&&o&&(c="with-authjs-prisma.tsx"),i&&o&&(c="with-better-auth-prisma.tsx"),r&&(c="with-drizzle.tsx"),t&&r&&(c="with-authjs-drizzle.tsx"),i&&r&&(c="with-better-auth-drizzle.tsx");let p=k.join(n,c),u=k.join(s,`src/app/${a?"(frontend)":""}/page.tsx`);Q.copySync(p,u)}function De({packages:e,projectDir:s}){let n=k.join(m,"template/packages/src/app/globals"),a=e.payload.inUse,i=k.join(n,"base.css"),o=k.join(s,`src/app/${a?"(frontend)":""}/globals.css`);Q.copySync(i,o)}async function Oe({projectName:e,scopedAppName:s,packages:n,noInstall:a,databaseProvider:t}){let i=v(),o=yt.resolve(process.cwd(),e);return await je({projectName:e,projectDir:o,pkgManager:i,scopedAppName:s,noInstall:a,databaseProvider:t}),Ie({projectName:e,scopedAppName:s,projectDir:o,pkgManager:i,packages:n,noInstall:a,databaseProvider:t}),ze({packages:n,projectDir:o}),Ce({packages:n,projectDir:o}),De({packages:n,projectDir:o}),o}import{execSync as Z}from"child_process";import X from"path";import{confirm as Te}from"@inquirer/prompts";import U from"chalk";import{execa as $}from"execa";import Ee from"fs-extra";import bt from"ora";function vt(e){try{return Z("git --version",{cwd:e}),!0}catch{return!1}}function ee(e){return Ee.existsSync(X.join(e,".git"))}async function te(e){try{return await $("git",["rev-parse","--is-inside-work-tree"],{cwd:e,stdout:"ignore"}),!0}catch{return!1}}function kt(){let s=Z("git --version").toString().trim().split(" ")[2],n=s?.split(".")[0],a=s?.split(".")[1];return{major:Number(n),minor:Number(a)}}function wt(){return Z("git config --global init.defaultBranch || echo main").toString().trim()}async function Re(e){if(l.info("Initializing Git..."),!vt(e)){l.warn("Git is not installed. Skipping Git initialization.");return}let s=bt(`Creating a new git repo...
|
|
68
|
+
`).start(),n=ee(e),a=await te(e),t=X.parse(e).name;if(a&&n){if(s.stop(),!await Te({message:`${U.redBright.bold("Warning:")} Git is already initialized in "${t}". Initializing a new git repository would delete the previous history. Would you like to continue anyways?`,default:!1})){s.info("Skipping Git initialization.");return}Ee.removeSync(X.join(e,".git"))}else if(a&&!n&&(s.stop(),!await Te({message:`${U.redBright.bold("Warning:")} "${t}" is already in a git worktree. Would you still like to initialize a new git repository in this directory?`,default:!1}))){s.info("Skipping Git initialization.");return}try{let i=wt(),{major:o,minor:r}=kt();o<2||o==2&&r<28?(await $("git",["init"],{cwd:e}),await $("git",["symbolic-ref","HEAD",`refs/heads/${i}`],{cwd:e})):await $("git",["init",`--initial-branch=${i}`],{cwd:e}),await $("git",["add","."],{cwd:e}),s.succeed(`${U.green("Successfully initialized and staged")} ${U.green.bold("git")}
|
|
69
|
+
`)}catch{s.fail(`${U.bold.red("Failed:")} could not initialize git. Update git to the latest version!
|
|
70
|
+
`)}}import St from"chalk";import{execa as Me}from"execa";import Ue from"ora";var se=async(e,s,n)=>{let{onDataHandle:a,args:t=["install"],stdout:i="pipe"}=n,o=Ue(`Running ${s} install...`).start(),r=Me(s,t,{cwd:e,stdout:i});return await new Promise((c,p)=>{a&&r.stdout?.on("data",a(o)),r.on("error",u=>p(u)),r.on("close",()=>c())}),o},Pt=async(e,s)=>{switch(e){case"npm":return await Me(e,["install"],{cwd:s,stderr:"inherit"}),null;case"pnpm":return se(s,e,{onDataHandle:n=>a=>{let t=a.toString();t.includes("Progress")&&(n.text=t.includes("|")?t.split(" | ")[1]??"":t)}});case"yarn":return se(s,e,{onDataHandle:n=>a=>{n.text=a.toString()}});case"bun":return se(s,e,{stdout:"ignore"})}},$e=async({projectDir:e})=>{l.info("Installing dependencies...");let s=v();(await Pt(s,e)??Ue()).succeed(St.green(`Successfully installed dependencies!
|
|
71
|
+
`))};var qe=async({projectName:e=O,packages:s,noInstall:n,projectDir:a,databaseProvider:t})=>{let i=v();l.info("Next steps:"),e!=="."&&l.info(` cd ${e}`),n&&(i==="yarn"?l.info(` ${i}`):l.info(` ${i} install`)),["postgresql","mysql"].includes(t)&&l.info(" Add your database connection string to .env"),s?.authjs.inUse&&l.info(" Fill in your .env with necessary values. See https://create.lx2.dev/docs/first-steps for more info."),s?.betterAuth.inUse&&l.info(" Fill in your .env with necessary values. See https://create.lx2.dev/docs/first-steps for more info."),s?.prisma.inUse&&l.info(` Run "${i} db:push" to create you database tables.`),["npm"].includes(i)?l.info(` ${i} run dev`):l.info(` ${i} dev`),!await te(a)&&!ee(a)&&l.info(" git init"),l.info(' git commit -m "initial commit"')};import J from"fs";import xt from"path";function Ge(e,s,n){J.readdirSync(e).forEach(t=>{let i=xt.join(e,t);if(J.statSync(i).isDirectory())Ge(i,s,n);else{let r=J.readFileSync(i,"utf8").replace(new RegExp(s,"g"),n);J.writeFileSync(i,r,"utf8")}})}function Le(e,s){let n=s.replace(/\*/g,"").replace(/[^\/]$/,"$&/");Ge(e,"@/",n)}import Ne from"path";function Fe(e){let n=F(e).split("/"),a=n[n.length-1];if(a==="."){let o=Ne.resolve(process.cwd());a=Ne.basename(o)}let t=n.findIndex(o=>o.startsWith("@"));n.findIndex(o=>o.startsWith("@"))!==-1&&(a=n.slice(t).join("/"));let i=n.filter(o=>!o.startsWith("@")).join("/");return[a,i]}import _t from"gradient-string";var At={primary:"#bf95f9",accent:"#6071a4",secondary:"#ff7ac5"};function Je(){let e=_t(Object.values(At)),s=v();(s==="yarn"||s==="pnpm")&&console.log(""),console.log(e.multiline(ne))}import{execSync as It}from"child_process";import jt from"https";function Be(e){let s=z();s.includes("beta")?(l.warn(" You are using a beta version of create-lx2-app."),l.warn(" Please report any bugs you encounter.")):s!==e&&(l.warn(" You are using an outdated version of create-lx2-app."),l.warn(" Your version:",s+".","Latest version in the npm registry:",e),l.warn(" Please run the CLI with @latest to get the latest updates.")),console.log("")}function zt(){return new Promise((e,s)=>{jt.get("https://registry.npmjs.org/-/package/create-lx2-app/dist-tags",n=>{if(n.statusCode===200){let a="";n.on("data",t=>a+=t),n.on("end",()=>{e(JSON.parse(a).latest)})}else s()}).on("error",()=>{s()})})}var We=()=>zt().catch(()=>{try{return It("npm view create-lx2-app version").toString().trim()}catch{return null}});async function Dt(){let e=await We(),s=v();Je(),e&&Be(e);let{appName:n,packages:a,flags:{noGit:t,noInstall:i,importAlias:o},databaseProvider:r}=await _e(),c=we(a),[p,u]=Fe(n),d=await Oe({projectName:u,scopedAppName:p,packages:c,noInstall:i,databaseProvider:r}),f=He.readJsonSync(Ve.join(d,"package.json"));f.name=p,f.clx2aMetadata={initVersion:z()};let{stdout:h}=await Ct(s,["-v"],{cwd:d});f.packageManager=`${s}@${h.trim()}`,He.writeJSONSync(Ve.join(d,"package.json"),f,{spaces:2}),o!=="@/"&&Le(d,o),i||await $e({projectDir:d}),t||await Re(d),await qe({projectDir:d,projectName:u,packages:c,noInstall:i,databaseProvider:r}),process.exit(0)}Dt().catch(e=>{l.error("Aborting installation..."),e instanceof Error?l.error(e.message):(l.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.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Create powerful full-stack web applications with the Lx2 stack",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -30,21 +30,10 @@
|
|
|
30
30
|
"engines": {
|
|
31
31
|
"node": ">=18"
|
|
32
32
|
},
|
|
33
|
-
"scripts": {
|
|
34
|
-
"dev": "tsup --watch",
|
|
35
|
-
"build": "tsup",
|
|
36
|
-
"start": "node dist/index.js",
|
|
37
|
-
"format": "prettier '**/*.{cjs,mjs,ts,tsx,md,json}' --ignore-path ../.gitignore --ignore-unknown --no-error-on-unmatched-pattern --write",
|
|
38
|
-
"format:check": "prettier '**/*.{cjs,mjs,ts,tsx,md,json}' --ignore-path ../.gitignore --ignore-unknown --no-error-on-unmatched-pattern --check",
|
|
39
|
-
"typecheck": "tsc",
|
|
40
|
-
"clean": "rm -rf dist .turbo node_modules",
|
|
41
|
-
"link": "pnpm run build && npm link",
|
|
42
|
-
"release": "changeset version",
|
|
43
|
-
"pub:beta": "pnpm run build && npm publish --tag beta",
|
|
44
|
-
"pub:release": "pnpm run build && npm publish"
|
|
45
|
-
},
|
|
46
33
|
"dependencies": {
|
|
47
34
|
"@inquirer/prompts": "^7.4.0",
|
|
35
|
+
"better-auth": "^1.2.7",
|
|
36
|
+
"better-sqlite3": "^11.9.1",
|
|
48
37
|
"chalk": "^5.4.1",
|
|
49
38
|
"commander": "^13.1.0",
|
|
50
39
|
"execa": "^9.5.2",
|
|
@@ -54,11 +43,9 @@
|
|
|
54
43
|
"sort-package-json": "^3.0.0"
|
|
55
44
|
},
|
|
56
45
|
"devDependencies": {
|
|
57
|
-
"@auth/drizzle-adapter": "^1.10.0",
|
|
58
46
|
"@auth/prisma-adapter": "^2.8.0",
|
|
59
47
|
"@eslint/eslintrc": "^3.3.1",
|
|
60
48
|
"@ianvs/prettier-plugin-sort-imports": "^4.4.1",
|
|
61
|
-
"@libsql/client": "^0.15.10",
|
|
62
49
|
"@payloadcms/db-sqlite": "^3.33.0",
|
|
63
50
|
"@payloadcms/db-vercel-postgres": "^3.33.0",
|
|
64
51
|
"@payloadcms/next": "^3.33.0",
|
|
@@ -71,18 +58,12 @@
|
|
|
71
58
|
"@types/node": "^22",
|
|
72
59
|
"@types/react": "^19",
|
|
73
60
|
"@types/react-dom": "^19",
|
|
74
|
-
"better-auth": "^1.3.4",
|
|
75
|
-
"better-sqlite3": "^12.2.0",
|
|
76
|
-
"drizzle-kit": "^0.31.4",
|
|
77
|
-
"drizzle-orm": "^0.44.4",
|
|
78
61
|
"eslint": "^9.22.0",
|
|
79
62
|
"eslint-config-next": "^15.2.4",
|
|
80
63
|
"graphql": "^16.10.0",
|
|
81
|
-
"mysql2": "^3.14.3",
|
|
82
64
|
"next": "^15.2.4",
|
|
83
65
|
"next-auth": "^5.0.0-beta.25",
|
|
84
66
|
"payload": "^3.33.0",
|
|
85
|
-
"postgres": "^3.4.7",
|
|
86
67
|
"prettier": "^3.5.3",
|
|
87
68
|
"prettier-plugin-tailwindcss": "^0.6.11",
|
|
88
69
|
"prisma": "^6.5.0",
|
|
@@ -94,5 +75,18 @@
|
|
|
94
75
|
"type-fest": "^4.37.0",
|
|
95
76
|
"typescript": "^5.8.2",
|
|
96
77
|
"zod": "^3.24.2"
|
|
78
|
+
},
|
|
79
|
+
"scripts": {
|
|
80
|
+
"dev": "tsup --watch",
|
|
81
|
+
"build": "tsup",
|
|
82
|
+
"start": "node dist/index.js",
|
|
83
|
+
"format": "prettier '**/*.{cjs,mjs,ts,tsx,md,json}' --ignore-path ../.gitignore --ignore-unknown --no-error-on-unmatched-pattern --write",
|
|
84
|
+
"format:check": "prettier '**/*.{cjs,mjs,ts,tsx,md,json}' --ignore-path ../.gitignore --ignore-unknown --no-error-on-unmatched-pattern --check",
|
|
85
|
+
"typecheck": "tsc",
|
|
86
|
+
"clean": "rm -rf dist .turbo node_modules",
|
|
87
|
+
"link": "pnpm run build && npm link",
|
|
88
|
+
"release": "changeset version",
|
|
89
|
+
"pub:beta": "pnpm run build && npm publish --tag beta",
|
|
90
|
+
"pub:release": "pnpm run build && npm publish"
|
|
97
91
|
}
|
|
98
|
-
}
|
|
92
|
+
}
|
|
@@ -9,9 +9,9 @@ export default function HomePage() {
|
|
|
9
9
|
{/* Logo */}
|
|
10
10
|
<picture className="relative">
|
|
11
11
|
<div className="absolute inset-0 animate-pulse rounded-xl bg-gradient-to-r from-purple-500 to-cyan-500 opacity-20 blur-xl dark:from-purple-800 dark:to-cyan-800" />
|
|
12
|
-
<source srcSet="https://github.com/SlickYeet/create-lx2-app/blob/main/docs/public/logo.light.png?raw=true" />
|
|
12
|
+
<source srcSet="https://github.com/SlickYeet/create-lx2-app/blob/main/docs/v1/public/logo.light.png?raw=true" />
|
|
13
13
|
<img
|
|
14
|
-
src="https://github.com/SlickYeet/create-lx2-app/blob/main/docs/public/logo.light.png?raw=true"
|
|
14
|
+
src="https://github.com/SlickYeet/create-lx2-app/blob/main/docs/v1/public/logo.light.png?raw=true"
|
|
15
15
|
alt="Logo"
|
|
16
16
|
width={65}
|
|
17
17
|
height={65}
|
|
@@ -52,20 +52,12 @@ export default async function HomePage() {
|
|
|
52
52
|
/>
|
|
53
53
|
</picture>
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
<h1 className="mt-6 bg-gradient-to-r from-purple-500 to-cyan-500 bg-clip-text text-center text-4xl leading-10 text-transparent sm:text-5xl sm:leading-14 md:text-6xl md:leading-20 lg:mt-10 lg:text-7xl lg:font-bold">
|
|
62
|
-
Lx2 Next.js App
|
|
63
|
-
</h1>
|
|
64
|
-
<p className="mt-4 text-center text-lg text-neutral-700 md:text-xl lg:mt-6 dark:text-neutral-300">
|
|
65
|
-
Build modern web applications with today's most popular tools
|
|
66
|
-
</p>
|
|
67
|
-
</>
|
|
68
|
-
)}
|
|
55
|
+
<h1 className="mt-6 bg-gradient-to-r from-purple-500 to-cyan-500 bg-clip-text text-center text-4xl leading-10 text-transparent sm:text-5xl sm:leading-14 md:text-6xl md:leading-20 lg:mt-10 lg:text-7xl lg:font-bold">
|
|
56
|
+
Lx2 Next.js App
|
|
57
|
+
</h1>
|
|
58
|
+
<p className="mt-4 text-center text-lg text-neutral-700 md:text-xl lg:mt-6 dark:text-neutral-300">
|
|
59
|
+
Build modern web applications with today's most popular tools
|
|
60
|
+
</p>
|
|
69
61
|
|
|
70
62
|
<div className="mt-12 flex items-center gap-3">
|
|
71
63
|
<a
|
|
@@ -132,7 +124,7 @@ export default async function HomePage() {
|
|
|
132
124
|
</span>
|
|
133
125
|
</h1>
|
|
134
126
|
|
|
135
|
-
{user
|
|
127
|
+
{user && (
|
|
136
128
|
<form
|
|
137
129
|
action={async (formData: FormData) => {
|
|
138
130
|
"use server"
|
|
@@ -171,10 +163,6 @@ export default async function HomePage() {
|
|
|
171
163
|
+
|
|
172
164
|
</button>
|
|
173
165
|
</form>
|
|
174
|
-
) : (
|
|
175
|
-
<p className="text-center text-lg text-neutral-700 md:text-xl lg:mt-6 dark:text-neutral-300">
|
|
176
|
-
Sign in to create posts
|
|
177
|
-
</p>
|
|
178
166
|
)}
|
|
179
167
|
</div>
|
|
180
168
|
|
|
@@ -48,20 +48,12 @@ export default async function HomePage() {
|
|
|
48
48
|
/>
|
|
49
49
|
</picture>
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
<h1 className="mt-6 bg-gradient-to-r from-purple-500 to-cyan-500 bg-clip-text text-center text-4xl leading-10 text-transparent sm:text-5xl sm:leading-14 md:text-6xl md:leading-20 lg:mt-10 lg:text-7xl lg:font-bold">
|
|
58
|
-
Lx2 Next.js App
|
|
59
|
-
</h1>
|
|
60
|
-
<p className="mt-4 text-center text-lg text-neutral-700 md:text-xl lg:mt-6 dark:text-neutral-300">
|
|
61
|
-
Build modern web applications with today's most popular tools
|
|
62
|
-
</p>
|
|
63
|
-
</>
|
|
64
|
-
)}
|
|
51
|
+
<h1 className="mt-6 bg-gradient-to-r from-purple-500 to-cyan-500 bg-clip-text text-center text-4xl leading-10 text-transparent sm:text-5xl sm:leading-14 md:text-6xl md:leading-20 lg:mt-10 lg:text-7xl lg:font-bold">
|
|
52
|
+
Lx2 Next.js App
|
|
53
|
+
</h1>
|
|
54
|
+
<p className="mt-4 text-center text-lg text-neutral-700 md:text-xl lg:mt-6 dark:text-neutral-300">
|
|
55
|
+
Build modern web applications with today's most popular tools
|
|
56
|
+
</p>
|
|
65
57
|
|
|
66
58
|
<div className="mt-12 flex items-center gap-3">
|
|
67
59
|
<a
|
|
@@ -148,7 +148,7 @@ export default async function HomePage() {
|
|
|
148
148
|
</span>
|
|
149
149
|
</h1>
|
|
150
150
|
|
|
151
|
-
{user
|
|
151
|
+
{user && (
|
|
152
152
|
<form
|
|
153
153
|
action={async (formData: FormData) => {
|
|
154
154
|
"use server"
|
|
@@ -187,10 +187,6 @@ export default async function HomePage() {
|
|
|
187
187
|
+
|
|
188
188
|
</button>
|
|
189
189
|
</form>
|
|
190
|
-
) : (
|
|
191
|
-
<p className="text-center text-lg text-neutral-700 md:text-xl lg:mt-6 dark:text-neutral-300">
|
|
192
|
-
Sign in to create posts
|
|
193
|
-
</p>
|
|
194
190
|
)}
|
|
195
191
|
</div>
|
|
196
192
|
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { betterAuth } from "better-auth"
|
|
2
|
-
import { drizzleAdapter } from "better-auth/adapters/drizzle"
|
|
3
|
-
import { nextCookies } from "better-auth/next-js"
|
|
4
|
-
|
|
5
|
-
import { env } from "@/env"
|
|
6
|
-
import { db } from "@/server/db"
|
|
7
|
-
|
|
8
|
-
export const auth = betterAuth({
|
|
9
|
-
database: drizzleAdapter(db, {
|
|
10
|
-
provider: "sqlite",
|
|
11
|
-
}),
|
|
12
|
-
baseURL: env.NEXT_PUBLIC_BETTER_AUTH_URL,
|
|
13
|
-
socialProviders: {
|
|
14
|
-
discord: {
|
|
15
|
-
clientId: env.DISCORD_CLIENT_ID,
|
|
16
|
-
clientSecret: env.DISCORD_CLIENT_SECRET,
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
plugins: [nextCookies()], // make sure nextCookies() is the last plugin in the array
|
|
20
|
-
})
|