create-lx2-app 0.11.5-beta.e86db31 → 0.12.1-beta.db923f0
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 +25 -27
- package/package.json +1 -2
- package/template/packages/src/server/auth/better-auth.ts +0 -1
- package/template/packages/src/app/api/trpc/[trpc]/route.ts +0 -34
- package/template/packages/src/app/layout/with-trpc.tsx +0 -37
- package/template/packages/src/app/page/with-trpc.tsx +0 -115
- package/template/packages/src/components/greeting.tsx +0 -21
- package/template/packages/src/env/with-trpc-authjs-db.js +0 -55
- package/template/packages/src/env/with-trpc-authjs.js +0 -53
- package/template/packages/src/env/with-trpc-better-auth-db.js +0 -54
- package/template/packages/src/env/with-trpc-better-auth.js +0 -52
- package/template/packages/src/env/with-trpc-db.js +0 -46
- package/template/packages/src/env/with-trpc.js +0 -44
- package/template/packages/src/lib/api/client.tsx +0 -85
- package/template/packages/src/lib/api/query-client.ts +0 -22
- package/template/packages/src/lib/api/server.ts +0 -31
- package/template/packages/src/lib/utils.ts +0 -7
- package/template/packages/src/server/api/init/base.ts +0 -103
- package/template/packages/src/server/api/init/with-authjs-db.ts +0 -132
- package/template/packages/src/server/api/init/with-authjs.ts +0 -130
- package/template/packages/src/server/api/init/with-betterauth-db.ts +0 -134
- package/template/packages/src/server/api/init/with-betterauth.ts +0 -132
- package/template/packages/src/server/api/init/with-db.ts +0 -106
- package/template/packages/src/server/api/root.ts +0 -23
- package/template/packages/src/server/api/routers/post/base.ts +0 -46
- package/template/packages/src/server/api/routers/post/with-auth-drizzle.ts +0 -44
- package/template/packages/src/server/api/routers/post/with-auth.ts +0 -43
- package/template/packages/src/server/api/routers/post/with-drizzle.ts +0 -36
package/dist/index.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
2
|
+
import Qe from"path";import{execa as Rt}from"execa";import Xe from"fs-extra";import{confirm as Q,input as Ie,select as T}from"@inquirer/prompts";import{Command as ht}from"commander";import ne from"path";import{fileURLToPath as it}from"url";var at=it(import.meta.url),nt=ne.dirname(at),c=ne.join(nt,"../"),oe=` ___ ___ ___ _ _____ ___ _ ___ _ ___ ___
|
|
3
3
|
/ __| _ \\ __| /_\\_ _| __| | | __ __|_ ) /_\\ | _ \\ _ \\
|
|
4
4
|
| (__| / _| / _ \\| | | _| | |__\\ \\ / / / / _ \\| _/ _/
|
|
5
5
|
\\___|_|_\\___/_/ \\_\\_| |___| |____/_\\_\\/___| /_/ \\_\\_| |_|
|
|
6
|
-
`,
|
|
6
|
+
`,O="my-lx2-app",V="create-lx2-app";var b=()=>{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 j from"path";import H from"fs-extra";var re={"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","@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 le from"path";import pe from"fs-extra";import ot from"sort-package-json";var m=e=>{let{dependencies:s,devMode:a,projectDir:i}=e,t=pe.readJsonSync(le.join(i,"package.json"));s.forEach(o=>{let r=re[o];a&&t.devDependencies?t.devDependencies[o]=r:t.dependencies&&(t.dependencies[o]=r)});let n=ot(t);pe.writeJsonSync(le.join(i,"package.json"),n,{spaces:2})};var ce=({projectDir:e,packages:s})=>{let a=s?.prisma.inUse,i=s?.drizzle.inUse,t=["next-auth"];a&&t.push("@auth/prisma-adapter"),i&&t.push("@auth/drizzle-adapter"),m({projectDir:e,dependencies:t,devMode:!1});let n=j.join(c,"template/packages"),o="src/app/api/auth/[...nextauth]/route.ts",r=j.join(n,o),p=j.join(e,o),f=j.join(n,"src/server/auth/config",a?"authjs-with-prisma.ts":i?"authjs-with-drizzle.ts":"authjs.ts"),u=j.join(e,"src/server/auth/config.ts"),d=j.join(n,"src/server/auth/authjs.ts"),g=j.join(e,"src/server/auth/index.ts");H.copySync(r,p),H.copySync(f,u),H.copySync(d,g)};import P from"path";import R from"fs-extra";import rt from"path";import de from"fs-extra";import{sortPackageJson as lt}from"sort-package-json";function v(e){let{scripts:s,projectDir:a}=e,i=rt.join(a,"package.json"),t=de.readJSONSync(i);t.scripts={...t.scripts,...s};let n=lt(t);de.writeJSONSync(i,n,{spaces:2})}var me=({projectDir:e,packages:s,databaseProvider:a})=>{let i=s?.prisma.inUse,t=s?.drizzle.inUse,n=i||t,o=["better-auth"],r=[];n||o.push("better-sqlite3"),n||r.push("@types/better-sqlite3"),m({projectDir:e,dependencies:o,devMode:!1}),m({projectDir:e,dependencies:r,devMode:!0});let p=P.join(c,"template/packages"),f=P.join(p,"src/app/api/auth/[...betterauth]/route.ts"),u=P.join(e,"src/app/api/auth/[...all]/route.ts"),d=P.join(p,"src/server/auth",i?"better-auth-with-prisma.ts":t?"better-auth-with-drizzle.ts":"better-auth.ts"),g=R.readFileSync(d,"utf-8");(i||t)&&a!=="sqlite"&&(g=g.replace('provider: "sqlite",',`provider: "${{mysql:"mysql",postgresql:t?"pg":"postgresql"}[a]}",`));let h=P.join(e,"src/server/auth/index.ts");R.mkdirSync(P.dirname(h),{recursive:!0}),R.writeFileSync(h,g);let S=P.join(p,"src/lib/auth/better-auth-client.ts"),W=P.join(e,"src/lib/auth/client.ts");v({projectDir:e,scripts:{"auth:generate":"npx @better-auth/cli@latest generate --config ./src/server/auth/index.ts --yes",...!i&&!t&&{"auth:migrate":"npx @better-auth/cli@latest migrate --config ./src/server/auth/index.ts --yes"}}}),R.copySync(f,u),R.copySync(S,W)};import K from"path";import pt from"fs-extra";var fe=({projectDir:e})=>{m({projectDir:e,dependencies:["@biomejs/biome"],devMode:!0});let s=K.join(c,"template/packages"),a=K.join(s,"config/biome.jsonc"),i=K.join(e,"biome.jsonc");pt.copyFileSync(a,i),v({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 I from"fs-extra";var ue=({projectDir:e,packages:s,scopedAppName:a,databaseProvider:i})=>{let t=s?.authjs.inUse,n=s?.betterAuth.inUse;m({projectDir:e,dependencies:["drizzle-kit"],devMode:!0}),m({projectDir:e,dependencies:["drizzle-orm",{sqlite:"@libsql/client",mysql:"mysql2",postgresql:"postgres"}[i]],devMode:!1});let o=_.join(c,"template/packages"),r=_.join(o,"config/drizzle",{sqlite:"with-sqlite",mysql:"with-mysql",postgresql:"with-postgresql"}[i]+".ts"),p=_.join(e,"drizzle.config.ts"),f=_.join(o,"src/server/db/schema-drizzle",t?`with-authjs-${i}.ts`:n?`with-better-auth-${i}.ts`:`base-${i}.ts`),u=_.join(e,"src/server/db/schema.ts"),d=I.readFileSync(f,"utf-8");d=d.replace("project1_${name}",`${a}_\${name}`);let g=I.readFileSync(r,"utf-8");g=g.replace("project1_*",`${a}_*`);let h=_.join(o,`src/server/db/index-drizzle/with-${i}.ts`),S=_.join(e,"src/server/db/index.ts");v({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,p),I.mkdirSync(_.dirname(u),{recursive:!0}),I.writeFileSync(u,d),I.writeFileSync(p,g),I.copySync(h,S)};import $ from"path";import Y from"fs-extra";var ge=({projectDir:e,scopedAppName:s,packages:a,databaseProvider:i})=>{let t=a?.envVariables.inUse,n=a?.authjs.inUse,o=a?.betterAuth.inUse,r=a?.prisma.inUse,p=a?.drizzle.inUse,f=a?.payload.inUse,u=[];t&&(u.push("@t3-oss/env-nextjs"),u.push("zod")),m({projectDir:e,dependencies:u,devMode:!1});let d=r||p||f,g=ct(!!n,!!o,!!r,!!p,!!f,s,i),h="";if(d?n?h="with-authjs-db.js":o?h="with-better-auth-db.js":f?h="with-payload.js":h="with-db.js":n?h="with-authjs.js":o&&(h="with-better-auth.js"),h!==""){let tt=$.join(c,"template/packages/src/env",h),st=$.join(e,"src/env.ts");Y.copyFileSync(tt,st)}let S=$.join(e,".env"),W=$.join(e,".env.example"),Ze=dt+g,J=Buffer.from(crypto.getRandomValues(new Uint8Array(32))).toString("base64"),et=g.replace('AUTH_SECRET=""',`AUTH_SECRET="${J}" # Generated by create-lx2-app`).replace('BETTER_AUTH_SECRET=""',`BETTER_AUTH_SECRET="${J}" # Generated by create-lx2-app`).replace('PAYLOAD_SECRET=""',`PAYLOAD_SECRET="${J}" # Generated by create-lx2-app`);Y.writeFileSync(S,et,"utf-8"),Y.writeFileSync(W,Ze,"utf-8")};function ct(e,s,a,i,t,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 a&&(r+=`
|
|
11
11
|
# Prisma
|
|
12
12
|
# https://www.prisma.io/docs/reference/database-reference/connection-urls#env
|
|
13
|
-
`),i&&(
|
|
13
|
+
`),i&&(r+=`
|
|
14
14
|
# Drizzle ORM
|
|
15
15
|
# https://orm.drizzle.team/docs/connect-overview
|
|
16
|
-
`),(
|
|
17
|
-
`),
|
|
16
|
+
`),(a||i)&&(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
|
+
`),t&&(r+=`
|
|
18
18
|
# Payload CMS
|
|
19
19
|
# https://payloadcms.com/docs/database/overview
|
|
20
|
-
`,
|
|
21
|
-
`,
|
|
22
|
-
`),e&&(
|
|
20
|
+
`,r+=`PAYLOAD_SECRET=""
|
|
21
|
+
`,o==="postgresql"?r+=`DATABASE_URL="postgresql://postgres:password@localhost:5432/${n}"`:o==="sqlite"&&(r+='DATABASE_URL="file:./db.sqlite"'),r+=`
|
|
22
|
+
`),e&&(r+=`
|
|
23
23
|
# Next Auth
|
|
24
24
|
# You can generate a new secret on the command line with:
|
|
25
25
|
# npx auth secret
|
|
@@ -29,7 +29,7 @@ AUTH_SECRET=""
|
|
|
29
29
|
# Next Auth Discord Provider
|
|
30
30
|
DISCORD_CLIENT_ID=""
|
|
31
31
|
DISCORD_CLIENT_SECRET=""
|
|
32
|
-
`),
|
|
32
|
+
`),s&&(r+=`
|
|
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
|
|
@@ -39,13 +39,11 @@ NEXT_PUBLIC_BETTER_AUTH_URL="http://localhost:3000" # Base URL of your app
|
|
|
39
39
|
# Better Auth Discord Provider
|
|
40
40
|
DISCORD_CLIENT_ID=""
|
|
41
41
|
DISCORD_CLIENT_SECRET=""
|
|
42
|
-
`),!e&&!
|
|
42
|
+
`),!e&&!a&&!t&&(r+=`
|
|
43
43
|
# Example:
|
|
44
44
|
# SERVERVAR="foo"
|
|
45
45
|
# NEXT_PUBLIC_CLIENTVAR="bar"
|
|
46
|
-
`),
|
|
47
|
-
NEXT_PUBLIC_URL="http://localhost:3000"
|
|
48
|
-
`),l}var Pt=`
|
|
46
|
+
`),r}var dt=`
|
|
49
47
|
# Since the ".env" file is gitignored, you can use the ".env.example" file to
|
|
50
48
|
# build a new ".env" file when you clone the repo. Keep this file up-to-date
|
|
51
49
|
# when you add new variables to \`.env\`.
|
|
@@ -55,19 +53,19 @@ NEXT_PUBLIC_URL="http://localhost:3000"
|
|
|
55
53
|
# ".env" and populate it with your secrets.
|
|
56
54
|
`.trim().concat(`
|
|
57
55
|
|
|
58
|
-
`);import
|
|
56
|
+
`);import F from"path";import he from"fs-extra";var ye=({projectDir:e,packages:s})=>{let a=s?.["eslint/prettier"].inUse,i=[];a&&(i.push("eslint"),i.push("eslint-config-next"),i.push("@eslint/eslintrc"),i.push("prettier"),i.push("prettier-plugin-tailwindcss"),i.push("@ianvs/prettier-plugin-sort-imports")),m({projectDir:e,dependencies:i,devMode:!0});let t=F.join(c,"template/packages/config","eslint.config.mjs"),n=F.join(c,"template/packages/config","prettier.config.mjs"),o=F.join(e,"eslint.config.mjs"),r=F.join(e,"prettier.config.mjs");v({projectDir:e,scripts:{"lint:write":"eslint --fix",lint:"eslint",format:"prettier --write ."}}),he.copyFileSync(t,o),he.copyFileSync(n,r)};import w from"path";import C from"fs-extra";var be=({projectDir:e,packages:s,databaseProvider:a})=>{let i=[],t=[];if(s?.payload.inUse)switch(i.push("payload"),i.push("@payloadcms/next"),i.push("@payloadcms/payload-cloud"),i.push("@payloadcms/richtext-lexical"),i.push("graphql"),a){case"sqlite":t.push("@payloadcms/db-sqlite");break;case"postgresql":t.push("@payloadcms/db-vercel-postgres");break}m({projectDir:e,dependencies:i,devMode:!1}),m({projectDir:e,dependencies:t,devMode:!1});let n=w.join(c,"template/packages"),o=w.join(n,"config/payload",`${a==="postgresql"?"with-postgres":"with-sqlite"}.ts`),r=w.join(e,"payload.config.ts");C.copyFileSync(o,r);let p=w.join(n,"src/payload/collections"),f=w.join(e,"src/collections");C.mkdirSync(f,{recursive:!0}),C.copyFileSync(w.join(p,"Media.ts"),w.join(f,"Media.ts")),C.copyFileSync(w.join(p,"Users.ts"),w.join(f,"Users.ts"));let u=w.join(n,"src/app/(payload)"),d=w.join(e,"src/app/(payload)");C.mkdirSync(d,{recursive:!0}),C.copySync(u,d),v({projectDir:e,scripts:{payload:"payload","generate:importmap":"payload generate:importmap","generate:types":"payload generate:types"}})};import k from"path";import A from"fs-extra";var ve=({projectDir:e,packages:s,databaseProvider:a,pkgManager:i})=>{let t=s?.authjs.inUse,n=s?.betterAuth.inUse;m({projectDir:e,dependencies:["prisma"],devMode:!0});let o={sqlite:i==="bun"?"@prisma/adapter-libsql":"@prisma/adapter-better-sqlite3",mysql:"@prisma/adapter-mariadb",postgresql:"@prisma/adapter-pg"}[a];m({projectDir:e,dependencies:["@prisma/client",o],devMode:!1}),a==="sqlite"&&i!=="bun"&&m({projectDir:e,dependencies:["@types/better-sqlite3"],devMode:!0}),i==="pnpm"&&m({projectDir:e,dependencies:["@prisma/client-runtime-utils"],devMode:!1});let r=k.join(c,"template/packages"),p=k.join(r,"config/prisma.config.ts"),f=k.join(e,"prisma.config.ts");A.writeFileSync(f,A.readFileSync(p,"utf-8"));let u=k.join(r,"prisma/schema",`${t?"with-authjs":n?"with-better-auth":"base"}.prisma`),d=A.readFileSync(u,"utf-8");a!=="sqlite"&&(d=d.replace('provider = "sqlite"',`provider = "${{mysql:"mysql",postgresql:"postgresql"}[a]}"`),["mysql"].includes(a)&&(d=d.replace("// @db.Text","@db.Text")));let g=k.join(e,"prisma/schema.prisma");A.mkdirSync(k.dirname(g),{recursive:!0}),A.writeFileSync(g,d);let h=k.join(r,`src/server/db/prisma/with-${a}${i==="bun"?"-bun":""}.ts`),S=k.join(e,"src/server/db/index.ts");A.mkdirSync(k.dirname(S),{recursive:!0}),A.writeFileSync(S,A.readFileSync(h,"utf-8")),v({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 we from"path";import mt from"fs-extra";var ke=({projectDir:e,packages:s})=>{let a=s?.typescript.inUse,i=s?.payload.inUse,t=[];a&&(t.push("typescript"),t.push("@types/node"),t.push("@types/react"),t.push("@types/react-dom")),m({projectDir:e,dependencies:t,devMode:!0});let n=we.join(c,"template/packages/config/tsconfig",`${i?"with-payload":"base"}.json`),o=we.join(e,"tsconfig.json");mt.copyFileSync(n,o)};var xe=["nextjs","payload"],Se=["none","authjs","betterAuth"],Pe=["none","prisma","drizzle"],L=["sqlite","mysql","postgresql"];var _e=e=>({authjs:{inUse:e.includes("authjs"),installer:ce},betterAuth:{inUse:e.includes("betterAuth"),installer:me},prisma:{inUse:e.includes("prisma"),installer:ve},drizzle:{inUse:e.includes("drizzle"),installer:ue},envVariables:{inUse:!0,installer:ge},"eslint/prettier":{inUse:e.includes("eslint/prettier"),installer:ye},biome:{inUse:e.includes("biome"),installer:fe},typescript:{inUse:!0,installer:ke},payload:{inUse:e.includes("payload"),installer:be}});import ft from"path";import ut from"fs-extra";function D(){let e=ft.join(c,"package.json");return ut.readJSONSync(e).version??"1.0.0"}var E=class extends Error{constructor(s){super(s)}};import B from"chalk";var l={error(...e){console.log(B.red(...e))},warn(...e){console.log(B.yellow(...e))},info(...e){console.log(B.cyan(...e))},success(...e){console.log(B.green(...e))}};var N=e=>(e.length>1&&e.endsWith("/")&&(e=e.slice(0,-1)),e);var gt=/^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/;function Ae(e){let s=N(e),a=s.split("/"),i=a.findIndex(n=>n.startsWith("@")),t=a[a.length-1];return a.findIndex(n=>n.startsWith("@"))!==-1&&(t=a.slice(i).join("/")),s=="."||gt.test(t??"")?!0:"App name must consist of only lowercase alphanumeric characters, '-', and '_'"}var je=e=>e.startsWith(".")||e.startsWith("/")?"Import alias can't start with '.' or '/'":!0;var y={appName:O,packages:[],flags:{git:!1,install:!1,default:!1,CI:!1,authentication:"none",orm:"none",linter:"eslint/prettier",importAlias:"@/",dbProvider:"sqlite",backend:"nextjs"},databaseProvider:"sqlite"};async function ze(){let e=y,s=new ht().name(V).description("CLI for scaffolding new web apps with the Lx2 stack").version(D(),"-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("-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: ${xe.join(", ")}`,y.flags.backend).option("--authProvider [provider]",`Choose an authentication provider to use. Possible values: ${Se.join(", ")}`,y.flags.authentication).option("--databaseORM [orm]",`Choose a database ORM to use. Possible values: ${Pe.join(", ")}`,y.flags.orm).option("--linter [linter]",`Choose what linter and formatter to use. Possible values: ${y.flags.linter}`,y.flags.linter).option("-i, --import-alias [alias]","Explicitly tell the CLI to use a custom import alias",y.flags.importAlias).option("--dbProvider [provider]",`Choose a database provider to use. Possible values: ${L.join(", ")}`,y.flags.dbProvider).parse(process.argv);process.env.npm_config_user_agent?.startsWith("yarn/3")&&l.warn(` WARNING: It looks like you are using Yarn 3. This is currently not supported,
|
|
59
57
|
and likely to result in a crash. Please run create-lx2-app with another
|
|
60
58
|
package manager such as pnpm, npm, or Yarn Classic.
|
|
61
|
-
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 a=s.args[0];if(a&&(e.appName=a),e.flags=s.opts(),e.flags.CI){switch(e.packages=[],e.flags.backend==="payload"&&e.packages.push("payload"),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 L.includes(e.flags.dbProvider)===!1&&(l.warn(`Incompatible database provided. Use: ${L.join(", ")}. Exiting.`),process.exit(0)),e.flags.backend==="payload"&&e.flags.dbProvider==="mysql"&&(l.warn("Payload CMS does not support MySQL. Exiting."),process.exit(0)),e}if(e.flags.default)return e;try{if(process.env.TERM_PROGRAM?.toLowerCase().includes("mintty"))throw l.warn(` WARNING: It looks like you are using MinTTY, which is non-interactive. This is most likely because you are
|
|
62
60
|
using Git Bash. If that's that case, please use Git Bash from another terminal, such as Windows Terminal. Alternatively, you
|
|
63
|
-
can provide the arguments from the CLI directly: https://create.lx2.dev/docs/getting-started#experimental-ci-flags to skip the prompts.`),new
|
|
64
|
-
Using: ${z.cyan.bold(
|
|
65
|
-
`);let
|
|
66
|
-
`).start();if(
|
|
67
|
-
`);else{
|
|
68
|
-
`),
|
|
69
|
-
`)}import
|
|
70
|
-
`).start(),
|
|
71
|
-
`)}catch{
|
|
72
|
-
`)}}import
|
|
73
|
-
`))};var
|
|
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 i=b(),t={};a||(t.name=await Ie({message:"What will your project be called?",default:O,validate:o=>Ae(o)})),t.backend=await T({message:"What backend framework would you like to use?",choices:[{value:"nextjs",name:"Next.js"},{value:"payload",name:"Payload CMS"}],default:y.flags.backend}),t.backend==="payload"&&(t.databaseProvider=await T({message:"What database provider would you like to use?",choices:[{value:"sqlite",name:"SQLite"},{value:"postgresql",name:"PostgreSQL"}],default:y.flags.dbProvider})),t.backend==="nextjs"&&(t.authentication=await T({message:"What authentication provider would you like to use?",choices:[{value:"none",name:"None"},{value:"authjs",name:"Auth.js"},{value:"betterAuth",name:"Better Auth"}],default:y.flags.authentication}),t.orm=await T({message:"What database ORM would you like to use?",choices:[{value:"none",name:"None"},{value:"prisma",name:"Prisma"},{value:"drizzle",name:"Drizzle"}],default:y.flags.orm}),t.orm!=="none"&&(t.databaseProvider=await T({message:"What database provider would you like to use?",choices:[{value:"sqlite",name:"SQLite"},{value:"mysql",name:"MySQL"},{value:"postgresql",name:"PostgreSQL"}],default:y.flags.dbProvider}))),t.linter=await T({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||(t.git=await Q({message:"Should we initialize a Git repository and stage the changes?",default:!y.flags.git})),e.flags.install||(t.install=await Q({message:`Should we run '${i}`+(i==="yarn"?"'?":" install' for you?"),default:!y.flags.install})),t.importAlias=await Ie({message:"What import alias would you like to use?",default:y.flags.importAlias,validate:je});let n=[];switch(t.backend==="payload"&&n.push("payload"),t.authentication){case"authjs":n.push("authjs");break;case"betterAuth":n.push("betterAuth");break;default:break}switch(t.orm){case"prisma":n.push("prisma");break;case"drizzle":n.push("drizzle");break;default:break}switch(t.linter){case"eslint/prettier":n.push("eslint/prettier");break;case"biome":n.push("biome");break;default:break}return{appName:t.name??e.appName,packages:n,flags:{...e.flags,git:t.git??e.flags.git,install:t.install??e.flags.install,importAlias:t.importAlias??e.flags.importAlias},databaseProvider:t.databaseProvider??"sqlite"}}catch(i){if(i 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 i}return e}import kt from"path";import Ce from"chalk";import yt from"ora";function De(e){let{packages:s}=e;l.info("Adding boilerplate...");for(let[a,i]of Object.entries(s))if(i.inUse){let t=yt(`Boilerplating ${a}...`).start();i.installer(e),t.succeed(Ce.green(`${Ce.green.bold(a)}`))}l.info("")}import X from"path";import{confirm as bt,select as vt}from"@inquirer/prompts";import z from"chalk";import q from"fs-extra";import wt from"ora";async function Te({projectName:e,projectDir:s,pkgManager:a,install:i}){let t=X.join(c,"template/base");i?l.info(""):l.info(`
|
|
62
|
+
Using: ${z.cyan.bold(a)}
|
|
63
|
+
`);let n=wt(`Scaffolding in: ${s}...
|
|
64
|
+
`).start();if(q.existsSync(s))if(q.readdirSync(s).length===0)e!=="."&&n.info(`${z.cyan.bold(e)} exists but is empty, continuing...
|
|
65
|
+
`);else{n.stopAndPersist();let r=await vt({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"&&(n.fail("Aborting installation..."),process.exit(1)),await bt({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 ${z.cyan.bold(e)} and creating lx2 app...
|
|
66
|
+
`),q.emptyDirSync(s))}n.start(),q.copySync(t,s),q.renameSync(X.join(s,"_gitignore"),X.join(s,".gitignore"));let o=e==="."?"App":z.cyan.bold(e);n.succeed(`${o} ${z.green.bold("scaffolded successfully!")}
|
|
67
|
+
`)}import x from"path";import Z from"fs-extra";function Oe({packages:e,projectDir:s}){let a=x.join(c,"template/packages/src/app/layout"),i=e.payload.inUse,n=x.join(a,"base.tsx"),o=x.join(s,`src/app/${i?"(frontend)":""}/layout.tsx`);Z.copySync(n,o)}function Re({packages:e,projectDir:s}){let a=x.join(c,"template/packages/src/app/page"),i=e.payload.inUse,t=e.authjs.inUse,n=e.betterAuth.inUse,o=e.prisma.inUse,r=e.drizzle.inUse,p="base.tsx";i&&(p="with-payload.tsx"),t&&(p="with-authjs.tsx"),n&&(p="with-better-auth.tsx"),o&&(p="with-prisma.tsx"),t&&o&&(p="with-authjs-prisma.tsx"),n&&o&&(p="with-better-auth-prisma.tsx"),r&&(p="with-drizzle.tsx"),t&&r&&(p="with-authjs-drizzle.tsx"),n&&r&&(p="with-better-auth-drizzle.tsx");let f=x.join(a,p),u=x.join(s,`src/app/${i?"(frontend)":""}/page.tsx`);Z.copySync(f,u)}function Ee({projectDir:e}){let s=x.join(c,"template/packages/src/styles"),i=x.join(s,"base.css"),t=x.join(e,"src/styles/globals.css");Z.copySync(i,t)}async function qe({projectName:e,scopedAppName:s,packages:a,install:i,databaseProvider:t}){let n=b(),o=kt.resolve(process.cwd(),e);return await Te({projectName:e,projectDir:o,pkgManager:n,scopedAppName:s,install:i,databaseProvider:t}),De({projectName:e,scopedAppName:s,projectDir:o,pkgManager:n,packages:a,install:i,databaseProvider:t}),Oe({packages:a,projectDir:o}),Re({packages:a,projectDir:o}),Ee({packages:a,projectDir:o}),o}import{execSync as te}from"child_process";import ee from"path";import{confirm as Me}from"@inquirer/prompts";import M from"chalk";import{execa as U}from"execa";import Ue from"fs-extra";import xt from"ora";function St(e){try{return te("git --version",{cwd:e}),!0}catch{return!1}}function se(e){return Ue.existsSync(ee.join(e,".git"))}async function ie(e){try{return await U("git",["rev-parse","--is-inside-work-tree"],{cwd:e,stdout:"ignore"}),!0}catch{return!1}}function Pt(){let s=te("git --version").toString().trim().split(" ")[2],a=s?.split(".")[0],i=s?.split(".")[1];return{major:Number(a),minor:Number(i)}}function _t(){return te("git config --global init.defaultBranch || echo main").toString().trim()}async function $e(e){if(l.info("Initializing Git..."),!St(e)){l.warn("Git is not installed. Skipping Git initialization.");return}let s=xt(`Creating a new git repo...
|
|
68
|
+
`).start(),a=se(e),i=await ie(e),t=ee.parse(e).name;if(i&&a){if(s.stop(),!await Me({message:`${M.redBright.bold("Warning:")} Git is already initialized in "${t}". Initializing a new git repository would delete the previous history. Would you like to continue anyways?`,default:!1})){s.info("Skipping Git initialization.");return}Ue.removeSync(ee.join(e,".git"))}else if(i&&!a&&(s.stop(),!await Me({message:`${M.redBright.bold("Warning:")} "${t}" is already in a git worktree. Would you still like to initialize a new git repository in this directory?`,default:!1}))){s.info("Skipping Git initialization.");return}try{let n=_t(),{major:o,minor:r}=Pt();o<2||o==2&&r<28?(await U("git",["init"],{cwd:e}),await U("git",["symbolic-ref","HEAD",`refs/heads/${n}`],{cwd:e})):await U("git",["init",`--initial-branch=${n}`],{cwd:e}),await U("git",["add","."],{cwd:e}),s.succeed(`${M.green("Successfully initialized and staged")} ${M.green.bold("git")}
|
|
69
|
+
`)}catch{s.fail(`${M.bold.red("Failed:")} could not initialize git. Update git to the latest version!
|
|
70
|
+
`)}}import At from"chalk";import{execa as Fe}from"execa";import Le from"ora";var ae=async(e,s,a)=>{let{onDataHandle:i,args:t=["install"],stdout:n="pipe"}=a,o=Le(`Running ${s} install...`).start(),r=Fe(s,t,{cwd:e,stdout:n});return await new Promise((p,f)=>{i&&r.stdout?.on("data",i(o)),r.on("error",u=>f(u)),r.on("close",()=>p())}),o},jt=async(e,s)=>{switch(e){case"npm":return await Fe(e,["install"],{cwd:s,stderr:"inherit"}),null;case"pnpm":return ae(s,e,{onDataHandle:a=>i=>{let t=i.toString();t.includes("Progress")&&(a.text=t.includes("|")?t.split(" | ")[1]??"":t)}});case"yarn":return ae(s,e,{onDataHandle:a=>i=>{a.text=i.toString()}});case"bun":return ae(s,e,{stdout:"ignore"})}},Be=async({projectDir:e})=>{l.info("Installing dependencies...");let s=b();(await jt(s,e)??Le()).succeed(At.green(`Successfully installed dependencies!
|
|
71
|
+
`))};var Ne=async({projectName:e=O,packages:s,install:a,projectDir:i,databaseProvider:t})=>{let n=b();l.info("Next steps:"),e!=="."&&l.info(` cd ${e}`),a===!1&&(n==="yarn"?l.info(` ${n}`):l.info(` ${n} install`)),["postgresql","mysql"].includes(t)&&l.info(" Add your database connection string to .env"),s?.authjs.inUse&&l.info(" Fill in your .env with necessary values. See https://create.lx2.dev/docs/first-steps for more info."),s?.betterAuth.inUse&&l.info(" Fill in your .env with necessary values. See https://create.lx2.dev/docs/first-steps for more info."),s?.prisma.inUse&&l.info(` Run "${n} db:push" to create you database tables.`),["npm"].includes(n)?l.info(` ${n} run dev`):l.info(` ${n} dev`),!await ie(i)&&!se(i)&&l.info(" git init"),l.info(' git commit -m "initial commit"')};import G from"fs";import It from"path";function Ge(e,s,a){G.readdirSync(e).forEach(t=>{let n=It.join(e,t);if(G.statSync(n).isDirectory())Ge(n,s,a);else{let r=G.readFileSync(n,"utf8").replace(new RegExp(s,"g"),a);G.writeFileSync(n,r,"utf8")}})}function We(e,s){let a=s.replace(/\*/g,"").replace(/[^\/]$/,"$&/");Ge(e,"@/",a)}import Je from"path";function Ve(e){let a=N(e).split("/"),i=a[a.length-1];if(i==="."){let o=Je.resolve(process.cwd());i=Je.basename(o)}let t=a.findIndex(o=>o.startsWith("@"));a.findIndex(o=>o.startsWith("@"))!==-1&&(i=a.slice(t).join("/"));let n=a.filter(o=>!o.startsWith("@")).join("/");return[i,n]}import zt from"gradient-string";var Ct={primary:"#bf95f9",accent:"#6071a4",secondary:"#ff7ac5"};function He(){let e=zt(Object.values(Ct)),s=b();(s==="yarn"||s==="pnpm")&&console.log(""),console.log(e.multiline(oe))}import{execSync as Dt}from"child_process";import Tt from"https";function Ke(e){let s=D();s.includes("beta")?(l.warn(" You are using a beta version of create-lx2-app."),l.warn(" Please report any bugs you encounter.")):s!==e&&(l.warn(" You are using an outdated version of create-lx2-app."),l.warn(" Your version:",s+".","Latest version in the npm registry:",e),l.warn(" Please run the CLI with @latest to get the latest updates.")),console.log("")}function Ot(){return new Promise((e,s)=>{Tt.get("https://registry.npmjs.org/-/package/create-lx2-app/dist-tags",a=>{if(a.statusCode===200){let i="";a.on("data",t=>i+=t),a.on("end",()=>{e(JSON.parse(i).latest)})}else s()}).on("error",()=>{s()})})}var Ye=()=>Ot().catch(()=>{try{return Dt("npm view create-lx2-app version").toString().trim()}catch{return null}});async function Et(){let e=await Ye(),s=b();He(),e&&Ke(e);let{appName:a,packages:i,flags:{git:t,install:n,importAlias:o},databaseProvider:r}=await ze(),p=_e(i),[f,u]=Ve(a),d=await qe({projectName:u,scopedAppName:f,packages:p,install:n,databaseProvider:r}),g=Xe.readJsonSync(Qe.join(d,"package.json"));if(g.name=f,g.clx2aMetadata={initVersion:D()},s!=="bun"){let{stdout:h}=await Rt(s,["-v"],{cwd:d});g.packageManager=`${s}@${h.trim()}`}Xe.writeJSONSync(Qe.join(d,"package.json"),g,{spaces:2}),o!=="@/"&&We(d,o),n&&await Be({projectDir:d}),t&&await $e(d),await Ne({projectDir:d,projectName:u,packages:p,install:n,databaseProvider:r}),process.exit(0)}Et().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.12.1-beta.db923f0",
|
|
4
4
|
"description": "The Most Opinionated Way to Build Next.js Apps",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -94,7 +94,6 @@
|
|
|
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",
|
|
98
97
|
"sharp": "^0.34.5",
|
|
99
98
|
"tailwindcss": "^4.1.18",
|
|
100
99
|
"tsup": "^8.5.1",
|
|
@@ -1,34 +0,0 @@
|
|
|
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 }
|
|
@@ -1,37 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { fileURLToPath } from "url"
|
|
2
|
-
|
|
3
|
-
import { Greeting } from "@/components/greeting"
|
|
4
|
-
import { api, HydrateClient } from "@/lib/api/server"
|
|
5
|
-
|
|
6
|
-
export const dynamic = "force-dynamic"
|
|
7
|
-
|
|
8
|
-
export default async function HomePage() {
|
|
9
|
-
const fileURL = `vscode://file/${fileURLToPath(import.meta.url)}`
|
|
10
|
-
|
|
11
|
-
void api.post.greeting({ text: "from tRPC!" })
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<HydrateClient>
|
|
15
|
-
<main className="mx-auto flex h-screen max-w-5xl flex-col items-center justify-between overflow-hidden p-6 sm:p-[45px]">
|
|
16
|
-
<div className="flex grow flex-col items-center justify-center">
|
|
17
|
-
{/* Logo */}
|
|
18
|
-
<picture className="relative">
|
|
19
|
-
<div className="absolute inset-0 animate-pulse bg-linear-to-r from-[oklch(0.7468_0.1455_302.21)] via-[oklch(0.7345_0.0464_270.71)] to-[oklch(0.7563_0.1807_347.17)] opacity-20 blur-lg dark:via-[oklch(0.5567_0.0816_269.53)]" />
|
|
20
|
-
|
|
21
|
-
<source srcSet="https://github.com/SlickYeet/create-lx2-app/blob/f1209465d59e03e284702d9f492f1bc1cfa49c32/docs/v2/public/android-chrome-192x192.png?raw=true" />
|
|
22
|
-
<img
|
|
23
|
-
src="https://github.com/SlickYeet/create-lx2-app/blob/f1209465d59e03e284702d9f492f1bc1cfa49c32/docs/v2/public/android-chrome-192x192.png?raw=true"
|
|
24
|
-
alt="Logo"
|
|
25
|
-
width={65}
|
|
26
|
-
height={65}
|
|
27
|
-
className="block h-auto max-w-full"
|
|
28
|
-
/>
|
|
29
|
-
</picture>
|
|
30
|
-
|
|
31
|
-
{/* Title & Description */}
|
|
32
|
-
<h1 className="mt-6 text-5xl font-bold tracking-tight text-balance md:text-6xl lg:text-7xl">
|
|
33
|
-
Create{" "}
|
|
34
|
-
<span className="text-[oklch(0.7468_0.1455_302.21)]">Lx2</span> App
|
|
35
|
-
</h1>
|
|
36
|
-
<p className="text-center text-lg text-neutral-700 md:text-xl lg:mt-6 dark:text-neutral-300">
|
|
37
|
-
The Most Opinionated Way to Build Next.js Apps
|
|
38
|
-
</p>
|
|
39
|
-
|
|
40
|
-
{/* Links */}
|
|
41
|
-
<div className="mt-12 flex items-center gap-3">
|
|
42
|
-
<a
|
|
43
|
-
href="https://create.lx2.dev/docs"
|
|
44
|
-
target="_blank"
|
|
45
|
-
rel="noopener noreferrer"
|
|
46
|
-
className="flex items-center rounded-md border border-white/25 px-2 py-1 outline-none hover:opacity-80 focus:opacity-80 active:opacity-70"
|
|
47
|
-
>
|
|
48
|
-
Docs
|
|
49
|
-
<svg
|
|
50
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
51
|
-
viewBox="0 0 24 24"
|
|
52
|
-
strokeLinecap="round"
|
|
53
|
-
strokeLinejoin="round"
|
|
54
|
-
className="mb-1.5 size-4 fill-none stroke-current stroke-2"
|
|
55
|
-
>
|
|
56
|
-
<path d="M7 7h10v10" />
|
|
57
|
-
<path d="M7 17 17 7" />
|
|
58
|
-
</svg>
|
|
59
|
-
</a>
|
|
60
|
-
<a
|
|
61
|
-
href="https://link.lx2.dev/discord"
|
|
62
|
-
target="_blank"
|
|
63
|
-
rel="noopener noreferrer"
|
|
64
|
-
className="flex items-center rounded-md border border-white/25 px-2 py-1 outline-none hover:opacity-80 focus:opacity-80 active:opacity-70"
|
|
65
|
-
>
|
|
66
|
-
Discord
|
|
67
|
-
<svg
|
|
68
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
69
|
-
viewBox="0 0 24 24"
|
|
70
|
-
strokeLinecap="round"
|
|
71
|
-
strokeLinejoin="round"
|
|
72
|
-
className="mb-1.5 size-4 fill-none stroke-current stroke-2"
|
|
73
|
-
>
|
|
74
|
-
<path d="M7 7h10v10" />
|
|
75
|
-
<path d="M7 17 17 7" />
|
|
76
|
-
</svg>
|
|
77
|
-
</a>
|
|
78
|
-
<a
|
|
79
|
-
href="https://github.com/SlickYeet/create-lx2-app"
|
|
80
|
-
target="_blank"
|
|
81
|
-
rel="noopener noreferrer"
|
|
82
|
-
className="flex items-center rounded-md border border-white/25 px-2 py-1 outline-none hover:opacity-80 focus:opacity-80 active:opacity-70"
|
|
83
|
-
>
|
|
84
|
-
GitHub
|
|
85
|
-
<svg
|
|
86
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
87
|
-
viewBox="0 0 24 24"
|
|
88
|
-
strokeLinecap="round"
|
|
89
|
-
strokeLinejoin="round"
|
|
90
|
-
className="mb-1.5 size-4 fill-none stroke-current stroke-2"
|
|
91
|
-
>
|
|
92
|
-
<path d="M7 7h10v10" />
|
|
93
|
-
<path d="M7 17 17 7" />
|
|
94
|
-
</svg>
|
|
95
|
-
</a>
|
|
96
|
-
</div>
|
|
97
|
-
|
|
98
|
-
{/* tRPC Greeting */}
|
|
99
|
-
<Greeting />
|
|
100
|
-
</div>
|
|
101
|
-
|
|
102
|
-
{/* Footer */}
|
|
103
|
-
<div className="flex flex-col items-center gap-1 text-sm text-neutral-600 lg:flex-row lg:gap-2 dark:text-neutral-400">
|
|
104
|
-
<p className="m-0">Get started by editing </p>
|
|
105
|
-
<a
|
|
106
|
-
href={fileURL}
|
|
107
|
-
className="rounded-md bg-neutral-200 px-2 py-1 dark:bg-neutral-800"
|
|
108
|
-
>
|
|
109
|
-
<code>src/app/page.tsx</code>
|
|
110
|
-
</a>
|
|
111
|
-
</div>
|
|
112
|
-
</main>
|
|
113
|
-
</HydrateClient>
|
|
114
|
-
)
|
|
115
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import { api } from "@/lib/api/client"
|
|
4
|
-
|
|
5
|
-
export function Greeting() {
|
|
6
|
-
const [greeting] = api.post.greeting.useSuspenseQuery({
|
|
7
|
-
text: "from tRPC!",
|
|
8
|
-
})
|
|
9
|
-
|
|
10
|
-
return (
|
|
11
|
-
<div className="mt-12 flex flex-col items-center gap-3">
|
|
12
|
-
<div className="mb-4">
|
|
13
|
-
<h2 className="mb-4 text-center">
|
|
14
|
-
<span className="text-2xl text-neutral-700 dark:text-neutral-300">
|
|
15
|
-
{greeting}
|
|
16
|
-
</span>
|
|
17
|
-
</h2>
|
|
18
|
-
</div>
|
|
19
|
-
</div>
|
|
20
|
-
)
|
|
21
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { createEnv } from "@t3-oss/env-nextjs"
|
|
2
|
-
import { z } from "zod"
|
|
3
|
-
|
|
4
|
-
export const env = createEnv({
|
|
5
|
-
/**
|
|
6
|
-
* Specify your server-side environment variables schema here. This way you can ensure the app
|
|
7
|
-
* isn't built with invalid env vars.
|
|
8
|
-
*/
|
|
9
|
-
server: {
|
|
10
|
-
DATABASE_URL: z.url(),
|
|
11
|
-
AUTH_SECRET:
|
|
12
|
-
process.env.NODE_ENV === "production"
|
|
13
|
-
? z.string()
|
|
14
|
-
: z.string().optional(),
|
|
15
|
-
DISCORD_CLIENT_ID: z.string(),
|
|
16
|
-
DISCORD_CLIENT_SECRET: z.string(),
|
|
17
|
-
NODE_ENV: z
|
|
18
|
-
.enum(["development", "test", "production"])
|
|
19
|
-
.default("development"),
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Specify your client-side environment variables schema here. This way you can ensure the app
|
|
24
|
-
* isn't built with invalid env vars. To expose them to the client, prefix them with
|
|
25
|
-
* `NEXT_PUBLIC_`.
|
|
26
|
-
*/
|
|
27
|
-
client: {
|
|
28
|
-
// NEXT_PUBLIC_CLIENTVAR: z.string(),
|
|
29
|
-
NEXT_PUBLIC_URL: z.url(),
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* You can't destruct `process.env` as a regular object in the Next.js edge runtimes (e.g.
|
|
34
|
-
* middlewares) or client-side so we need to destruct manually.
|
|
35
|
-
*/
|
|
36
|
-
runtimeEnv: {
|
|
37
|
-
DATABASE_URL: process.env.DATABASE_URL,
|
|
38
|
-
AUTH_SECRET: process.env.AUTH_SECRET,
|
|
39
|
-
DISCORD_CLIENT_ID: process.env.DISCORD_CLIENT_ID,
|
|
40
|
-
DISCORD_CLIENT_SECRET: process.env.DISCORD_CLIENT_SECRET,
|
|
41
|
-
NODE_ENV: process.env.NODE_ENV,
|
|
42
|
-
// NEXT_PUBLIC_CLIENTVAR: process.env.NEXT_PUBLIC_CLIENTVAR,
|
|
43
|
-
NEXT_PUBLIC_URL: process.env.NEXT_PUBLIC_URL,
|
|
44
|
-
},
|
|
45
|
-
/**
|
|
46
|
-
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially
|
|
47
|
-
* useful for Docker builds.
|
|
48
|
-
*/
|
|
49
|
-
skipValidation: !!process.env.SKIP_ENV_VALIDATION,
|
|
50
|
-
/**
|
|
51
|
-
* Makes it so that empty strings are treated as undefined. `SOME_VAR: z.string()` and
|
|
52
|
-
* `SOME_VAR=''` will throw an error.
|
|
53
|
-
*/
|
|
54
|
-
emptyStringAsUndefined: true,
|
|
55
|
-
})
|