create-lx2-app 0.10.0 → 0.10.2
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 +11 -11
- package/package.json +1 -1
- package/template/packages/src/app/page/base.tsx +19 -14
- package/template/packages/src/app/page/with-authjs-drizzle.tsx +30 -18
- package/template/packages/src/app/page/with-authjs-prisma.tsx +38 -18
- package/template/packages/src/app/page/with-authjs.tsx +36 -16
- package/template/packages/src/app/page/with-better-auth-drizzle.tsx +30 -18
- package/template/packages/src/app/page/with-better-auth-prisma.tsx +30 -18
- package/template/packages/src/app/page/with-better-auth.tsx +27 -16
- package/template/packages/src/app/page/with-drizzle.tsx +22 -16
- package/template/packages/src/app/page/with-payload.tsx +32 -22
- package/template/packages/src/app/page/with-prisma.tsx +22 -16
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
2
|
+
import Ye from"path";import{execa as Rt}from"execa";import Qe from"fs-extra";import{confirm as Q,input as Ie,select as z}from"@inquirer/prompts";import{Command as ht}from"commander";import ne from"path";import{fileURLToPath as at}from"url";var it=at(import.meta.url),nt=ne.dirname(it),p=ne.join(nt,"../"),oe=` ___ ___ ___ _ _____ ___ _ ___ _ ___ ___
|
|
3
3
|
/ __| _ \\ __| /_\\_ _| __| | | __ __|_ ) /_\\ | _ \\ _ \\
|
|
4
4
|
| (__| / _| / _ \\| | | _| | |__\\ \\ / / / / _ \\| _/ _/
|
|
5
5
|
\\___|_|_\\___/_/ \\_\\_| |___| |____/_\\_\\/___| /_/ \\_\\_| |_|
|
|
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
|
|
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 ot 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=ot(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 rt 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");rt.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 pt from"fs-extra";import lt from"path";import ge from"fs-extra";import{sortPackageJson as ct}from"sort-package-json";function q(e){let{scripts:t,projectDir:i}=e,a=lt.join(i,"package.json"),s=ge.readJSONSync(a);s.scripts={...s.scripts,...t};let n=ct(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");pt.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=dt(!!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 tt=G.join(p,"template/packages/src/env",h),st=G.join(e,"src/env.ts");Y.copyFileSync(tt,st)}let O=G.join(e,".env"),Xe=G.join(e,".env.example"),Ze=mt+f,W=Buffer.from(crypto.getRandomValues(new Uint8Array(32))).toString("base64"),et=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,et,"utf-8"),Y.writeFileSync(Xe,Ze,"utf-8")};function dt(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(`
|
|
@@ -43,7 +43,7 @@ DISCORD_CLIENT_SECRET=""
|
|
|
43
43
|
# Example:
|
|
44
44
|
# SERVERVAR="foo"
|
|
45
45
|
# NEXT_PUBLIC_CLIENTVAR="bar"
|
|
46
|
-
`),r}var
|
|
46
|
+
`),r}var mt=`
|
|
47
47
|
# Since the ".env" file is gitignored, you can use the ".env.example" file to
|
|
48
48
|
# build a new ".env" file when you clone the repo. Keep this file up-to-date
|
|
49
49
|
# when you add new variables to \`.env\`.
|
|
@@ -53,19 +53,19 @@ DISCORD_CLIENT_SECRET=""
|
|
|
53
53
|
# ".env" and populate it with your secrets.
|
|
54
54
|
`.trim().concat(`
|
|
55
55
|
|
|
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"],
|
|
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=["nextjs","payload"],Se=["none","authjs","betterAuth"],Pe=["none","prisma","drizzle"],F=["sqlite","mysql","postgresql"];var xe=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 ft from"path";import ut from"fs-extra";function C(){let e=ft.join(p,"package.json");return ut.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 gt=/^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/;function _e(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=="."||gt.test(s??"")?!0:"App name must consist of only lowercase alphanumeric characters, '-', and '_'"}var Ae=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 je(){let e=y,t=new ht().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: ${we.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: ${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,
|
|
57
57
|
and likely to result in a crash. Please run create-lx2-app with another
|
|
58
58
|
package manager such as pnpm, npm, or Yarn Classic.
|
|
59
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
|
|
60
60
|
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 E("Non-interactive environment");let a=v(),s={};i||(s.name=await
|
|
61
|
+
can provide the arguments from the CLI directly: https://create.lx2.dev/docs/getting-started#experimental-ci-flags to skip the prompts.`),new E("Non-interactive environment");let a=v(),s={};i||(s.name=await Ie({message:"What will your project be called?",default:D,validate:o=>_e(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 Ie({message:"What import alias would you like to use?",default:y.flags.importAlias,validate:Ae});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 wt from"path";import Ce from"chalk";import yt from"ora";function ze(e){let{packages:t}=e;l.info("Adding boilerplate...");for(let[i,a]of Object.entries(t))if(a.inUse){let s=yt(`Boilerplating ${i}...`).start();a.installer(e),s.succeed(Ce.green(`${Ce.green.bold(i)}`))}l.info("")}import X from"path";import{confirm as bt,select as vt}from"@inquirer/prompts";import j from"chalk";import M from"fs-extra";import kt from"ora";async function Oe({projectName:e,projectDir:t,pkgManager:i,noInstall:a}){let s=X.join(p,"template/base");a?l.info(""):l.info(`
|
|
62
62
|
Using: ${j.cyan.bold(i)}
|
|
63
|
-
`);let n=
|
|
63
|
+
`);let n=kt(`Scaffolding in: ${t}...
|
|
64
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
|
|
65
|
+
`);else{n.stopAndPersist();let r=await vt({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 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 ${j.cyan.bold(e)} and creating lx2 app...
|
|
66
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
|
|
68
|
-
`).start(),i=se(e),a=await ae(e),s=ee.parse(e).name;if(a&&i){if(t.stop(),!await
|
|
67
|
+
`)}import k from"path";import Z from"fs-extra";function De({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 Te({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 Re({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 Ee({projectName:e,scopedAppName:t,packages:i,noInstall:a,databaseProvider:s}){let n=v(),o=wt.resolve(process.cwd(),e);return await Oe({projectName:e,projectDir:o,pkgManager:n,scopedAppName:t,noInstall:a,databaseProvider:s}),ze({projectName:e,scopedAppName:t,projectDir:o,pkgManager:n,packages:i,noInstall:a,databaseProvider:s}),De({packages:i,projectDir:o}),Te({packages:i,projectDir:o}),Re({packages:i,projectDir:o}),o}import{execSync as te}from"child_process";import ee from"path";import{confirm as Me}from"@inquirer/prompts";import U from"chalk";import{execa as $}from"execa";import Ue from"fs-extra";import St from"ora";function Pt(e){try{return te("git --version",{cwd:e}),!0}catch{return!1}}function se(e){return Ue.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 xt(){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 _t(){return te("git config --global init.defaultBranch || echo main").toString().trim()}async function $e(e){if(l.info("Initializing Git..."),!Pt(e)){l.warn("Git is not installed. Skipping Git initialization.");return}let t=St(`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 Me({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}Ue.removeSync(ee.join(e,".git"))}else if(a&&!i&&(t.stop(),!await Me({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=_t(),{major:o,minor:r}=xt();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
69
|
`)}catch{t.fail(`${U.bold.red("Failed:")} could not initialize git. Update git to the latest version!
|
|
70
|
-
`)}}import
|
|
71
|
-
`))};var
|
|
70
|
+
`)}}import At from"chalk";import{execa as qe}from"execa";import Ge from"ora";var ie=async(e,t,i)=>{let{onDataHandle:a,args:s=["install"],stdout:n="pipe"}=i,o=Ge(`Running ${t} install...`).start(),r=qe(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},It=async(e,t)=>{switch(e){case"npm":return await qe(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"})}},Le=async({projectDir:e})=>{l.info("Installing dependencies...");let t=v();(await It(t,e)??Ge()).succeed(At.green(`Successfully installed dependencies!
|
|
71
|
+
`))};var Fe=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 jt from"path";function Ne(e,t,i){B.readdirSync(e).forEach(s=>{let n=jt.join(e,s);if(B.statSync(n).isDirectory())Ne(n,t,i);else{let r=B.readFileSync(n,"utf8").replace(new RegExp(t,"g"),i);B.writeFileSync(n,r,"utf8")}})}function Je(e,t){let i=t.replace(/\*/g,"").replace(/[^\/]$/,"$&/");Ne(e,"@/",i)}import Be from"path";function We(e){let i=J(e).split("/"),a=i[i.length-1];if(a==="."){let o=Be.resolve(process.cwd());a=Be.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 Ct from"gradient-string";var zt={primary:"#bf95f9",accent:"#6071a4",secondary:"#ff7ac5"};function Ve(){let e=Ct(Object.values(zt)),t=v();(t==="yarn"||t==="pnpm")&&console.log(""),console.log(e.multiline(oe))}import{execSync as Ot}from"child_process";import Dt from"https";function He(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 Tt(){return new Promise((e,t)=>{Dt.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 Ke=()=>Tt().catch(()=>{try{return Ot("npm view create-lx2-app version").toString().trim()}catch{return null}});async function Et(){let e=await Ke(),t=v();Ve(),e&&He(e);let{appName:i,packages:a,flags:{noGit:s,noInstall:n,importAlias:o},databaseProvider:r}=await je(),c=xe(a),[d,u]=We(i),m=await Ee({projectName:u,scopedAppName:d,packages:c,noInstall:n,databaseProvider:r}),f=Qe.readJsonSync(Ye.join(m,"package.json"));f.name=d,f.clx2aMetadata={initVersion:C()};let{stdout:h}=await Rt(t,["-v"],{cwd:m});f.packageManager=`${t}@${h.trim()}`,Qe.writeJSONSync(Ye.join(m,"package.json"),f,{spaces:2}),o!=="@/"&&Je(m,o),n||await Le({projectDir:m}),s||await $e(m),await Fe({projectDir:m,projectName:u,packages:c,noInstall: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
|
@@ -8,10 +8,11 @@ export default function HomePage() {
|
|
|
8
8
|
<div className="flex grow flex-col items-center justify-center">
|
|
9
9
|
{/* Logo */}
|
|
10
10
|
<picture className="relative">
|
|
11
|
-
<div className="absolute inset-0 animate-pulse
|
|
12
|
-
|
|
11
|
+
<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)]" />
|
|
12
|
+
|
|
13
|
+
<source srcSet="https://github.com/SlickYeet/create-lx2-app/blob/f1209465d59e03e284702d9f492f1bc1cfa49c32/docs/v2/public/android-chrome-192x192.png?raw=true" />
|
|
13
14
|
<img
|
|
14
|
-
src="https://github.com/SlickYeet/create-lx2-app/blob/
|
|
15
|
+
src="https://github.com/SlickYeet/create-lx2-app/blob/f1209465d59e03e284702d9f492f1bc1cfa49c32/docs/v2/public/android-chrome-192x192.png?raw=true"
|
|
15
16
|
alt="Logo"
|
|
16
17
|
width={65}
|
|
17
18
|
height={65}
|
|
@@ -19,21 +20,24 @@ export default function HomePage() {
|
|
|
19
20
|
/>
|
|
20
21
|
</picture>
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
{/* Title & Description */}
|
|
24
|
+
<h1 className="mt-6 text-5xl font-bold tracking-tight text-balance md:text-6xl lg:text-7xl">
|
|
25
|
+
Create <span className="text-[oklch(0.7468_0.1455_302.21)]">Lx2</span>{" "}
|
|
26
|
+
App
|
|
24
27
|
</h1>
|
|
25
|
-
<p className="
|
|
26
|
-
|
|
28
|
+
<p className="text-center text-lg text-neutral-700 md:text-xl lg:mt-6 dark:text-neutral-300">
|
|
29
|
+
The Most Opinionated Way to Build Next.js Apps
|
|
27
30
|
</p>
|
|
28
31
|
|
|
32
|
+
{/* Links */}
|
|
29
33
|
<div className="mt-12 flex items-center gap-3">
|
|
30
34
|
<a
|
|
31
|
-
href="https://create.lx2.dev"
|
|
35
|
+
href="https://create.lx2.dev/docs"
|
|
32
36
|
target="_blank"
|
|
33
37
|
rel="noopener noreferrer"
|
|
34
|
-
className="flex items-center rounded-md border border-white px-2 py-1 outline-none focus:opacity-80 active:opacity-70"
|
|
38
|
+
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"
|
|
35
39
|
>
|
|
36
|
-
|
|
40
|
+
Docs
|
|
37
41
|
<svg
|
|
38
42
|
xmlns="http://www.w3.org/2000/svg"
|
|
39
43
|
viewBox="0 0 24 24"
|
|
@@ -46,12 +50,12 @@ export default function HomePage() {
|
|
|
46
50
|
</svg>
|
|
47
51
|
</a>
|
|
48
52
|
<a
|
|
49
|
-
href="https://
|
|
53
|
+
href="https://link.lx2.dev/discord"
|
|
50
54
|
target="_blank"
|
|
51
55
|
rel="noopener noreferrer"
|
|
52
|
-
className="flex items-center rounded-md border border-white px-2 py-1 outline-none focus:opacity-80 active:opacity-70"
|
|
56
|
+
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"
|
|
53
57
|
>
|
|
54
|
-
|
|
58
|
+
Discord
|
|
55
59
|
<svg
|
|
56
60
|
xmlns="http://www.w3.org/2000/svg"
|
|
57
61
|
viewBox="0 0 24 24"
|
|
@@ -67,7 +71,7 @@ export default function HomePage() {
|
|
|
67
71
|
href="https://github.com/SlickYeet/create-lx2-app"
|
|
68
72
|
target="_blank"
|
|
69
73
|
rel="noopener noreferrer"
|
|
70
|
-
className="flex items-center rounded-md border border-white px-2 py-1 outline-none focus:opacity-80 active:opacity-70"
|
|
74
|
+
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"
|
|
71
75
|
>
|
|
72
76
|
GitHub
|
|
73
77
|
<svg
|
|
@@ -84,6 +88,7 @@ export default function HomePage() {
|
|
|
84
88
|
</div>
|
|
85
89
|
</div>
|
|
86
90
|
|
|
91
|
+
{/* Footer */}
|
|
87
92
|
<div className="flex flex-col items-center gap-1 text-sm text-neutral-600 lg:flex-row lg:gap-2 dark:text-neutral-400">
|
|
88
93
|
<p className="m-0">Get started by editing </p>
|
|
89
94
|
<a
|
|
@@ -16,6 +16,7 @@ export default async function HomePage() {
|
|
|
16
16
|
|
|
17
17
|
return (
|
|
18
18
|
<main className="mx-auto flex h-screen max-w-5xl flex-col items-center justify-between overflow-hidden p-6 sm:p-[45px]">
|
|
19
|
+
{/* Header */}
|
|
19
20
|
<header className="ml-auto">
|
|
20
21
|
{user ? (
|
|
21
22
|
<button
|
|
@@ -43,10 +44,11 @@ export default async function HomePage() {
|
|
|
43
44
|
<div className="flex grow flex-col items-center justify-center">
|
|
44
45
|
{/* Logo */}
|
|
45
46
|
<picture className="relative">
|
|
46
|
-
<div className="absolute inset-0 animate-pulse
|
|
47
|
-
|
|
47
|
+
<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)]" />
|
|
48
|
+
|
|
49
|
+
<source srcSet="https://github.com/SlickYeet/create-lx2-app/blob/f1209465d59e03e284702d9f492f1bc1cfa49c32/docs/v2/public/android-chrome-192x192.png?raw=true" />
|
|
48
50
|
<img
|
|
49
|
-
src="https://github.com/SlickYeet/create-lx2-app/blob/
|
|
51
|
+
src="https://github.com/SlickYeet/create-lx2-app/blob/f1209465d59e03e284702d9f492f1bc1cfa49c32/docs/v2/public/android-chrome-192x192.png?raw=true"
|
|
50
52
|
alt="Logo"
|
|
51
53
|
width={65}
|
|
52
54
|
height={65}
|
|
@@ -54,29 +56,37 @@ export default async function HomePage() {
|
|
|
54
56
|
/>
|
|
55
57
|
</picture>
|
|
56
58
|
|
|
59
|
+
{/* Title & Description */}
|
|
57
60
|
{user ? (
|
|
58
|
-
<h1 className="mt-6
|
|
59
|
-
Welcome,
|
|
61
|
+
<h1 className="mt-6 text-5xl font-bold tracking-tight text-balance md:text-6xl lg:text-7xl">
|
|
62
|
+
Welcome,{" "}
|
|
63
|
+
<span className="text-[oklch(0.7468_0.1455_302.21)] capitalize">
|
|
64
|
+
{user.name}
|
|
65
|
+
</span>
|
|
66
|
+
!
|
|
60
67
|
</h1>
|
|
61
68
|
) : (
|
|
62
69
|
<>
|
|
63
|
-
<h1 className="mt-6
|
|
64
|
-
|
|
70
|
+
<h1 className="mt-6 text-5xl font-bold tracking-tight text-balance md:text-6xl lg:text-7xl">
|
|
71
|
+
Create{" "}
|
|
72
|
+
<span className="text-[oklch(0.7468_0.1455_302.21)]">Lx2</span>{" "}
|
|
73
|
+
App
|
|
65
74
|
</h1>
|
|
66
|
-
<p className="
|
|
67
|
-
|
|
75
|
+
<p className="text-center text-lg text-neutral-700 md:text-xl lg:mt-6 dark:text-neutral-300">
|
|
76
|
+
The Most Opinionated Way to Build Next.js Apps
|
|
68
77
|
</p>
|
|
69
78
|
</>
|
|
70
79
|
)}
|
|
71
80
|
|
|
81
|
+
{/* Links */}
|
|
72
82
|
<div className="mt-12 flex items-center gap-3">
|
|
73
83
|
<a
|
|
74
|
-
href="https://create.lx2.dev"
|
|
84
|
+
href="https://create.lx2.dev/docs"
|
|
75
85
|
target="_blank"
|
|
76
86
|
rel="noopener noreferrer"
|
|
77
|
-
className="flex items-center rounded-md border border-white px-2 py-1 outline-none focus:opacity-80 active:opacity-70"
|
|
87
|
+
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"
|
|
78
88
|
>
|
|
79
|
-
|
|
89
|
+
Docs
|
|
80
90
|
<svg
|
|
81
91
|
xmlns="http://www.w3.org/2000/svg"
|
|
82
92
|
viewBox="0 0 24 24"
|
|
@@ -89,12 +99,12 @@ export default async function HomePage() {
|
|
|
89
99
|
</svg>
|
|
90
100
|
</a>
|
|
91
101
|
<a
|
|
92
|
-
href="https://
|
|
102
|
+
href="https://link.lx2.dev/discord"
|
|
93
103
|
target="_blank"
|
|
94
104
|
rel="noopener noreferrer"
|
|
95
|
-
className="flex items-center rounded-md border border-white px-2 py-1 outline-none focus:opacity-80 active:opacity-70"
|
|
105
|
+
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"
|
|
96
106
|
>
|
|
97
|
-
|
|
107
|
+
Discord
|
|
98
108
|
<svg
|
|
99
109
|
xmlns="http://www.w3.org/2000/svg"
|
|
100
110
|
viewBox="0 0 24 24"
|
|
@@ -110,7 +120,7 @@ export default async function HomePage() {
|
|
|
110
120
|
href="https://github.com/SlickYeet/create-lx2-app"
|
|
111
121
|
target="_blank"
|
|
112
122
|
rel="noopener noreferrer"
|
|
113
|
-
className="flex items-center rounded-md border border-white px-2 py-1 outline-none focus:opacity-80 active:opacity-70"
|
|
123
|
+
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"
|
|
114
124
|
>
|
|
115
125
|
GitHub
|
|
116
126
|
<svg
|
|
@@ -126,13 +136,14 @@ export default async function HomePage() {
|
|
|
126
136
|
</a>
|
|
127
137
|
</div>
|
|
128
138
|
|
|
139
|
+
{/* Posts */}
|
|
129
140
|
<div className="mt-12 flex flex-col items-center gap-3">
|
|
130
141
|
<div className="mb-4">
|
|
131
|
-
<
|
|
142
|
+
<h2 className="mb-4 text-center">
|
|
132
143
|
<span className="text-2xl text-neutral-700 dark:text-neutral-300">
|
|
133
144
|
Posts {posts.length}
|
|
134
145
|
</span>
|
|
135
|
-
</
|
|
146
|
+
</h2>
|
|
136
147
|
|
|
137
148
|
{user ? (
|
|
138
149
|
<form
|
|
@@ -208,6 +219,7 @@ export default async function HomePage() {
|
|
|
208
219
|
</div>
|
|
209
220
|
</div>
|
|
210
221
|
|
|
222
|
+
{/* Footer */}
|
|
211
223
|
<div className="flex flex-col items-center gap-1 text-sm text-neutral-600 lg:flex-row lg:gap-2 dark:text-neutral-400">
|
|
212
224
|
<p className="m-0">Get started by editing </p>
|
|
213
225
|
<a
|
|
@@ -14,6 +14,7 @@ export default async function HomePage() {
|
|
|
14
14
|
|
|
15
15
|
return (
|
|
16
16
|
<main className="mx-auto flex h-screen max-w-5xl flex-col items-center justify-between overflow-hidden p-6 sm:p-[45px]">
|
|
17
|
+
{/* Header */}
|
|
17
18
|
<header className="ml-auto">
|
|
18
19
|
{user ? (
|
|
19
20
|
<button
|
|
@@ -41,10 +42,11 @@ export default async function HomePage() {
|
|
|
41
42
|
<div className="flex grow flex-col items-center justify-center">
|
|
42
43
|
{/* Logo */}
|
|
43
44
|
<picture className="relative">
|
|
44
|
-
<div className="absolute inset-0 animate-pulse
|
|
45
|
-
|
|
45
|
+
<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)]" />
|
|
46
|
+
|
|
47
|
+
<source srcSet="https://github.com/SlickYeet/create-lx2-app/blob/f1209465d59e03e284702d9f492f1bc1cfa49c32/docs/v2/public/android-chrome-192x192.png?raw=true" />
|
|
46
48
|
<img
|
|
47
|
-
src="https://github.com/SlickYeet/create-lx2-app/blob/
|
|
49
|
+
src="https://github.com/SlickYeet/create-lx2-app/blob/f1209465d59e03e284702d9f492f1bc1cfa49c32/docs/v2/public/android-chrome-192x192.png?raw=true"
|
|
48
50
|
alt="Logo"
|
|
49
51
|
width={65}
|
|
50
52
|
height={65}
|
|
@@ -52,21 +54,37 @@ export default async function HomePage() {
|
|
|
52
54
|
/>
|
|
53
55
|
</picture>
|
|
54
56
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
{/* Title & Description */}
|
|
58
|
+
{user ? (
|
|
59
|
+
<h1 className="mt-6 text-5xl font-bold tracking-tight text-balance md:text-6xl lg:text-7xl">
|
|
60
|
+
Welcome,{" "}
|
|
61
|
+
<span className="text-[oklch(0.7468_0.1455_302.21)] capitalize">
|
|
62
|
+
{user.name}
|
|
63
|
+
</span>
|
|
64
|
+
!
|
|
65
|
+
</h1>
|
|
66
|
+
) : (
|
|
67
|
+
<>
|
|
68
|
+
<h1 className="mt-6 text-5xl font-bold tracking-tight text-balance md:text-6xl lg:text-7xl">
|
|
69
|
+
Create{" "}
|
|
70
|
+
<span className="text-[oklch(0.7468_0.1455_302.21)]">Lx2</span>{" "}
|
|
71
|
+
App
|
|
72
|
+
</h1>
|
|
73
|
+
<p className="text-center text-lg text-neutral-700 md:text-xl lg:mt-6 dark:text-neutral-300">
|
|
74
|
+
The Most Opinionated Way to Build Next.js Apps
|
|
75
|
+
</p>
|
|
76
|
+
</>
|
|
77
|
+
)}
|
|
61
78
|
|
|
79
|
+
{/* Links */}
|
|
62
80
|
<div className="mt-12 flex items-center gap-3">
|
|
63
81
|
<a
|
|
64
|
-
href="https://create.lx2.dev"
|
|
82
|
+
href="https://create.lx2.dev/docs"
|
|
65
83
|
target="_blank"
|
|
66
84
|
rel="noopener noreferrer"
|
|
67
|
-
className="flex items-center rounded-md border border-white px-2 py-1 outline-none focus:opacity-80 active:opacity-70"
|
|
85
|
+
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"
|
|
68
86
|
>
|
|
69
|
-
|
|
87
|
+
Docs
|
|
70
88
|
<svg
|
|
71
89
|
xmlns="http://www.w3.org/2000/svg"
|
|
72
90
|
viewBox="0 0 24 24"
|
|
@@ -79,12 +97,12 @@ export default async function HomePage() {
|
|
|
79
97
|
</svg>
|
|
80
98
|
</a>
|
|
81
99
|
<a
|
|
82
|
-
href="https://
|
|
100
|
+
href="https://link.lx2.dev/discord"
|
|
83
101
|
target="_blank"
|
|
84
102
|
rel="noopener noreferrer"
|
|
85
|
-
className="flex items-center rounded-md border border-white px-2 py-1 outline-none focus:opacity-80 active:opacity-70"
|
|
103
|
+
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"
|
|
86
104
|
>
|
|
87
|
-
|
|
105
|
+
Discord
|
|
88
106
|
<svg
|
|
89
107
|
xmlns="http://www.w3.org/2000/svg"
|
|
90
108
|
viewBox="0 0 24 24"
|
|
@@ -100,7 +118,7 @@ export default async function HomePage() {
|
|
|
100
118
|
href="https://github.com/SlickYeet/create-lx2-app"
|
|
101
119
|
target="_blank"
|
|
102
120
|
rel="noopener noreferrer"
|
|
103
|
-
className="flex items-center rounded-md border border-white px-2 py-1 outline-none focus:opacity-80 active:opacity-70"
|
|
121
|
+
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"
|
|
104
122
|
>
|
|
105
123
|
GitHub
|
|
106
124
|
<svg
|
|
@@ -116,13 +134,14 @@ export default async function HomePage() {
|
|
|
116
134
|
</a>
|
|
117
135
|
</div>
|
|
118
136
|
|
|
137
|
+
{/* Posts */}
|
|
119
138
|
<div className="mt-12 flex flex-col items-center gap-3">
|
|
120
139
|
<div className="mb-4">
|
|
121
|
-
<
|
|
140
|
+
<h2 className="mb-4 text-center">
|
|
122
141
|
<span className="text-2xl text-neutral-700 dark:text-neutral-300">
|
|
123
142
|
Posts {posts.length}
|
|
124
143
|
</span>
|
|
125
|
-
</
|
|
144
|
+
</h2>
|
|
126
145
|
|
|
127
146
|
{user && (
|
|
128
147
|
<form
|
|
@@ -207,6 +226,7 @@ export default async function HomePage() {
|
|
|
207
226
|
</div>
|
|
208
227
|
</div>
|
|
209
228
|
|
|
229
|
+
{/* Footer */}
|
|
210
230
|
<div className="flex flex-col items-center gap-1 text-sm text-neutral-600 lg:flex-row lg:gap-2 dark:text-neutral-400">
|
|
211
231
|
<p className="m-0">Get started by editing </p>
|
|
212
232
|
<a
|