create-lx2-app 0.11.5-beta.cb1ede2 → 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.
- package/dist/index.js +28 -26
- package/package.json +2 -1
- package/template/packages/config/biome.jsonc +46 -9
- package/template/packages/config/next/with-payload.ts +14 -0
- package/template/packages/config/tsconfig/base.json +8 -2
- package/template/packages/config/tsconfig/with-payload.json +8 -2
- package/template/packages/src/app/api/trpc/[trpc]/route.ts +34 -0
- package/template/packages/src/app/layout/with-trpc.tsx +37 -0
- package/template/packages/src/app/page/base.tsx +4 -1
- package/template/packages/src/app/page/with-authjs-drizzle.tsx +4 -1
- package/template/packages/src/app/page/with-authjs-prisma.tsx +4 -1
- package/template/packages/src/app/page/with-authjs.tsx +4 -1
- package/template/packages/src/app/page/with-better-auth-drizzle.tsx +4 -1
- package/template/packages/src/app/page/with-better-auth-prisma.tsx +4 -1
- package/template/packages/src/app/page/with-better-auth.tsx +4 -1
- package/template/packages/src/app/page/with-drizzle.tsx +4 -1
- package/template/packages/src/app/page/with-payload.tsx +4 -1
- package/template/packages/src/app/page/with-prisma.tsx +4 -1
- package/template/packages/src/app/page/with-trpc.tsx +118 -0
- package/template/packages/src/components/greeting.tsx +21 -0
- package/template/packages/src/env/with-better-auth-db.js +2 -2
- package/template/packages/src/env/with-better-auth.js +2 -2
- package/template/packages/src/env/with-trpc-authjs-db.js +55 -0
- package/template/packages/src/env/with-trpc-authjs.js +53 -0
- package/template/packages/src/env/with-trpc-better-auth-db.js +52 -0
- package/template/packages/src/env/with-trpc-better-auth.js +50 -0
- package/template/packages/src/env/with-trpc-db.js +46 -0
- package/template/packages/src/env/with-trpc.js +44 -0
- package/template/packages/src/lib/api/client.tsx +85 -0
- package/template/packages/src/lib/api/query-client.ts +22 -0
- package/template/packages/src/lib/api/server.ts +31 -0
- package/template/packages/src/lib/auth/better-auth-client.ts +1 -1
- package/template/packages/src/lib/utils.ts +7 -0
- package/template/packages/src/server/api/init/base.ts +103 -0
- package/template/packages/src/server/api/init/with-authjs-db.ts +132 -0
- package/template/packages/src/server/api/init/with-authjs.ts +130 -0
- package/template/packages/src/server/api/init/with-betterauth-db.ts +134 -0
- package/template/packages/src/server/api/init/with-betterauth.ts +132 -0
- package/template/packages/src/server/api/init/with-db.ts +106 -0
- package/template/packages/src/server/api/root.ts +23 -0
- package/template/packages/src/server/api/routers/post/base.ts +46 -0
- package/template/packages/src/server/api/routers/post/with-auth-drizzle.ts +44 -0
- package/template/packages/src/server/api/routers/post/with-auth-prisma.ts +47 -0
- package/template/packages/src/server/api/routers/post/with-auth.ts +43 -0
- package/template/packages/src/server/api/routers/post/with-drizzle.ts +36 -0
- package/template/packages/src/server/api/routers/post/with-prisma.ts +37 -0
- package/template/packages/src/server/auth/better-auth-with-drizzle.ts +1 -1
- package/template/packages/src/server/auth/better-auth-with-prisma.ts +1 -1
- package/template/packages/src/server/auth/better-auth.ts +1 -0
- package/template/packages/src/server/auth/config/authjs-with-drizzle.ts +1 -1
- package/template/packages/src/server/auth/config/authjs-with-prisma.ts +1 -1
- package/template/packages/src/server/auth/config/authjs.ts +1 -1
- package/template/packages/src/server/db/schema-drizzle/with-authjs-mysql.ts +1 -1
- package/template/packages/src/server/db/schema-drizzle/with-authjs-postgresql.ts +1 -1
- package/template/packages/src/server/db/schema-drizzle/with-authjs-sqlite.ts +1 -1
- /package/template/{base/next.config.ts → packages/config/next/base.ts} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
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
|
-
`,
|
|
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(`
|
|
10
|
-
`);return
|
|
10
|
+
`);return s&&(l+=`
|
|
11
11
|
# Prisma
|
|
12
12
|
# https://www.prisma.io/docs/reference/database-reference/connection-urls#env
|
|
13
|
-
`),i&&(
|
|
13
|
+
`),i&&(l+=`
|
|
14
14
|
# Drizzle ORM
|
|
15
15
|
# https://orm.drizzle.team/docs/connect-overview
|
|
16
|
-
`),(
|
|
17
|
-
`),
|
|
16
|
+
`),(s||i)&&(r==="mysql"?l+=`DATABASE_URL="mysql://root:password@localhost:3306/${o}"`:r==="postgresql"?l+=`DATABASE_URL="postgresql://postgres:password@localhost:5432/${o}"`:r==="sqlite"&&(l+='DATABASE_URL="file:./db.sqlite"'),l+=`
|
|
17
|
+
`),a&&(l+=`
|
|
18
18
|
# Payload CMS
|
|
19
19
|
# https://payloadcms.com/docs/database/overview
|
|
20
|
-
`,
|
|
21
|
-
`,
|
|
22
|
-
`),e&&(
|
|
20
|
+
`,l+=`PAYLOAD_SECRET=""
|
|
21
|
+
`,r==="postgresql"?l+=`DATABASE_URL="postgresql://postgres:password@localhost:5432/${o}"`:r==="sqlite"&&(l+='DATABASE_URL="file:./db.sqlite"'),l+=`
|
|
22
|
+
`),e&&(l+=`
|
|
23
23
|
# Next Auth
|
|
24
24
|
# You can generate a new secret on the command line with:
|
|
25
25
|
# npx auth secret
|
|
@@ -29,21 +29,23 @@ AUTH_SECRET=""
|
|
|
29
29
|
# Next Auth Discord Provider
|
|
30
30
|
DISCORD_CLIENT_ID=""
|
|
31
31
|
DISCORD_CLIENT_SECRET=""
|
|
32
|
-
`),
|
|
32
|
+
`),t&&(l+=`
|
|
33
33
|
# Better Auth
|
|
34
34
|
# You can generate a new secret by going to the Better Auth docs:
|
|
35
35
|
# https://www.better-auth.com/docs/installation#set-environment-variables
|
|
36
36
|
BETTER_AUTH_SECRET=""
|
|
37
|
-
|
|
37
|
+
NEXT_PUBLIC_URL="http://localhost:3000" # Base URL of your app
|
|
38
38
|
|
|
39
39
|
# Better Auth Discord Provider
|
|
40
40
|
DISCORD_CLIENT_ID=""
|
|
41
41
|
DISCORD_CLIENT_SECRET=""
|
|
42
|
-
`),!e&&!a
|
|
42
|
+
`),!e&&!s&&!a&&(l+=`
|
|
43
43
|
# Example:
|
|
44
44
|
# SERVERVAR="foo"
|
|
45
45
|
# NEXT_PUBLIC_CLIENTVAR="bar"
|
|
46
|
-
`),
|
|
46
|
+
`),n&&(l+=`
|
|
47
|
+
NEXT_PUBLIC_URL="http://localhost:3000"
|
|
48
|
+
`),l}var Ct=`
|
|
47
49
|
# Since the ".env" file is gitignored, you can use the ".env.example" file to
|
|
48
50
|
# build a new ".env" file when you clone the repo. Keep this file up-to-date
|
|
49
51
|
# when you add new variables to \`.env\`.
|
|
@@ -53,19 +55,19 @@ DISCORD_CLIENT_SECRET=""
|
|
|
53
55
|
# ".env" and populate it with your secrets.
|
|
54
56
|
`.trim().concat(`
|
|
55
57
|
|
|
56
|
-
`);import
|
|
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,
|
|
57
59
|
and likely to result in a crash. Please run create-lx2-app with another
|
|
58
60
|
package manager such as pnpm, npm, or Yarn Classic.
|
|
59
|
-
See: https://github.com/t3-oss/create-t3-app/issues/57`);let
|
|
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
|
|
60
62
|
using Git Bash. If that's that case, please use Git Bash from another terminal, such as Windows Terminal. Alternatively, you
|
|
61
|
-
can provide the arguments from the CLI directly: https://create.lx2.dev/docs/getting-started#experimental-ci-flags to skip the prompts.`),new
|
|
62
|
-
Using: ${z.cyan.bold(
|
|
63
|
-
`);let
|
|
64
|
-
`).start();if(
|
|
65
|
-
`);else{
|
|
66
|
-
`),
|
|
67
|
-
`)}import
|
|
68
|
-
`).start(),
|
|
69
|
-
`)}catch{
|
|
70
|
-
`)}}import
|
|
71
|
-
`))};var
|
|
63
|
+
can provide the arguments from the CLI directly: https://create.lx2.dev/docs/getting-started#experimental-ci-flags to skip the prompts.`),new B("Non-interactive environment");let s=v(),i={};n||(i.name=await He({message:"What will your project be called?",default:F,validate:f=>Je(f)})),i.backend=await U({message:"What backend framework would you like to use?",choices:[{value:"nextjs",name:"Next.js"},{value:"payload",name:"Payload CMS"}],default:y.flags.backend}),i.backend==="payload"&&(i.dbProvider=await U({message:"What database provider would you like to use?",choices:[{value:"sqlite",name:"SQLite"},{value:"postgresql",name:"PostgreSQL"}],default:y.flags.dbProvider})),i.backend==="nextjs"&&(i.trpc=await ee({message:"Would you like to use tRPC?",default:!y.flags.trpc}),i.authentication=await U({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}),i.orm=await U({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}),i.orm!=="none"&&(i.dbProvider=await U({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}))),i.linter=await U({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.git||(i.git=await ee({message:"Should we initialize a Git repository and stage the changes?",default:!y.flags.git})),e.flags.install||(i.install=await ee({message:`Should we run '${s}`+(s==="yarn"?"'?":" install' for you?"),default:!y.flags.install})),i.importAlias=await He({message:"What import alias would you like to use?",default:y.flags.importAlias,validate:Ve});let{packages:a,databaseProvider:o}=X({backend:i.backend,trpc:i.trpc??!1,authentication:i.authentication??"none",orm:i.orm??"none",linter:i.linter,dbProvider:i.dbProvider??"sqlite"}),r=[...e.packages||[],...a||[]],l=Array.from(new Set(r));if(l.includes("trpc")){let f=R.find(p=>p.packages.includes("trpc"));f&&l.filter(d=>f.packages.includes(d)&&d!=="trpc").length>0&&(c.warn("As of right now, Create Lx2 App only supports TRPC with certain combinations of packages. Exiting."),process.exit(0))}return{appName:i.name??e.appName,packages:a,flags:{...e.flags,git:i.git??e.flags.git,install:i.install??e.flags.install,importAlias:i.importAlias??e.flags.importAlias},databaseProvider:o}}catch(s){if(s instanceof B)c.warn(`${le} needs an interactive terminal to run.`),await ee({message:"Continue scaffolding with default options?",default:!0})||(c.info("Exiting..."),process.exit(0)),c.info(`Scaffolding default lx2 app in ./${e.appName}`);else throw s}return e}import Ft from"path";import Ye from"chalk";import Et from"ora";function Xe(e){let{packages:t}=e;c.info("Adding boilerplate...");for(let[n,s]of Object.entries(t))if(s.inUse){let i=Et(`Boilerplating ${n}...`).start();s.installer(e),i.succeed(Ye.green(`${Ye.green.bold(n)}`))}c.info("")}import ue from"path";import{confirm as qt,select as Mt}from"@inquirer/prompts";import z from"chalk";import N from"fs-extra";import $t from"ora";async function Qe({projectName:e,projectDir:t,pkgManager:n,install:s}){let i=ue.join(m,"template/base");s?c.info(""):c.info(`
|
|
64
|
+
Using: ${z.cyan.bold(n)}
|
|
65
|
+
`);let a=$t(`Scaffolding in: ${t}...
|
|
66
|
+
`).start();if(N.existsSync(t))if(N.readdirSync(t).length===0)e!=="."&&a.info(`${z.cyan.bold(e)} exists but is empty, continuing...
|
|
67
|
+
`);else{a.stopAndPersist();let r=await Mt({message:`${z.redBright.bold("Warning:")} ${z.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"&&(a.fail("Aborting installation..."),process.exit(1)),await qt({message:`Are you sure you want to ${r==="clear"?"clear the directory":"overwrite conflicting files"}`,default:!1})||(a.fail("Aborting installation..."),process.exit(1)),r==="clear"&&(a.info(`Emptying ${z.cyan.bold(e)} and creating lx2 app...
|
|
68
|
+
`),N.emptyDirSync(t))}a.start(),N.copySync(i,t),N.renameSync(ue.join(t,"_gitignore"),ue.join(t,".gitignore"));let o=e==="."?"App":z.cyan.bold(e);a.succeed(`${o} ${z.green.bold("scaffolded successfully!")}
|
|
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
|
+
`).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
|
+
`)}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=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.
|
|
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": {
|
|
@@ -94,6 +94,7 @@
|
|
|
94
94
|
"prisma": "^7.2.0",
|
|
95
95
|
"react": "^19.2.3",
|
|
96
96
|
"react-dom": "^19.2.3",
|
|
97
|
+
"server-only": "^0.0.1",
|
|
97
98
|
"sharp": "^0.34.5",
|
|
98
99
|
"tailwindcss": "^4.1.18",
|
|
99
100
|
"tsup": "^8.5.1",
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "
|
|
2
|
+
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
|
|
3
3
|
"assist": {
|
|
4
4
|
"actions": {
|
|
5
|
+
"recommended": true,
|
|
5
6
|
"source": {
|
|
6
7
|
"organizeImports": {
|
|
7
8
|
"level": "on",
|
|
@@ -16,6 +17,7 @@
|
|
|
16
17
|
"identifierOrder": "natural",
|
|
17
18
|
},
|
|
18
19
|
},
|
|
20
|
+
"recommended": true,
|
|
19
21
|
"useSortedAttributes": "on",
|
|
20
22
|
"useSortedKeys": "on",
|
|
21
23
|
"useSortedProperties": "on",
|
|
@@ -23,9 +25,35 @@
|
|
|
23
25
|
},
|
|
24
26
|
"enabled": true,
|
|
25
27
|
},
|
|
28
|
+
"css": {
|
|
29
|
+
"assist": {
|
|
30
|
+
"enabled": true,
|
|
31
|
+
},
|
|
32
|
+
"formatter": {
|
|
33
|
+
"enabled": true,
|
|
34
|
+
},
|
|
35
|
+
"linter": {
|
|
36
|
+
"enabled": true,
|
|
37
|
+
},
|
|
38
|
+
"parser": {
|
|
39
|
+
"cssModules": true,
|
|
40
|
+
"tailwindDirectives": true,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
26
43
|
"files": {
|
|
27
44
|
"ignoreUnknown": true,
|
|
28
|
-
"includes": [
|
|
45
|
+
"includes": [
|
|
46
|
+
"**",
|
|
47
|
+
"!node_modules",
|
|
48
|
+
"!.next",
|
|
49
|
+
"!dist",
|
|
50
|
+
"!build",
|
|
51
|
+
"!out",
|
|
52
|
+
"!package-lock.json",
|
|
53
|
+
"!pnpm-lock.yaml",
|
|
54
|
+
"!bun.lock",
|
|
55
|
+
"!yarn.lock",
|
|
56
|
+
],
|
|
29
57
|
},
|
|
30
58
|
"formatter": {
|
|
31
59
|
"bracketSpacing": true,
|
|
@@ -36,7 +64,15 @@
|
|
|
36
64
|
"lineWidth": 80,
|
|
37
65
|
"useEditorconfig": true,
|
|
38
66
|
},
|
|
67
|
+
"html": {
|
|
68
|
+
"formatter": {
|
|
69
|
+
"enabled": true,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
39
72
|
"javascript": {
|
|
73
|
+
"assist": {
|
|
74
|
+
"enabled": true,
|
|
75
|
+
},
|
|
40
76
|
"formatter": {
|
|
41
77
|
"arrowParentheses": "always",
|
|
42
78
|
"enabled": true,
|
|
@@ -45,14 +81,16 @@
|
|
|
45
81
|
"semicolons": "asNeeded",
|
|
46
82
|
"trailingCommas": "all",
|
|
47
83
|
},
|
|
84
|
+
"linter": {
|
|
85
|
+
"enabled": true,
|
|
86
|
+
},
|
|
48
87
|
},
|
|
49
88
|
"linter": {
|
|
50
|
-
"domains": {
|
|
51
|
-
"next": "recommended",
|
|
52
|
-
"react": "recommended",
|
|
53
|
-
},
|
|
54
89
|
"enabled": true,
|
|
55
90
|
"rules": {
|
|
91
|
+
"a11y": {
|
|
92
|
+
"noLabelWithoutControl": "warn",
|
|
93
|
+
},
|
|
56
94
|
"complexity": {
|
|
57
95
|
"noExtraBooleanCast": "warn",
|
|
58
96
|
"noUselessFragments": "warn",
|
|
@@ -63,8 +101,7 @@
|
|
|
63
101
|
"fix": "safe",
|
|
64
102
|
"level": "warn",
|
|
65
103
|
"options": {
|
|
66
|
-
"
|
|
67
|
-
"functions": ["cn", "clsx", "classnames"],
|
|
104
|
+
"functions": ["clsx", "cva", "cn"],
|
|
68
105
|
},
|
|
69
106
|
},
|
|
70
107
|
},
|
|
@@ -82,7 +119,7 @@
|
|
|
82
119
|
"useShorthandAssign": "error",
|
|
83
120
|
},
|
|
84
121
|
"suspicious": {
|
|
85
|
-
"
|
|
122
|
+
"noArrayIndexKey": "off",
|
|
86
123
|
},
|
|
87
124
|
},
|
|
88
125
|
},
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { withPayload } from "@payloadcms/next/withPayload"
|
|
2
|
+
import type { NextConfig } from "next"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially useful
|
|
6
|
+
* for Docker builds.
|
|
7
|
+
*/
|
|
8
|
+
import "./src/env"
|
|
9
|
+
|
|
10
|
+
const nextConfig: NextConfig = {
|
|
11
|
+
/* config options here */
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default withPayload(nextConfig)
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"noEmit": true,
|
|
19
19
|
"module": "esnext",
|
|
20
20
|
"moduleResolution": "bundler",
|
|
21
|
-
"jsx": "
|
|
21
|
+
"jsx": "react-jsx",
|
|
22
22
|
"incremental": true,
|
|
23
23
|
"plugins": [
|
|
24
24
|
{
|
|
@@ -32,6 +32,12 @@
|
|
|
32
32
|
"@/*": ["./src/*"]
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
|
-
"include": [
|
|
35
|
+
"include": [
|
|
36
|
+
"next-env.d.ts",
|
|
37
|
+
"**/*.ts",
|
|
38
|
+
"**/*.tsx",
|
|
39
|
+
".next/types/**/*.ts",
|
|
40
|
+
".next/dev/types/**/*.ts"
|
|
41
|
+
],
|
|
36
42
|
"exclude": ["node_modules"]
|
|
37
43
|
}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"noEmit": true,
|
|
19
19
|
"module": "esnext",
|
|
20
20
|
"moduleResolution": "bundler",
|
|
21
|
-
"jsx": "
|
|
21
|
+
"jsx": "react-jsx",
|
|
22
22
|
"incremental": true,
|
|
23
23
|
"plugins": [
|
|
24
24
|
{
|
|
@@ -33,6 +33,12 @@
|
|
|
33
33
|
"@payload-config": ["./payload.config.ts"]
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
|
-
"include": [
|
|
36
|
+
"include": [
|
|
37
|
+
"next-env.d.ts",
|
|
38
|
+
"**/*.ts",
|
|
39
|
+
"**/*.tsx",
|
|
40
|
+
".next/types/**/*.ts",
|
|
41
|
+
".next/dev/types/**/*.ts"
|
|
42
|
+
],
|
|
37
43
|
"exclude": ["node_modules"]
|
|
38
44
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { fetchRequestHandler } from "@trpc/server/adapters/fetch"
|
|
2
|
+
import { type NextRequest } from "next/server"
|
|
3
|
+
|
|
4
|
+
import { env } from "@/env"
|
|
5
|
+
import { createTRPCContext } from "@/server/api/init"
|
|
6
|
+
import { appRouter } from "@/server/api/root"
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* This wraps the `createTRPCContext` helper and provides the required context for the tRPC API when
|
|
10
|
+
* handling a HTTP request (e.g. when you make requests from Client Components).
|
|
11
|
+
*/
|
|
12
|
+
async function createContext(req: NextRequest) {
|
|
13
|
+
return createTRPCContext({
|
|
14
|
+
headers: req.headers,
|
|
15
|
+
})
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const handler = (req: NextRequest) =>
|
|
19
|
+
fetchRequestHandler({
|
|
20
|
+
endpoint: "/api/trpc",
|
|
21
|
+
req,
|
|
22
|
+
router: appRouter,
|
|
23
|
+
createContext: () => createContext(req),
|
|
24
|
+
onError:
|
|
25
|
+
env.NODE_ENV === "development"
|
|
26
|
+
? ({ path, error }) => {
|
|
27
|
+
console.error(
|
|
28
|
+
`[tRPC] Error on ${path ?? "<no-path>"}: ${error.message}`
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
: undefined,
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
export { handler as GET, handler as POST }
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Metadata } from "next"
|
|
2
|
+
import { Geist, Geist_Mono } from "next/font/google"
|
|
3
|
+
|
|
4
|
+
import { TRPCReactProvider } from "@/lib/api/client"
|
|
5
|
+
|
|
6
|
+
import "@/styles/globals.css"
|
|
7
|
+
|
|
8
|
+
const geistSans = Geist({
|
|
9
|
+
variable: "--font-geist-sans",
|
|
10
|
+
subsets: ["latin"],
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
const geistMono = Geist_Mono({
|
|
14
|
+
variable: "--font-geist-mono",
|
|
15
|
+
subsets: ["latin"],
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
export const metadata: Metadata = {
|
|
19
|
+
title: "Create Lx2 App",
|
|
20
|
+
description: "Generated by create lx2 app",
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default function RootLayout({
|
|
24
|
+
children,
|
|
25
|
+
}: Readonly<{
|
|
26
|
+
children: React.ReactNode
|
|
27
|
+
}>) {
|
|
28
|
+
return (
|
|
29
|
+
<html lang="en">
|
|
30
|
+
<body
|
|
31
|
+
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
|
|
32
|
+
>
|
|
33
|
+
<TRPCReactProvider>{children}</TRPCReactProvider>
|
|
34
|
+
</body>
|
|
35
|
+
</html>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
@@ -4,7 +4,7 @@ export default function HomePage() {
|
|
|
4
4
|
const fileURL = `vscode://file/${fileURLToPath(import.meta.url)}`
|
|
5
5
|
|
|
6
6
|
return (
|
|
7
|
-
<main className="mx-auto flex h-screen max-w-5xl flex-col items-center justify-between overflow-hidden p-6 sm:p-
|
|
7
|
+
<main className="mx-auto flex h-screen max-w-5xl flex-col items-center justify-between overflow-hidden p-6 sm:p-11.25">
|
|
8
8
|
<div className="flex grow flex-col items-center justify-center">
|
|
9
9
|
{/* Logo */}
|
|
10
10
|
<picture className="relative">
|
|
@@ -45,6 +45,7 @@ export default function HomePage() {
|
|
|
45
45
|
strokeLinejoin="round"
|
|
46
46
|
className="mb-1.5 size-4 fill-none stroke-current stroke-2"
|
|
47
47
|
>
|
|
48
|
+
<title>Docs</title>
|
|
48
49
|
<path d="M7 7h10v10" />
|
|
49
50
|
<path d="M7 17 17 7" />
|
|
50
51
|
</svg>
|
|
@@ -63,6 +64,7 @@ export default function HomePage() {
|
|
|
63
64
|
strokeLinejoin="round"
|
|
64
65
|
className="mb-1.5 size-4 fill-none stroke-current stroke-2"
|
|
65
66
|
>
|
|
67
|
+
<title>Discord</title>
|
|
66
68
|
<path d="M7 7h10v10" />
|
|
67
69
|
<path d="M7 17 17 7" />
|
|
68
70
|
</svg>
|
|
@@ -81,6 +83,7 @@ export default function HomePage() {
|
|
|
81
83
|
strokeLinejoin="round"
|
|
82
84
|
className="mb-1.5 size-4 fill-none stroke-current stroke-2"
|
|
83
85
|
>
|
|
86
|
+
<title>GitHub</title>
|
|
84
87
|
<path d="M7 7h10v10" />
|
|
85
88
|
<path d="M7 17 17 7" />
|
|
86
89
|
</svg>
|