create-lx2-app 0.8.0 → 0.10.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 +22 -23
- package/package.json +17 -23
- package/template/packages/config/biome.jsonc +94 -0
- 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
|
|
2
|
+
import Ke from"path";import{execa as Tt}from"execa";import Ye from"fs-extra";import{confirm as Q,input as Ae,select as z}from"@inquirer/prompts";import{Command as gt}from"commander";import ne from"path";import{fileURLToPath as st}from"url";var at=st(import.meta.url),it=ne.dirname(at),p=ne.join(it,"../"),oe=` ___ ___ ___ _ _____ ___ _ ___ _ ___ ___
|
|
3
3
|
/ __| _ \\ __| /_\\_ _| __| | | __ __|_ ) /_\\ | _ \\ _ \\
|
|
4
4
|
| (__| / _| / _ \\| | | _| | |__\\ \\ / / / / _ \\| _/ _/
|
|
5
5
|
\\___|_|_\\___/_/ \\_\\_| |___| |____/_\\_\\/___| /_/ \\_\\_| |_|
|
|
6
|
-
`,
|
|
6
|
+
`,D="my-lx2-app",V="create-lx2-app";import w from"path";import T from"fs-extra";import le from"path";import ce from"fs-extra";import nt from"sort-package-json";var re={"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","@biomejs/biome":"2.2.4",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:t,devMode:i,projectDir:a}=e,s=ce.readJsonSync(le.join(a,"package.json"));t.forEach(o=>{let r=re[o];i&&s.devDependencies?s.devDependencies[o]=r:s.dependencies&&(s.dependencies[o]=r)});let n=nt(s);ce.writeJsonSync(le.join(a,"package.json"),n,{spaces:2})};var pe=({projectDir:e,packages:t,databaseProvider:i})=>{let a=t?.prisma.inUse,s=t?.drizzle.inUse,n=["better-auth"],o=[];(!a||!s)&&n.push("better-sqlite3"),(!a||!s)&&o.push("@types/better-sqlite3"),g({projectDir:e,dependencies:n,devMode:!1}),g({projectDir:e,dependencies:o,devMode:!0});let r=w.join(p,"template/packages"),c=w.join(r,"src/app/api/auth/[...betterauth]/route.ts"),d=w.join(e,"src/app/api/auth/[...all]/route.ts"),u=w.join(r,"src/server/auth/config",a?"better-auth-with-prisma.ts":s?"better-auth-with-drizzle.ts":"better-auth.ts"),m=T.readFileSync(u,"utf-8");(a||s)&&i!=="sqlite"&&(m=m.replace('provider: "sqlite",',`provider: "${{mysql:"mysql",postgresql:"postgresql"}[i]}",`));let f=w.join(e,"src/server/auth/index.ts");T.mkdirSync(w.dirname(f),{recursive:!0}),T.writeFileSync(f,m);let h=w.join(r,"src/lib/auth/better-auth-client.ts"),O=w.join(e,"src/lib/auth/client.ts");T.copySync(c,d),T.copySync(h,O)};import b from"path";import S from"fs-extra";var de=({projectDir:e,packages:t,databaseProvider:i})=>{let a=[],s=[];if(t?.payload.inUse)switch(a.push("payload"),a.push("@payloadcms/next"),a.push("@payloadcms/payload-cloud"),a.push("@payloadcms/richtext-lexical"),a.push("graphql"),i){case"sqlite":s.push("@payloadcms/db-sqlite");break;case"postgresql":s.push("@payloadcms/db-vercel-postgres");break}g({projectDir:e,dependencies:a,devMode:!1}),g({projectDir:e,dependencies:s,devMode:!1});let n=b.join(p,"template/packages"),o=b.join(n,"config/payload",`${i==="postgresql"?"with-postgres":"with-sqlite"}.ts`),r=b.join(e,"payload.config.ts");S.copyFileSync(o,r);let c=b.join(n,"src/payload/collections"),d=b.join(e,"src/collections");S.mkdirSync(d,{recursive:!0}),S.copyFileSync(b.join(c,"Media.ts"),b.join(d,"Media.ts")),S.copyFileSync(b.join(c,"Users.ts"),b.join(d,"Users.ts"));let u=b.join(n,"src/app/(payload)"),m=b.join(e,"src/app/(payload)");S.mkdirSync(m,{recursive:!0}),S.copySync(u,m);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 me from"path";import ot from"fs-extra";var fe=({projectDir:e,packages:t})=>{let i=t?.typescript.inUse,a=t?.payload.inUse,s=[];i&&(s.push("typescript"),s.push("@types/node"),s.push("@types/react"),s.push("@types/react-dom")),g({projectDir:e,dependencies:s,devMode:!0});let n=me.join(p,"template/packages/config/tsconfig",`${a?"with-payload":"base"}.json`),o=me.join(e,"tsconfig.json");ot.copyFileSync(n,o)};import A from"path";import H from"fs-extra";var ue=({projectDir:e,packages:t})=>{let i=t?.prisma.inUse,a=t?.drizzle.inUse,s=["next-auth"];i&&s.push("@auth/prisma-adapter"),a&&s.push("@auth/drizzle-adapter"),g({projectDir:e,dependencies:s,devMode:!1});let n=A.join(p,"template/packages"),o="src/app/api/auth/[...nextauth]/route.ts",r=A.join(n,o),c=A.join(e,o),d=A.join(n,"src/server/auth/config",i?"authjs-with-prisma.ts":a?"authjs-with-drizzle.ts":"authjs.ts"),u=A.join(e,"src/server/auth/config.ts"),m=A.join(n,"src/server/auth/authjs.ts"),f=A.join(e,"src/server/auth/index.ts");H.copySync(r,c),H.copySync(d,u),H.copySync(m,f)};import K from"path";import ct from"fs-extra";import rt from"path";import ge from"fs-extra";import{sortPackageJson as lt}from"sort-package-json";function q(e){let{scripts:t,projectDir:i}=e,a=rt.join(i,"package.json"),s=ge.readJSONSync(a);s.scripts={...s.scripts,...t};let n=lt(s);ge.writeJSONSync(a,n,{spaces:2})}var he=({projectDir:e})=>{g({projectDir:e,dependencies:["@biomejs/biome"],devMode:!0});let t=K.join(p,"template/packages"),i=K.join(t,"config/biome.jsonc"),a=K.join(e,"biome.jsonc");ct.copyFileSync(i,a),q({projectDir:e,scripts:{"lint:unsafe":"biome check --write --unsafe .","lint:write":"biome check --write .",lint:"biome check .",format:"biome format --write ."}})};import P from"path";import I from"fs-extra";var ye=({projectDir:e,packages:t,scopedAppName:i,databaseProvider:a})=>{let s=t?.authjs.inUse,n=t?.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(p,"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"),d=P.join(o,"src/server/db/schema-drizzle",s?`with-authjs-${a}.ts`:n?`with-better-auth-${a}.ts`:`base-${a}.ts`),u=P.join(e,"src/server/db/schema.ts"),m=I.readFileSync(d,"utf-8");m=m.replace("project1_${name}",`${i}_\${name}`);let f=I.readFileSync(r,"utf-8");f=f.replace("project1_*",`${i}_*`);let h=P.join(o,`src/server/db/index-drizzle/with-${a}.ts`),O=P.join(e,"src/server/db/index.ts");q({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,m),I.writeFileSync(c,f),I.copySync(h,O)};import G from"path";import Y from"fs-extra";var be=({projectDir:e,scopedAppName:t,packages:i,databaseProvider:a})=>{let s=i?.envVariables.inUse,n=i?.authjs.inUse,o=i?.betterAuth.inUse,r=i?.prisma.inUse,c=i?.drizzle.inUse,d=i?.payload.inUse,u=[];s&&(u.push("@t3-oss/env-nextjs"),u.push("zod")),g({projectDir:e,dependencies:u,devMode:!1});let m=r||c||d,f=pt(!!n,!!o,!!r,!!c,!!d,t,a),h="";if(m?n?h="with-authjs-db.js":o?h="with-better-auth-db.js":d?h="with-payload.js":h="with-db.js":n?h="with-authjs.js":o&&(h="with-better-auth.js"),h!==""){let et=G.join(p,"template/packages/src/env",h),tt=G.join(e,"src/env.ts");Y.copyFileSync(et,tt)}let O=G.join(e,".env"),Qe=G.join(e,".env.example"),Xe=dt+f,W=Buffer.from(crypto.getRandomValues(new Uint8Array(32))).toString("base64"),Ze=f.replace('AUTH_SECRET=""',`AUTH_SECRET="${W}" # Generated by create-lx2-app`).replace('BETTER_AUTH_SECRET=""',`BETTER_AUTH_SECRET="${W}" # Generated by create-lx2-app`).replace('PAYLOAD_SECRET=""',`PAYLOAD_SECRET="${W}" # Generated by create-lx2-app`);Y.writeFileSync(O,Ze,"utf-8"),Y.writeFileSync(Qe,Xe,"utf-8")};function pt(e,t,i,a,s,n,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
|
-
`);return
|
|
10
|
+
`);return i&&(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/${
|
|
18
|
-
`),
|
|
16
|
+
`),(i||a)&&(o==="mysql"?r+=`DATABASE_URL="mysql://root:password@localhost:3306/${n}"`:o==="postgresql"?r+=`DATABASE_URL="postgresql://postgres:password@localhost:5432/${n}"`:o==="sqlite"&&(r+='DATABASE_URL="file:./db.sqlite"'),r+=`
|
|
17
|
+
`),s&&(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/${n}"`: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:
|
|
@@ -30,7 +29,7 @@ AUTH_SECRET=""
|
|
|
30
29
|
# Next Auth Discord Provider
|
|
31
30
|
DISCORD_CLIENT_ID=""
|
|
32
31
|
DISCORD_CLIENT_SECRET=""
|
|
33
|
-
`),
|
|
32
|
+
`),t&&(r+=`
|
|
34
33
|
# Better Auth
|
|
35
34
|
# You can generate a new secret by going to the Better Auth docs:
|
|
36
35
|
# https://www.better-auth.com/docs/installation#set-environment-variables
|
|
@@ -40,11 +39,11 @@ NEXT_PUBLIC_BETTER_AUTH_URL="http://localhost:3000" # Base URL of your app
|
|
|
40
39
|
# Better Auth Discord Provider
|
|
41
40
|
DISCORD_CLIENT_ID=""
|
|
42
41
|
DISCORD_CLIENT_SECRET=""
|
|
43
|
-
`),!e&&!
|
|
42
|
+
`),!e&&!i&&!s&&(r+=`
|
|
44
43
|
# Example:
|
|
45
44
|
# SERVERVAR="foo"
|
|
46
45
|
# NEXT_PUBLIC_CLIENTVAR="bar"
|
|
47
|
-
`),r}var
|
|
46
|
+
`),r}var dt=`
|
|
48
47
|
# Since the ".env" file is gitignored, you can use the ".env.example" file to
|
|
49
48
|
# build a new ".env" file when you clone the repo. Keep this file up-to-date
|
|
50
49
|
# when you add new variables to \`.env\`.
|
|
@@ -54,19 +53,19 @@ DISCORD_CLIENT_SECRET=""
|
|
|
54
53
|
# ".env" and populate it with your secrets.
|
|
55
54
|
`.trim().concat(`
|
|
56
55
|
|
|
57
|
-
`);import
|
|
56
|
+
`);import R from"path";import L from"fs-extra";var ve=({projectDir:e,packages:t})=>{let i=t?.["eslint/prettier"].inUse,a=[];i&&(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 s=R.join(p,"template/packages/config","eslint.config.mjs"),n=R.join(p,"template/packages/config","prettier.config.mjs"),o=R.join(e,"eslint.config.mjs"),r=R.join(e,"prettier.config.mjs"),c=R.join(e,"package.json"),d=L.readJSONSync(c);d.scripts={...d.scripts,lint:"next lint"},L.copyFileSync(s,o),L.writeJSONSync(c,d,{spaces:2}),L.copyFileSync(n,r)};import x from"path";import _ from"fs-extra";var ke=({projectDir:e,packages:t,databaseProvider:i})=>{let a=t?.authjs.inUse,s=t?.betterAuth.inUse;g({projectDir:e,dependencies:["prisma"],devMode:!0}),g({projectDir:e,dependencies:["@prisma/client"],devMode:!1});let n=x.join(p,"template/packages"),o=x.join(n,"prisma/schema",`${a?"with-authjs":s?"with-better-auth":"base"}.prisma`),r=_.readFileSync(o,"utf-8");i!=="sqlite"&&(r=r.replace('provider = "sqlite"',`provider = "${{mysql:"mysql",postgresql:"postgresql"}[i]}"`),["mysql"].includes(i)&&(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 d=x.join(n,"src/server/db/db-prisma.ts"),u=x.join(e,"src/server/db/index.ts");_.mkdirSync(x.dirname(u),{recursive:!0}),_.writeFileSync(u,_.readFileSync(d,"utf-8"));let m=x.join(e,"package.json"),f=_.readJSONSync(m);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(m,f,{spaces:2})};var we=["none","authjs","betterAuth"],Se=["none","prisma","drizzle"],F=["sqlite","mysql","postgresql"];var Pe=e=>({authjs:{inUse:e.includes("authjs"),installer:ue},betterAuth:{inUse:e.includes("betterAuth"),installer:pe},prisma:{inUse:e.includes("prisma"),installer:ke},drizzle:{inUse:e.includes("drizzle"),installer:ye},envVariables:{inUse:!0,installer:be},"eslint/prettier":{inUse:e.includes("eslint/prettier"),installer:ve},biome:{inUse:e.includes("biome"),installer:he},typescript:{inUse:!0,installer:fe},payload:{inUse:e.includes("payload"),installer:de}});import mt from"path";import ft from"fs-extra";function C(){let e=mt.join(p,"package.json");return ft.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 E=class extends Error{constructor(t){super(t)}};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 J=e=>(e.length>1&&e.endsWith("/")&&(e=e.slice(0,-1)),e);var ut=/^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/;function xe(e){let t=J(e),i=t.split("/"),a=i.findIndex(n=>n.startsWith("@")),s=i[i.length-1];return i.findIndex(n=>n.startsWith("@"))!==-1&&(s=i.slice(a).join("/")),t=="."||ut.test(s??"")?!0:"App name must consist of only lowercase alphanumeric characters, '-', and '_'"}var _e=e=>e.startsWith(".")||e.startsWith("/")?"Import alias can't start with '.' or '/'":!0;var y={appName:D,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 Ie(){let e=y,t=new gt().name(V).description("CLI for scaffolding new web apps with the Lx2 stack").version(C(),"-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: ${we.join(", ")}`,y.flags.authentication).option("--databaseORM [orm]",`Choose a database ORM to use. Possible values: ${Se.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: ${F.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
|
|
59
|
+
See: https://github.com/t3-oss/create-t3-app/issues/57`);let i=t.args[0];if(i&&(e.appName=i),e.flags=t.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;case"biome":e.packages.push("biome");break;default:break}return F.includes(e.flags.dbProvider)===!1&&(l.warn(`Incompatible database provided. Use: ${F.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
|
|
63
|
-
Using: ${j.cyan.bold(
|
|
64
|
-
`);let
|
|
65
|
-
`).start();if(
|
|
66
|
-
`);else{
|
|
67
|
-
`),
|
|
68
|
-
`)}import k from"path";import
|
|
69
|
-
`).start(),
|
|
70
|
-
`)}catch{
|
|
71
|
-
`)}}import
|
|
72
|
-
`))};var Le=async({projectName:e=
|
|
61
|
+
can provide the arguments from the CLI directly: https://create.lx2.dev/docs/getting-started#experimental-ci-flags to skip the prompts.`),new E("Non-interactive environment");let a=v(),s={};i||(s.name=await Ae({message:"What will your project be called?",default:D,validate:o=>xe(o)})),s.backend=await z({message:"What backend framework would you like to use?",choices:[{value:"nextjs",name:"Next.js"},{value:"payload",name:"Payload CMS"}],default:!y.flags.backend}),s.backend==="payload"&&(s.databaseProvider=await z({message:"What database provider would you like to use?",choices:[{value:"sqlite",name:"SQLite"},{value:"postgresql",name:"PostgreSQL"}],default:!y.flags.dbProvider})),s.backend==="nextjs"&&(s.authentication=await z({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}),s.orm=await z({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}),s.orm!=="none"&&(s.databaseProvider=await z({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}))),s.linter=await z({message:"What linter and formatter would you like to use?",choices:[{value:"eslint/prettier",name:"ESLint/Prettier"},{value:"biome",name:"Biome"}],default:!y.flags.linter}),e.flags.noGit||(s.noGit=await Q({message:"Should we initialize a Git repository and stage the changes?",default:!y.flags.noGit})),e.flags.noInstall||(s.noInstall=await Q({message:`Should we run '${a}`+(a==="yarn"?"'?":" install' for you?"),default:!y.flags.noInstall})),s.importAlias=await Ae({message:"What import alias would you like to use?",default:y.flags.importAlias,validate:_e});let n=[];switch(s.backend){case"payload":n.push("payload");break;default:break}switch(s.authentication){case"authjs":n.push("authjs");break;case"betterAuth":n.push("betterAuth");break;default:break}switch(s.orm){case"prisma":n.push("prisma");break;case"drizzle":n.push("drizzle");break;default:break}switch(s.linter){case"eslint/prettier":n.push("eslint/prettier");break;case"biome":n.push("biome");break;default:break}return{appName:s.name??e.appName,packages:n,flags:{...e.flags,noGit:!s.noGit||e.flags.noGit,noInstall:!s.noInstall||e.flags.noInstall,importAlias:s.importAlias??e.flags.importAlias},databaseProvider:s.databaseProvider||"sqlite"}}catch(a){if(a instanceof E)l.warn(`${V} needs an interactive terminal to run.`),await Q({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 kt from"path";import je from"chalk";import ht from"ora";function Ce(e){let{packages:t}=e;l.info("Adding boilerplate...");for(let[i,a]of Object.entries(t))if(a.inUse){let s=ht(`Boilerplating ${i}...`).start();a.installer(e),s.succeed(je.green(`${je.green.bold(i)}`))}l.info("")}import X from"path";import{confirm as yt,select as bt}from"@inquirer/prompts";import j from"chalk";import M from"fs-extra";import vt from"ora";async function ze({projectName:e,projectDir:t,pkgManager:i,noInstall:a}){let s=X.join(p,"template/base");a?l.info(""):l.info(`
|
|
62
|
+
Using: ${j.cyan.bold(i)}
|
|
63
|
+
`);let n=vt(`Scaffolding in: ${t}...
|
|
64
|
+
`).start();if(M.existsSync(t))if(M.readdirSync(t).length===0)e!=="."&&n.info(`${j.cyan.bold(e)} exists but is empty, continuing...
|
|
65
|
+
`);else{n.stopAndPersist();let r=await bt({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"&&(n.fail("Aborting installation..."),process.exit(1)),await yt({message:`Are you sure you want to ${r==="clear"?"clear the directory":"overwrite conflicting files"}`,default:!1})||(n.fail("Aborting installation..."),process.exit(1)),r==="clear"&&(n.info(`Emptying ${j.cyan.bold(e)} and creating lx2 app...
|
|
66
|
+
`),M.emptyDirSync(t))}n.start(),M.copySync(s,t),M.renameSync(X.join(t,"_gitignore"),X.join(t,".gitignore"));let o=e==="."?"App":j.cyan.bold(e);n.succeed(`${o} ${j.green.bold("scaffolded successfully!")}
|
|
67
|
+
`)}import k from"path";import Z from"fs-extra";function Oe({packages:e,projectDir:t}){let i=k.join(p,"template/packages/src/app/layout"),a=e.payload.inUse,n=k.join(i,"base.tsx"),o=k.join(t,`src/app/${a?"(frontend)":""}/layout.tsx`);Z.copySync(n,o)}function De({packages:e,projectDir:t}){let i=k.join(p,"template/packages/src/app/page"),a=e.payload.inUse,s=e.authjs.inUse,n=e.betterAuth.inUse,o=e.prisma.inUse,r=e.drizzle.inUse,c="base.tsx";a&&(c="with-payload.tsx"),s&&(c="with-authjs.tsx"),n&&(c="with-better-auth.tsx"),o&&(c="with-prisma.tsx"),s&&o&&(c="with-authjs-prisma.tsx"),n&&o&&(c="with-better-auth-prisma.tsx"),r&&(c="with-drizzle.tsx"),s&&r&&(c="with-authjs-drizzle.tsx"),n&&r&&(c="with-better-auth-drizzle.tsx");let d=k.join(i,c),u=k.join(t,`src/app/${a?"(frontend)":""}/page.tsx`);Z.copySync(d,u)}function Te({packages:e,projectDir:t}){let i=k.join(p,"template/packages/src/app/globals"),a=e.payload.inUse,n=k.join(i,"base.css"),o=k.join(t,`src/app/${a?"(frontend)":""}/globals.css`);Z.copySync(n,o)}async function Re({projectName:e,scopedAppName:t,packages:i,noInstall:a,databaseProvider:s}){let n=v(),o=kt.resolve(process.cwd(),e);return await ze({projectName:e,projectDir:o,pkgManager:n,scopedAppName:t,noInstall:a,databaseProvider:s}),Ce({projectName:e,scopedAppName:t,projectDir:o,pkgManager:n,packages:i,noInstall:a,databaseProvider:s}),Oe({packages:i,projectDir:o}),De({packages:i,projectDir:o}),Te({packages:i,projectDir:o}),o}import{execSync as te}from"child_process";import ee from"path";import{confirm as Ee}from"@inquirer/prompts";import U from"chalk";import{execa as $}from"execa";import Me from"fs-extra";import wt from"ora";function St(e){try{return te("git --version",{cwd:e}),!0}catch{return!1}}function se(e){return Me.existsSync(ee.join(e,".git"))}async function ae(e){try{return await $("git",["rev-parse","--is-inside-work-tree"],{cwd:e,stdout:"ignore"}),!0}catch{return!1}}function Pt(){let t=te("git --version").toString().trim().split(" ")[2],i=t?.split(".")[0],a=t?.split(".")[1];return{major:Number(i),minor:Number(a)}}function xt(){return te("git config --global init.defaultBranch || echo main").toString().trim()}async function Ue(e){if(l.info("Initializing Git..."),!St(e)){l.warn("Git is not installed. Skipping Git initialization.");return}let t=wt(`Creating a new git repo...
|
|
68
|
+
`).start(),i=se(e),a=await ae(e),s=ee.parse(e).name;if(a&&i){if(t.stop(),!await Ee({message:`${U.redBright.bold("Warning:")} Git is already initialized in "${s}". Initializing a new git repository would delete the previous history. Would you like to continue anyways?`,default:!1})){t.info("Skipping Git initialization.");return}Me.removeSync(ee.join(e,".git"))}else if(a&&!i&&(t.stop(),!await Ee({message:`${U.redBright.bold("Warning:")} "${s}" 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 n=xt(),{major:o,minor:r}=Pt();o<2||o==2&&r<28?(await $("git",["init"],{cwd:e}),await $("git",["symbolic-ref","HEAD",`refs/heads/${n}`],{cwd:e})):await $("git",["init",`--initial-branch=${n}`],{cwd:e}),await $("git",["add","."],{cwd:e}),t.succeed(`${U.green("Successfully initialized and staged")} ${U.green.bold("git")}
|
|
69
|
+
`)}catch{t.fail(`${U.bold.red("Failed:")} could not initialize git. Update git to the latest version!
|
|
70
|
+
`)}}import _t from"chalk";import{execa as $e}from"execa";import qe from"ora";var ie=async(e,t,i)=>{let{onDataHandle:a,args:s=["install"],stdout:n="pipe"}=i,o=qe(`Running ${t} install...`).start(),r=$e(t,s,{cwd:e,stdout:n});return await new Promise((c,d)=>{a&&r.stdout?.on("data",a(o)),r.on("error",u=>d(u)),r.on("close",()=>c())}),o},At=async(e,t)=>{switch(e){case"npm":return await $e(e,["install"],{cwd:t,stderr:"inherit"}),null;case"pnpm":return ie(t,e,{onDataHandle:i=>a=>{let s=a.toString();s.includes("Progress")&&(i.text=s.includes("|")?s.split(" | ")[1]??"":s)}});case"yarn":return ie(t,e,{onDataHandle:i=>a=>{i.text=a.toString()}});case"bun":return ie(t,e,{stdout:"ignore"})}},Ge=async({projectDir:e})=>{l.info("Installing dependencies...");let t=v();(await At(t,e)??qe()).succeed(_t.green(`Successfully installed dependencies!
|
|
71
|
+
`))};var Le=async({projectName:e=D,packages:t,noInstall:i,projectDir:a,databaseProvider:s})=>{let n=v();l.info("Next steps:"),e!=="."&&l.info(` cd ${e}`),i&&(n==="yarn"?l.info(` ${n}`):l.info(` ${n} install`)),["postgresql","mysql"].includes(s)&&l.info(" Add your database connection string to .env"),t?.authjs.inUse&&l.info(" Fill in your .env with necessary values. See https://create.lx2.dev/docs/first-steps for more info."),t?.betterAuth.inUse&&l.info(" Fill in your .env with necessary values. See https://create.lx2.dev/docs/first-steps for more info."),t?.prisma.inUse&&l.info(` Run "${n} db:push" to create you database tables.`),["npm"].includes(n)?l.info(` ${n} run dev`):l.info(` ${n} dev`),!await ae(a)&&!se(a)&&l.info(" git init"),l.info(' git commit -m "initial commit"')};import B from"fs";import It from"path";function Fe(e,t,i){B.readdirSync(e).forEach(s=>{let n=It.join(e,s);if(B.statSync(n).isDirectory())Fe(n,t,i);else{let r=B.readFileSync(n,"utf8").replace(new RegExp(t,"g"),i);B.writeFileSync(n,r,"utf8")}})}function Ne(e,t){let i=t.replace(/\*/g,"").replace(/[^\/]$/,"$&/");Fe(e,"@/",i)}import Je from"path";function Be(e){let i=J(e).split("/"),a=i[i.length-1];if(a==="."){let o=Je.resolve(process.cwd());a=Je.basename(o)}let s=i.findIndex(o=>o.startsWith("@"));i.findIndex(o=>o.startsWith("@"))!==-1&&(a=i.slice(s).join("/"));let n=i.filter(o=>!o.startsWith("@")).join("/");return[a,n]}import jt from"gradient-string";var Ct={primary:"#bf95f9",accent:"#6071a4",secondary:"#ff7ac5"};function We(){let e=jt(Object.values(Ct)),t=v();(t==="yarn"||t==="pnpm")&&console.log(""),console.log(e.multiline(oe))}import{execSync as zt}from"child_process";import Ot from"https";function Ve(e){let t=C();t.includes("beta")?(l.warn(" You are using a beta version of create-lx2-app."),l.warn(" Please report any bugs you encounter.")):t!==e&&(l.warn(" You are using an outdated version of create-lx2-app."),l.warn(" Your version:",t+".","Latest version in the npm registry:",e),l.warn(" Please run the CLI with @latest to get the latest updates.")),console.log("")}function Dt(){return new Promise((e,t)=>{Ot.get("https://registry.npmjs.org/-/package/create-lx2-app/dist-tags",i=>{if(i.statusCode===200){let a="";i.on("data",s=>a+=s),i.on("end",()=>{e(JSON.parse(a).latest)})}else t()}).on("error",()=>{t()})})}var He=()=>Dt().catch(()=>{try{return zt("npm view create-lx2-app version").toString().trim()}catch{return null}});async function Rt(){let e=await He(),t=v();We(),e&&Ve(e);let{appName:i,packages:a,flags:{noGit:s,noInstall:n,importAlias:o},databaseProvider:r}=await Ie(),c=Pe(a),[d,u]=Be(i),m=await Re({projectName:u,scopedAppName:d,packages:c,noInstall:n,databaseProvider:r}),f=Ye.readJsonSync(Ke.join(m,"package.json"));f.name=d,f.clx2aMetadata={initVersion:C()};let{stdout:h}=await Tt(t,["-v"],{cwd:m});f.packageManager=`${t}@${h.trim()}`,Ye.writeJSONSync(Ke.join(m,"package.json"),f,{spaces:2}),o!=="@/"&&Ne(m,o),n||await Ge({projectDir:m}),s||await Ue(m),await Le({projectDir:m,projectName:u,packages:c,noInstall:n,databaseProvider:r}),process.exit(0)}Rt().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.10.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
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://biomejs.dev/schemas/2.2.4/schema.json",
|
|
3
|
+
"assist": {
|
|
4
|
+
"actions": {
|
|
5
|
+
"source": {
|
|
6
|
+
"organizeImports": {
|
|
7
|
+
"level": "on",
|
|
8
|
+
"options": {
|
|
9
|
+
"groups": [
|
|
10
|
+
[":PACKAGE:", ":PACKAGE_WITH_PROTOCOL:"],
|
|
11
|
+
":BLANK_LINE:",
|
|
12
|
+
":ALIAS:",
|
|
13
|
+
":BLANK_LINE:",
|
|
14
|
+
":PATH:",
|
|
15
|
+
],
|
|
16
|
+
"identifierOrder": "natural",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
"useSortedAttributes": "on",
|
|
20
|
+
"useSortedKeys": "on",
|
|
21
|
+
"useSortedProperties": "on",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
"enabled": true,
|
|
25
|
+
},
|
|
26
|
+
"files": {
|
|
27
|
+
"ignoreUnknown": true,
|
|
28
|
+
"includes": ["**", "!node_modules", "!.next", "!dist", "!build"],
|
|
29
|
+
},
|
|
30
|
+
"formatter": {
|
|
31
|
+
"bracketSpacing": true,
|
|
32
|
+
"enabled": true,
|
|
33
|
+
"expand": "auto",
|
|
34
|
+
"indentStyle": "space",
|
|
35
|
+
"indentWidth": 2,
|
|
36
|
+
"lineWidth": 80,
|
|
37
|
+
"useEditorconfig": true,
|
|
38
|
+
},
|
|
39
|
+
"javascript": {
|
|
40
|
+
"formatter": {
|
|
41
|
+
"arrowParentheses": "always",
|
|
42
|
+
"enabled": true,
|
|
43
|
+
"jsxQuoteStyle": "double",
|
|
44
|
+
"quoteStyle": "double",
|
|
45
|
+
"semicolons": "asNeeded",
|
|
46
|
+
"trailingCommas": "all",
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
"linter": {
|
|
50
|
+
"domains": {
|
|
51
|
+
"next": "recommended",
|
|
52
|
+
"react": "recommended",
|
|
53
|
+
},
|
|
54
|
+
"enabled": true,
|
|
55
|
+
"rules": {
|
|
56
|
+
"complexity": {
|
|
57
|
+
"noExtraBooleanCast": "warn",
|
|
58
|
+
"noUselessFragments": "warn",
|
|
59
|
+
"noUselessTernary": "warn",
|
|
60
|
+
},
|
|
61
|
+
"nursery": {
|
|
62
|
+
"useSortedClasses": {
|
|
63
|
+
"fix": "safe",
|
|
64
|
+
"level": "warn",
|
|
65
|
+
"options": {
|
|
66
|
+
"attributes": ["className", "class"],
|
|
67
|
+
"functions": ["cn", "clsx", "classnames"],
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
"recommended": true,
|
|
72
|
+
"style": {
|
|
73
|
+
"useCollapsedElseIf": "error",
|
|
74
|
+
"useCollapsedIf": "error",
|
|
75
|
+
"useConst": "error",
|
|
76
|
+
"useImportType": {
|
|
77
|
+
"level": "warn",
|
|
78
|
+
"options": {
|
|
79
|
+
"style": "separatedType",
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
"useShorthandAssign": "error",
|
|
83
|
+
},
|
|
84
|
+
"suspicious": {
|
|
85
|
+
"noUnknownAtRules": "off",
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
"vcs": {
|
|
90
|
+
"clientKind": "git",
|
|
91
|
+
"enabled": true,
|
|
92
|
+
"useIgnoreFile": true,
|
|
93
|
+
},
|
|
94
|
+
}
|
|
@@ -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
|
-
})
|