next-ts-cli 1.0.5 → 1.0.7

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/README.md CHANGED
@@ -74,11 +74,15 @@ npx next-ts-cli my-app --cli --supabase --drizzle --shadcnui --stripe
74
74
 
75
75
  🎨 **Shadcn/ui** - With neutral configuration to start building compound components
76
76
 
77
- **AI Integration** - Vercel AI Gateway for building an AI app
77
+ 💡 **AI Integration** - Vercel AI Gateway for building AI apps
78
78
 
79
79
 
80
80
  _*These integrations are all optional, so not required to scaffold the core project_
81
81
 
82
+ Beside these, there is also another automatic feature:
83
+
84
+ 📁 **MCP Configurations** - Dynamically MCP Servers for Cursor and VSCode loaded bases on selected integrations
85
+
82
86
 
83
87
  ## Core Stack
84
88
  The core project structure contains the following features:
package/dist/index.js CHANGED
@@ -1,20 +1,20 @@
1
1
  #!/usr/bin/env node
2
- import Be from"path";import{execa as _t}from"execa";import Oe from"fs-extra";import*as m from"@clack/prompts";import{Command as Je}from"commander";import K from"path";import{fileURLToPath as De}from"url";var Me=De(import.meta.url),Ge=K.dirname(Me),p=K.join(Ge,"../"),W=`
2
+ import Ne from"path";import{execa as Pt}from"execa";import Oe from"fs-extra";import*as m from"@clack/prompts";import{Command as Ke}from"commander";import F from"path";import{fileURLToPath as De}from"url";var Ge=De(import.meta.url),Le=F.dirname(Ge),p=F.join(Le,"../"),H=`
3
3
  __ __ __ __
4
4
  .-----.-----.--.--| |_ ______| |_.-----.______.----| |__|
5
5
  | | -__|_ _| _|______| _|__ --|______| __| | |
6
6
  |__|__|_____|__.__|____| |____|_____| |____|__|__|
7
- `,j="next-ts-cli",O="next-ts-cli";import Le from"path";import Ve from"fs-extra";var y=()=>{let e=Le.join(p,"package.json");return Ve.readJSONSync(e).version??"1.0.0"};var v=class extends Error{constructor(n){super(n)}};import z from"chalk";var r={error(...e){console.log(z.red(...e))},warn(...e){console.log(z.yellow(...e))},info(...e){console.log(z.cyan(...e))},success(...e){console.log(z.green(...e))}};var U=e=>(e.length>1&&e.endsWith("/")&&(e=e.slice(0,-1)),e);var $e=/^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/,H=e=>{if(!e)return;let n=U(e),o=n.split("/"),t=o.findIndex(s=>s.startsWith("@")),i=o[o.length-1];if(o.findIndex(s=>s.startsWith("@"))!==-1&&(i=o.slice(t).join("/")),!(n==="."||$e.test(i??"")))return"App name must consist of only lowercase alphanumeric characters, '-', and '_'"};var Y=e=>{if(e.startsWith(".")||e.startsWith("/"))return"Import alias can't start with '.' or '/'"};var A={appName:j,packages:[],flags:{default:!1,cli:!1,drizzle:!1,supabase:!1,betterauth:!1,alias:"@/",docker:!1,stripe:!1,shadcnui:!1,clerk:!1,neon:!1,vercelAi:!1}},X=async()=>{let e=A,n=new Je().name(O).description("A CLI for creating production-ready web applications with the Next.js").argument("[dir]","The name of the application, as well as the name of the directory to create").option("--cli","Run in CLI mode (non-interactive)",!1).option("-d, --default","Scaffold the project without any additional integrations",!1).option("-a, --alias [alias]","Explicitly tell the CLI to use a custom import alias",A.flags.alias).option("--drizzle [boolean]","Experimental: Boolean value if we should install Drizzle. Must be used in conjunction with `--cli`.",t=>!!t&&t!=="false").option("--docker [boolean]","Experimental: Boolean value if we should install Docker. Must be used in conjunction with `--cli`.",t=>!!t&&t!=="false").option("--stripe [boolean]","Experimental: Boolean value if we should install Stripe. Must be used in conjunction with `--cli`.",t=>!!t&&t!=="false").option("--shadcnui [boolean]","Experimental: Boolean value if we should install Shadcn UI. Must be used in conjunction with `--cli`.",t=>!!t&&t!=="false").option("--betterauth [boolean]","Experimental: Boolean value if we should install BetterAuth. Must be used in conjunction with `--cli`. Not valid with --clerk",t=>!!t&&t!=="false").option("--clerk [boolean]","Experimental: Boolean value if we should install Clerk.js . Must be used in conjunction with `--cli`. Not valid with --betterAuth",t=>!!t&&t!=="false").option("--supabase [boolean]","Experimental: Boolean value if we should install Supabase. Must be used in conjunction with `--cli`. Not valid with --betterAuth or --clerk",t=>!!t&&t!=="false").option("--neon [boolean]","Experimental: Boolean value if we should install Neon. Must be used in conjunction with `--cli`.",t=>!!t&&t!=="false").option("--vercelAi [boolean]","Experimental: Boolean value if we should install Vercel AI Gateway. Must be used in conjunction with `--cli`.",t=>!!t&&t!=="false").version(y(),"-v, --version","Display the version number").parse(process.argv);process.env.npm_config_user_agent?.startsWith("yarn/3")&&r.warn(` WARNING: It looks like you are using Yarn 3. This is currently not supported,
7
+ `,z="next-ts-cli",D="next-ts-cli";import Je from"path";import Ve from"fs-extra";var _=()=>{let e=Je.join(p,"package.json");return Ve.readJSONSync(e).version??"1.0.0"};var E=class extends Error{constructor(t){super(t)}};import R from"chalk";var a={error(...e){console.log(R.red(...e))},warn(...e){console.log(R.yellow(...e))},info(...e){console.log(R.cyan(...e))},success(...e){console.log(R.green(...e))}};var U=e=>(e.length>1&&e.endsWith("/")&&(e=e.slice(0,-1)),e);var $e=/^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/,Y=e=>{if(!e)return;let t=U(e),s=t.split("/"),n=s.findIndex(r=>r.startsWith("@")),o=s[s.length-1];if(s.findIndex(r=>r.startsWith("@"))!==-1&&(o=s.slice(n).join("/")),!(t==="."||$e.test(o??"")))return"App name must consist of only lowercase alphanumeric characters, '-', and '_'"};var X=e=>{if(e.startsWith(".")||e.startsWith("/"))return"Import alias can't start with '.' or '/'"};var C={appName:z,packages:[],flags:{default:!1,cli:!1,drizzle:!1,supabase:!1,betterauth:!1,alias:"@/",docker:!1,stripe:!1,shadcnui:!1,clerk:!1,neon:!1,vercelAi:!1}},q=async()=>{let e=C,t=new Ke().name(D).description("A CLI for creating production-ready web applications with the Next.js").argument("[dir]","The name of the application, as well as the name of the directory to create").option("--cli","Run in CLI mode (non-interactive)",!1).option("-d, --default","Scaffold the project without any additional integrations",!1).option("-a, --alias [alias]","Explicitly tell the CLI to use a custom import alias",C.flags.alias).option("--drizzle [boolean]","Experimental: Boolean value if we should install Drizzle. Must be used in conjunction with `--cli`.",n=>!!n&&n!=="false").option("--docker [boolean]","Experimental: Boolean value if we should install Docker. Must be used in conjunction with `--cli`.",n=>!!n&&n!=="false").option("--stripe [boolean]","Experimental: Boolean value if we should install Stripe. Must be used in conjunction with `--cli`.",n=>!!n&&n!=="false").option("--shadcnui [boolean]","Experimental: Boolean value if we should install Shadcn UI. Must be used in conjunction with `--cli`.",n=>!!n&&n!=="false").option("--betterauth [boolean]","Experimental: Boolean value if we should install BetterAuth. Must be used in conjunction with `--cli`. Not valid with --clerk",n=>!!n&&n!=="false").option("--clerk [boolean]","Experimental: Boolean value if we should install Clerk.js . Must be used in conjunction with `--cli`. Not valid with --betterAuth",n=>!!n&&n!=="false").option("--supabase [boolean]","Experimental: Boolean value if we should install Supabase. Must be used in conjunction with `--cli`. Not valid with --betterAuth or --clerk",n=>!!n&&n!=="false").option("--neon [boolean]","Experimental: Boolean value if we should install Neon. Must be used in conjunction with `--cli`.",n=>!!n&&n!=="false").option("--vercelAi [boolean]","Experimental: Boolean value if we should install Vercel AI Gateway. Must be used in conjunction with `--cli`.",n=>!!n&&n!=="false").version(_(),"-v, --version","Display the version number").parse(process.argv);process.env.npm_config_user_agent?.startsWith("yarn/3")&&a.warn(` WARNING: It looks like you are using Yarn 3. This is currently not supported,
8
8
  and likely to result in a crash. Please run next-ts-cli with another
9
- package manager such as pnpm, npm, or Yarn Classic.`);let o=n.args[0];if(o&&(e.appName=o),e.flags=n.opts(),e.flags.cli)return e.packages=[],e.flags.docker&&e.packages.push("docker"),e.flags.drizzle&&e.packages.push("drizzle"),e.flags.supabase&&e.packages.push("supabase"),e.flags.betterauth&&e.packages.push("betterAuth"),e.flags.clerk&&e.packages.push("clerk"),e.flags.vercelAi&&e.packages.push("vercelAi"),e.flags.supabase&&e.flags.betterauth&&(r.warn("Incompatible combination Supabase and BetterAuth. Exiting."),process.exit(0)),e.flags.clerk&&e.flags.betterauth&&(r.warn("Incompatible combination Clerk and BetterAuth. Exiting."),process.exit(0)),e.flags.supabase&&e.flags.clerk&&(r.warn("Incompatible combination Supabase and Clerk. Exiting."),process.exit(0)),e.flags.stripe&&e.packages.push("stripe"),e.flags.shadcnui&&e.packages.push("shadcnui"),e;if(e.flags.default)return e;try{if(process.env.TERM_PROGRAM?.toLowerCase().includes("mintty"))throw r.warn(` WARNING: It looks like you are using MinTTY, which is non-interactive. This is most likely because you are
10
- using Git Bash. If that's that case, please use Git Bash from another terminal, such as Windows Terminal.`),new v("Non-interactive environment");let t=await m.group({...!o&&{name:()=>m.text({message:"Project name",defaultValue:o,placeholder:A.appName,validate:H})},authentication:()=>m.select({message:"What authentication provider would you like to use?",options:[{value:"none",label:"None"},{value:"better-auth",label:"BetterAuth"},{value:"clerk",label:"Clerk"},{value:"supabase",label:"Supabase"}],initialValue:"none"}),database:({results:a})=>{if(a.authentication!=="supabase")return m.select({message:"What database would you like to use?",options:[{value:"none",label:"None"},{value:"neon",label:"Neon"}],initialValue:"none"})},orm:()=>m.select({message:"What ORM Database would you like to use?",options:[{value:"none",label:"None"},{value:"drizzle",label:"Drizzle"}],initialValue:"none"}),importAlias:()=>m.text({message:"Custom import aliases",defaultValue:A.flags.alias,placeholder:A.flags.alias,validate:Y}),additionalConfig:()=>m.multiselect({message:"Select additional tools to install (press enter to skip)",options:[{value:"docker",label:"Docker"},{value:"stripe",label:"Stripe"},{value:"shadcnui",label:"Shadcn UI"},{value:"vercelAi",label:"Vercel AI Gateway"}],required:!1})},{onCancel(){process.exit(1)}}),i=[],s=t.additionalConfig;return t.orm==="drizzle"&&i.push("drizzle"),t.authentication==="better-auth"&&i.push("betterAuth"),t.authentication==="clerk"&&i.push("clerk"),(s.includes("supabase")||t.authentication==="supabase")&&i.push("supabase"),t.database==="neon"&&i.push("neon"),s.includes("docker")&&i.push("docker"),s.includes("stripe")&&i.push("stripe"),s.includes("shadcnui")&&i.push("shadcnui"),s.includes("vercelAi")&&i.push("vercelAi"),{appName:t.name??e.appName,packages:i,flags:{...e.flags,alias:t.importAlias??e.flags.alias}}}catch(t){if(t instanceof v)r.warn(`
11
- ${O} needs an interactive terminal to provide options`),await m.confirm({message:"Continue scaffolding a default next-ts-cli?",initialValue:!0})||(r.info("Exiting..."),process.exit(0)),r.info(`Bootstrapping a default next-ts-cli in ./${e.appName}`);else throw t}return e};import Ze from"path";import Z from"chalk";import Fe from"ora";var q=e=>{let{packages:n}=e;r.info("Adding boilerplate...");for(let[o,t]of Object.entries(n))if(t.inUse){let i=Fe(`Boilerplating ${o}...`).start();t.installer(e),i.succeed(Z.green(`Successfully setup boilerplate for ${Z.green.bold(o)}`))}r.info("")};import Ke from"path";import*as k from"@clack/prompts";import b from"chalk";import R from"fs-extra";import We from"ora";var Q=async({projectName:e,projectDir:n,pkgManager:o})=>{let t=Ke.join(p,"template/base");r.info(`
12
- Using: ${b.cyan.bold(o)}
13
- `);let i=We(`Scaffolding in: ${n}...
14
- `).start();if(R.existsSync(n))if(R.readdirSync(n).length===0)e!=="."&&i.info(`${b.cyan.bold(e)} exists but is empty, continuing...
15
- `);else{i.stopAndPersist();let a=await k.select({message:`${b.redBright.bold("Warning:")} ${b.cyan.bold(e)} already exists and isn't empty. How would you like to proceed?`,options:[{label:"Abort installation (recommended)",value:"abort"},{label:"Clear the directory and continue installation",value:"clear"},{label:"Continue installation and overwrite conflicting files",value:"overwrite"}],initialValue:"abort"});(k.isCancel(a)||a==="abort")&&(i.fail("Aborting installation..."),process.exit(1));let c=await k.confirm({message:`Are you sure you want to ${a==="clear"?"clear the directory":"overwrite conflicting files"}?`,initialValue:!1});(k.isCancel(c)||!c)&&(i.fail("Aborting installation..."),process.exit(1)),a==="clear"&&(i.info(`Emptying ${b.cyan.bold(e)} and creating next-ts-cli app..
16
- `),R.emptyDirSync(n))}i.start(),R.copySync(t,n);let s=e==="."?"App":b.cyan.bold(e);i.succeed(`${s} ${b.green("scaffolded successfully!")}
17
- `)};import He from"path";import Ye from"fs-extra";var ee=({projectDir:e,projectName:n,packages:o})=>{let t=Xe(n,o);Ye.writeFileSync(He.join(e,"README.md"),t)},Xe=(e,n)=>{let o=[];o.push(`# ${e}
9
+ package manager such as pnpm, npm, or Yarn Classic.`);let s=t.args[0];if(s&&(e.appName=s),e.flags=t.opts(),e.flags.cli)return e.packages=[],e.flags.docker&&e.packages.push("docker"),e.flags.drizzle&&e.packages.push("drizzle"),e.flags.supabase&&e.packages.push("supabase"),e.flags.betterauth&&e.packages.push("betterAuth"),e.flags.clerk&&e.packages.push("clerk"),e.flags.vercelAi&&e.packages.push("vercelAi"),e.flags.supabase&&e.flags.betterauth&&(a.warn("Incompatible combination Supabase and BetterAuth. Exiting."),process.exit(0)),e.flags.clerk&&e.flags.betterauth&&(a.warn("Incompatible combination Clerk and BetterAuth. Exiting."),process.exit(0)),e.flags.supabase&&e.flags.clerk&&(a.warn("Incompatible combination Supabase and Clerk. Exiting."),process.exit(0)),e.flags.stripe&&e.packages.push("stripe"),e.flags.shadcnui&&e.packages.push("shadcnui"),e;if(e.flags.default)return e;try{if(process.env.TERM_PROGRAM?.toLowerCase().includes("mintty"))throw a.warn(` WARNING: It looks like you are using MinTTY, which is non-interactive. This is most likely because you are
10
+ using Git Bash. If that's that case, please use Git Bash from another terminal, such as Windows Terminal.`),new E("Non-interactive environment");let n=await m.group({...!s&&{name:()=>m.text({message:"Project name",defaultValue:s,placeholder:C.appName,validate:Y})},authentication:()=>m.select({message:"What authentication provider would you like to use?",options:[{value:"none",label:"None"},{value:"better-auth",label:"BetterAuth"},{value:"clerk",label:"Clerk"},{value:"supabase",label:"Supabase"}],initialValue:"none"}),database:({results:i})=>{if(i.authentication!=="supabase")return m.select({message:"What database would you like to use?",options:[{value:"none",label:"None"},{value:"neon",label:"Neon"}],initialValue:"none"})},orm:()=>m.select({message:"What ORM Database would you like to use?",options:[{value:"none",label:"None"},{value:"drizzle",label:"Drizzle"}],initialValue:"none"}),importAlias:()=>m.text({message:"Custom import aliases",defaultValue:C.flags.alias,placeholder:C.flags.alias,validate:X}),additionalConfig:()=>m.multiselect({message:"Select additional tools to install (press enter to skip)",options:[{value:"docker",label:"Docker"},{value:"stripe",label:"Stripe"},{value:"shadcnui",label:"Shadcn UI"},{value:"vercelAi",label:"Vercel AI Gateway"}],required:!1})},{onCancel(){process.exit(1)}}),o=[],r=n.additionalConfig;return n.orm==="drizzle"&&o.push("drizzle"),n.authentication==="better-auth"&&o.push("betterAuth"),n.authentication==="clerk"&&o.push("clerk"),(r.includes("supabase")||n.authentication==="supabase")&&o.push("supabase"),n.database==="neon"&&o.push("neon"),r.includes("docker")&&o.push("docker"),r.includes("stripe")&&o.push("stripe"),r.includes("shadcnui")&&o.push("shadcnui"),r.includes("vercelAi")&&o.push("vercelAi"),{appName:n.name??e.appName,packages:o,flags:{...e.flags,alias:n.importAlias??e.flags.alias}}}catch(n){if(n instanceof E)a.warn(`
11
+ ${D} needs an interactive terminal to provide options`),await m.confirm({message:"Continue scaffolding a default next-ts-cli?",initialValue:!0})||(a.info("Exiting..."),process.exit(0)),a.info(`Bootstrapping a default next-ts-cli in ./${e.appName}`);else throw n}return e};import Qe from"path";import Q from"chalk";import We from"ora";var Z=e=>{let{packages:t}=e;a.info("Adding boilerplate...");for(let[s,n]of Object.entries(t))if(n.inUse){let o=We(`Boilerplating ${s}...`).start();n.installer(e),o.succeed(Q.green(`Successfully setup boilerplate for ${Q.green.bold(s)}`))}a.info("")};import Fe from"path";import*as k from"@clack/prompts";import y from"chalk";import M from"fs-extra";import He from"ora";var ee=async({projectName:e,projectDir:t,pkgManager:s})=>{let n=Fe.join(p,"template/base");a.info(`
12
+ Using: ${y.cyan.bold(s)}
13
+ `);let o=He(`Scaffolding in: ${t}...
14
+ `).start();if(M.existsSync(t))if(M.readdirSync(t).length===0)e!=="."&&o.info(`${y.cyan.bold(e)} exists but is empty, continuing...
15
+ `);else{o.stopAndPersist();let i=await k.select({message:`${y.redBright.bold("Warning:")} ${y.cyan.bold(e)} already exists and isn't empty. How would you like to proceed?`,options:[{label:"Abort installation (recommended)",value:"abort"},{label:"Clear the directory and continue installation",value:"clear"},{label:"Continue installation and overwrite conflicting files",value:"overwrite"}],initialValue:"abort"});(k.isCancel(i)||i==="abort")&&(o.fail("Aborting installation..."),process.exit(1));let c=await k.confirm({message:`Are you sure you want to ${i==="clear"?"clear the directory":"overwrite conflicting files"}?`,initialValue:!1});(k.isCancel(c)||!c)&&(o.fail("Aborting installation..."),process.exit(1)),i==="clear"&&(o.info(`Emptying ${y.cyan.bold(e)} and creating next-ts-cli app..
16
+ `),M.emptyDirSync(t))}o.start(),M.copySync(n,t);let r=e==="."?"App":y.cyan.bold(e);o.succeed(`${r} ${y.green("scaffolded successfully!")}
17
+ `)};import Ye from"path";import Xe from"fs-extra";var te=({projectDir:e,projectName:t,packages:s})=>{let n=qe(t,s);Xe.writeFileSync(Ye.join(e,"README.md"),n)},qe=(e,t)=>{let s=[];s.push(`# ${e}
18
18
 
19
19
  This project was bootstrapped with [next-ts-cli](https://github.com/RossiFire/next-ts-cli).
20
20
 
@@ -26,11 +26,11 @@ This project was bootstrapped with [next-ts-cli](https://github.com/RossiFire/ne
26
26
  - **Commitlint** \u2014 Commit message linting
27
27
  - **Lint-staged** \u2014 Run linters on staged files
28
28
  - **Biome** \u2014 Linter and formatter
29
- - **Jest** \u2014 Testing framework`);let t=[];n.clerk.inUse&&t.push("- **Clerk** \u2014 Fast authentication"),n.betterAuth.inUse&&t.push("- **BetterAuth** \u2014 Flexible authentication"),n.supabase.inUse&&t.push("- **Supabase** \u2014 Auth & database with real-time capabilities"),n.drizzle.inUse&&t.push("- **Drizzle ORM** \u2014 Type-safe database queries"),n.shadcnui.inUse&&t.push("- **Shadcn UI** \u2014 UI library"),n.stripe.inUse&&t.push("- **Stripe** \u2014 Payment checkout and webhooks boilerplate to easily create SaaS features"),n.docker.inUse&&t.push("- **Docker** \u2014 Containerization"),n.vercelAi.inUse&&t.push("- **Vercel AI Gateway** \u2014 AI capabilities witsh chat API route boilerplate"),t.length>0&&o.push(`
29
+ - **Jest** \u2014 Testing framework`);let n=[];t.clerk.inUse&&n.push("- **Clerk** \u2014 Fast authentication"),t.betterAuth.inUse&&n.push("- **BetterAuth** \u2014 Flexible authentication"),t.supabase.inUse&&n.push("- **Supabase** \u2014 Auth & database with real-time capabilities"),t.drizzle.inUse&&n.push("- **Drizzle ORM** \u2014 Type-safe database queries"),t.shadcnui.inUse&&n.push("- **Shadcn UI** \u2014 UI library"),t.stripe.inUse&&n.push("- **Stripe** \u2014 Payment checkout and webhooks boilerplate to easily create SaaS features"),t.docker.inUse&&n.push("- **Docker** \u2014 Containerization"),t.vercelAi.inUse&&n.push("- **Vercel AI Gateway** \u2014 AI capabilities witsh chat API route boilerplate"),n.length>0&&s.push(`
30
30
  ### Selected Integrations
31
31
 
32
- ${t.join(`
33
- `)}`),o.push(`
32
+ ${n.join(`
33
+ `)}`),s.push(`
34
34
  ## Getting Started
35
35
 
36
36
  \`\`\`bash
@@ -48,47 +48,44 @@ Open [http://localhost:3000](http://localhost:3000) in your browser.
48
48
  | \`npm run build\` | Build for production |
49
49
  | \`npm run start\` | Start production server |
50
50
  | \`npm run lint\` | Lint code |
51
- | \`npm run test\` | Run tests |`),n.docker.inUse&&o.push("| `npm run docker:build` | Build Docker image |\n| `npm run docker:up` | Start containers |\n| `npm run docker:down` | Stop containers |"),n.drizzle.inUse&&o.push("| `npm run db:generate` | Generate migrations |\n| `npm run db:migrate` | Run migrations |\n| `npm run db:studio` | Open Drizzle Studio |");let i=[];return n.drizzle.inUse&&i.push("DATABASE_URL="),n.betterAuth.inUse&&i.push("BETTER_AUTH_SECRET=","BETTER_AUTH_URL=http://localhost:3000"),n.supabase.inUse&&i.push("NEXT_PUBLIC_SUPABASE_URL=","NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY="),n.stripe.inUse&&i.push("STRIPE_SECRET_KEY=","STRIPE_WEBHOOK_SECRET=","NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY="),n.clerk.inUse&&i.push("NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=","CLERK_SECRET_KEY="),n.vercelAi.inUse&&i.push("AI_GATEWAY_API_KEY="),o.join(`
52
- `)};var u=()=>{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 te=async({projectName:e,scopedAppName:n,packages:o})=>{let t=u(),i=Ze.resolve(process.cwd(),e);return await Q({projectName:e,projectDir:i,pkgManager:t,scopedAppName:n}),q({projectName:e,scopedAppName:n,projectDir:i,pkgManager:t,packages:o}),ee({projectDir:i,projectName:e,packages:o}),i};import{execSync as M}from"child_process";import N from"path";import*as D from"@clack/prompts";import E from"chalk";import{execa as T}from"execa";import ne from"fs-extra";import qe from"ora";var Qe=e=>{try{return M("git --version",{cwd:e}),!0}catch{return!1}},G=e=>ne.existsSync(N.join(e,".git")),L=async e=>{try{return await T("git",["rev-parse","--is-inside-work-tree"],{cwd:e,stdout:"ignore"}),!0}catch{return!1}},et=()=>{let n=M("git --version").toString().trim().split(" ")[2],o=n?.split(".")[0],t=n?.split(".")[1];return{major:Number(o),minor:Number(t)}},tt=()=>M("git config --global init.defaultBranch || echo main").toString().trim(),oe=async e=>{if(r.info("Initializing Git..."),!Qe(e)){r.warn("Git is not installed. Skipping Git initialization.");return}let n=qe(`Creating a new git repo...
53
- `).start(),o=G(e),t=await L(e),i=N.parse(e).name;if(t&&o){if(n.stop(),!await D.confirm({message:`${E.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?`,initialValue:!1})){n.info("Skipping Git initialization.");return}ne.removeSync(N.join(e,".git"))}else if(t&&!o&&(n.stop(),!await D.confirm({message:`${E.redBright.bold("Warning:")} "${i}" is already in a git worktree. Would you still like to initialize a new git repository in this directory?`,initialValue:!1}))){n.info("Skipping Git initialization.");return}try{let s=tt(),{major:a,minor:c}=et();a<2||a===2&&c<28?(await T("git",["init"],{cwd:e}),await T("git",["symbolic-ref","HEAD",`refs/heads/${s}`],{cwd:e})):await T("git",["init",`--initial-branch=${s}`],{cwd:e}),await T("git",["add","."],{cwd:e}),n.succeed(`${E.green("Successfully initialized and staged")} ${E.green.bold("git")}
54
- `)}catch{n.fail(`${E.bold.red("Failed:")} could not initialize git. Update git to the latest version!
55
- `)}};var ie=async({projectName:e=j,packages:n,projectDir:o})=>{let t=u();r.info("Next steps:"),e!=="."&&r.info(` cd ${e}`),t==="yarn"?r.info(` ${t}`):r.info(` ${t} install`),n?.drizzle.inUse&&(["npm","bun"].includes(t)?r.info(` ${t} run db:push`):r.info(` ${t} db:push`)),["npm","bun"].includes(t)?r.info(` ${t} run dev`):r.info(` ${t} dev`),!await L(o)&&!G(o)&&r.info(" git init"),r.info(' git commit -m "initial commit"')};import C from"fs";import nt from"path";function se(e,n,o){let t=C.readdirSync(e);try{t.forEach(i=>{let s=nt.join(e,i);if(C.statSync(s).isDirectory())se(s,n,o);else{let c=C.readFileSync(s,"utf8").replace(new RegExp(n,"g"),o);C.writeFileSync(s,c,"utf8")}})}catch(i){r.error(`Error setting import alias: ${i}`)}}var re=(e,n)=>{try{let o=n.replace(/\*/g,"").replace(/[^/]$/,"$&/");se(e,"@/",o)}catch(o){r.error(`Error setting import alias: ${o}`)}};import ot from"crypto";import it from"path";import st from"fs-extra";var ae=({projectDir:e,packages:n,scopedAppName:o})=>{let t=n?.betterAuth.inUse,i=n?.supabase.inUse,s=n?.drizzle.inUse,a=n?.stripe.inUse,c=n?.clerk.inUse,l=n?.neon.inUse,f=n?.vercelAi.inUse,h=rt(!!t,!!i,!!s,!!a,!!c,!!l,!!f,o),Ne=it.join(e,".env");st.writeFileSync(Ne,h,"utf-8")},rt=(e,n,o,t,i,s,a,c)=>{let l=`
51
+ | \`npm run test\` | Run tests |`),t.docker.inUse&&s.push("| `npm run docker:build` | Build Docker image |\n| `npm run docker:up` | Start containers |\n| `npm run docker:down` | Stop containers |"),t.drizzle.inUse&&s.push("| `npm run db:generate` | Generate migrations |\n| `npm run db:migrate` | Run migrations |\n| `npm run db:studio` | Open Drizzle Studio |");let o=[];return t.drizzle.inUse&&o.push("DATABASE_URL="),t.betterAuth.inUse&&o.push("BETTER_AUTH_SECRET=","BETTER_AUTH_URL=http://localhost:3000"),t.supabase.inUse&&o.push("NEXT_PUBLIC_SUPABASE_URL=","NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY="),t.stripe.inUse&&o.push("STRIPE_SECRET_KEY=","STRIPE_WEBHOOK_SECRET=","NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY="),t.clerk.inUse&&o.push("NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=","CLERK_SECRET_KEY="),t.vercelAi.inUse&&o.push("AI_GATEWAY_API_KEY="),s.join(`
52
+ `)};var u=()=>{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 ne=async({projectName:e,scopedAppName:t,packages:s})=>{let n=u(),o=Qe.resolve(process.cwd(),e);return await ee({projectName:e,projectDir:o,pkgManager:n,scopedAppName:t}),Z({projectName:e,scopedAppName:t,projectDir:o,pkgManager:n,packages:s}),te({projectDir:o,projectName:e,packages:s}),o};import{execSync as J}from"child_process";import G from"path";import*as L from"@clack/prompts";import j from"chalk";import{execa as T}from"execa";import se from"fs-extra";import Ze from"ora";var et=e=>{try{return J("git --version",{cwd:e}),!0}catch{return!1}},tt=e=>se.existsSync(G.join(e,".git")),nt=async e=>{try{return await T("git",["rev-parse","--is-inside-work-tree"],{cwd:e,stdout:"ignore"}),!0}catch{return!1}},st=()=>{let t=J("git --version").toString().trim().split(" ")[2],s=t?.split(".")[0],n=t?.split(".")[1];return{major:Number(s),minor:Number(n)}},ot=()=>J("git config --global init.defaultBranch || echo main").toString().trim(),oe=async e=>{if(a.info("Initializing Git..."),!et(e)){a.warn("Git is not installed. Skipping Git initialization.");return}let t=Ze(`Creating a new git repo...
53
+ `).start(),s=tt(e),n=await nt(e),o=G.parse(e).name;if(n&&s){if(t.stop(),!await L.confirm({message:`${j.redBright.bold("Warning:")} Git is already initialized in "${o}". Initializing a new git repository would delete the previous history. Would you like to continue anyways?`,initialValue:!1})){t.info("Skipping Git initialization.");return}se.removeSync(G.join(e,".git"))}else if(n&&!s&&(t.stop(),!await L.confirm({message:`${j.redBright.bold("Warning:")} "${o}" is already in a git worktree. Would you still like to initialize a new git repository in this directory?`,initialValue:!1}))){t.info("Skipping Git initialization.");return}try{let r=ot(),{major:i,minor:c}=st();i<2||i===2&&c<28?(await T("git",["init"],{cwd:e}),await T("git",["symbolic-ref","HEAD",`refs/heads/${r}`],{cwd:e})):await T("git",["init",`--initial-branch=${r}`],{cwd:e}),await T("git",["add","."],{cwd:e}),t.succeed(`${j.green("Successfully initialized and staged")} ${j.green.bold("git")}
54
+ `)}catch{t.fail(`${j.bold.red("Failed:")} could not initialize git. Update git to the latest version!
55
+ `)}};var re=async({projectName:e=z})=>{let t=u();a.info("Next steps:"),e!=="."&&a.info(` cd ${e}`),["npm","bun"].includes(t)?a.info(` ${t} run dev`):a.info(` ${t} dev`)};import N from"fs";import rt from"path";function ie(e,t,s){let n=N.readdirSync(e);try{n.forEach(o=>{let r=rt.join(e,o);if(N.statSync(r).isDirectory())ie(r,t,s);else{let c=N.readFileSync(r,"utf8").replace(new RegExp(t,"g"),s);N.writeFileSync(r,c,"utf8")}})}catch(o){a.error(`Error setting import alias: ${o}`)}}var ae=(e,t)=>{try{let s=t.replace(/\*/g,"").replace(/[^/]$/,"$&/");ie(e,"@/",s)}catch(s){a.error(`Error setting import alias: ${s}`)}};import it from"crypto";import at from"path";import lt from"fs-extra";var le=({projectDir:e,packages:t,scopedAppName:s})=>{let n=t?.betterAuth.inUse,o=t?.supabase.inUse,r=t?.drizzle.inUse,i=t?.stripe.inUse,c=t?.clerk.inUse,l=t?.neon.inUse,f=t?.vercelAi.inUse,b=ct(!!n,!!o,!!r,!!i,!!c,!!l,!!f,s),Be=at.join(e,".env");lt.writeFileSync(Be,b,"utf-8")},ct=(e,t,s,n,o,r,i,c)=>{let l=`
56
56
  # Base variables
57
57
  NEXT_PUBLIC_BASE_URL="http://localhost:3000"
58
58
  GOOGLE_ANALYTICS_TAG="G-xxxxxxx" # Google Analytics G-Tag ID
59
- `;if(e){let f=Buffer.from(ot.getRandomValues(new Uint8Array(32))).toString("base64");l+=`
59
+ `;if(e){let f=Buffer.from(it.getRandomValues(new Uint8Array(32))).toString("base64");l+=`
60
60
  # Better Auth
61
- # Secret used by Better Auth
62
61
  BETTER_AUTH_SECRET="${f}" # Generated by next-ts-cli.
63
62
 
64
63
  # Better Auth GitHub OAuth
65
64
  BETTER_AUTH_GITHUB_CLIENT_ID=""
66
65
  BETTER_AUTH_GITHUB_CLIENT_SECRET=""
67
- `}return n&&(l+=`
66
+
67
+ `}return t&&(l+=`
68
68
  # Supabase
69
69
  # https://supabase.com/docs/guides/functions/secrets
70
-
71
70
  NEXT_PUBLIC_SUPABASE_URL="https://<app-id>.supabase.co",
72
71
  NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=""
73
- `),o&&(l+="# Drizzle"),s&&(l+=" + Neon"),l+=`
74
- `,(o||s)&&(l+=`DATABASE_URL="postgresql://postgres:password@localhost:5432/${c}"
75
- `),t&&(l+=`
72
+ `),s&&(l+="# Drizzle"),r&&(l+=" + Neon"),l+=`
73
+ `,(s||r)&&(l+=`DATABASE_URL="postgresql://postgres:password@localhost:5432/${c}"
74
+ `),n&&(l+=`
76
75
  # https://dashboard.stripe.com/apikeys
77
76
 
78
- NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_51RZ9UnQC7cOBbbnZtnhM1edX2tFsJbI5yXyTXAYPZ9XsgItjaIwOqSBi2r4tVHqKGUsjMci9ZGm7QNcEEqnJ35rs00ZXh0Nf6t
79
- STRIPE_SECRET_KEY=sk_test_51RZ9UnQC7cOBbbnZLJ5jbTUVZnOESNFCJHs6QOHDyRNwkLvJIdVnNN0n6UDsPlxn2ExWvImO02lrlXZM18EvQhfZ003BpVYc9x
80
- STRIPE_WEBHOOK_SECRET="whsec_60679b8e1b2ccc566077ad18684e6531bc02fdddbe608327f2c2420aae719648"
81
- `),i&&(l+=`
77
+ NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=""
78
+ STRIPE_SECRET_KEY=""
79
+ STRIPE_WEBHOOK_SECRET=""
80
+ `),o&&(l+=`
82
81
  # Clerk
83
82
  # https://clerk.com/docs/nextjs/getting-started/quickstart
84
-
85
83
  NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY="pk_test_..."
86
84
  CLERK_SECRET_KEY="sk_test_..."
87
85
 
88
- `),a&&(l+=`
86
+ `),i&&(l+=`
89
87
  # Vercel AI Gateway
90
88
  # https://ai-sdk.dev/docs/getting-started/nextjs-app-router
91
-
92
89
  AI_GATEWAY_API_KEY="sk_..."
93
- `),l};import _ from"path";import de from"fs-extra";import ce from"path";import pe from"fs-extra";import at from"sort-package-json";var le={"better-auth":"^1.4.10","drizzle-kit":"^0.31.5","drizzle-orm":"^0.41.0",postgres:"^3.4.7",tailwindcss:"^4.0.15",postcss:"^8.5.3","@tailwindcss/postcss":"^4.0.15","@biomejs/biome":"^2.3.10","@supabase/ssr":"^0.8.0","@supabase/supabase-js":"^2.89.0","@stripe/react-stripe-js":"^5.4.1","@stripe/stripe-js":"^8.6.0",stripe:"^20.1.0","@clerk/nextjs":"^6.36.5","@neondatabase/serverless":"^1.0.2",ai:"^6.0.6","@ai-sdk/react":"^3.0.6"};var d=e=>{let{dependencies:n,devMode:o,projectDir:t}=e,i=pe.readJSONSync(ce.join(t,"package.json"));n.forEach(a=>{let c=le[a];o&&i.devDependencies?i.devDependencies[a]=c:i.dependencies&&(i.dependencies[a]=c)});let s=at(i);pe.writeJSONSync(ce.join(t,"package.json"),s,{spaces:2})};var me=({projectDir:e,packages:n})=>{let o=n?.drizzle.inUse;d({projectDir:e,dependencies:["better-auth"],devMode:!1});let i=_.join(p,"template/extras"),s=_.join(i,"better-auth"),a="api/auth/[...all]/route.ts",c=_.join(s,a),l=_.join(e,"app",a);de.copySync(c,l);let f=_.join(s,o?"with-drizzle-auth.ts":"base-auth.ts"),h=_.join(e,"lib","auth.ts");de.copySync(f,h)};import w from"path";import ue from"fs-extra";import lt from"path";import fe from"fs-extra";import ct from"sort-package-json";var x=e=>{let{scripts:n,projectDir:o}=e,t=lt.join(o,"package.json"),i=fe.readJSONSync(t);i.scripts={...i.scripts,...n};let s=ct(i);fe.writeJSONSync(t,s,{spaces:2})};var ge=({projectDir:e})=>{d({projectDir:e,dependencies:["drizzle-kit"],devMode:!0}),d({projectDir:e,dependencies:["drizzle-orm","postgres"],devMode:!1});let n=w.join(p,"template/extras"),o=w.join(n,"drizzle"),t=w.join(o,"drizzle.config.ts"),i=w.join(e,"drizzle.config.ts");ue.copySync(t,i);let s=w.join(o,"db"),a=w.join(e,"lib/db");ue.copySync(s,a),x({projectDir:e,scripts:{"db:push":"drizzle-kit push","db:studio":"drizzle-kit studio","db:generate":"drizzle-kit generate","db:migrate":"drizzle-kit migrate"}})};import g from"path";import V from"fs-extra";var he=({projectDir:e})=>{let n=g.join(p,"template/extras"),o=g.join(n,"docker");V.copySync(g.join(o,"Dockerfile"),g.join(e,"Dockerfile")),V.copySync(g.join(o,"docker-compose.prod.yml"),g.join(e,"docker-compose.prod.yml")),V.copySync(g.join(o,".dockerignore"),g.join(e,".dockerignore")),x({projectDir:e,scripts:{"docker:build":"docker compose -f docker-compose.prod.yml build","docker:up":"docker compose -f docker-compose.prod.yml up -d","docker:down":"docker compose -f docker-compose.prod.yml down","docker:logs":"docker compose -f docker-compose.prod.yml logs -f","docker:exec":"docker compose -f docker-compose.prod.yml exec app sh","docker:exec:bash":"docker compose -f docker-compose.prod.yml exec app bash","docker:exec:sh":"docker compose -f docker-compose.prod.yml exec app sh","docker:exec:npm":"docker compose -f docker-compose.prod.yml exec app npm"}})};import $ from"path";import pt from"fs-extra";var be=({projectDir:e})=>{d({projectDir:e,dependencies:["@supabase/ssr","@supabase/supabase-js"],devMode:!1});let n=$.join(p,"template/extras"),o=$.join(n,"supabase"),t=$.join(e,"lib","supabase");pt.copySync(o,t)};import S from"path";import ke from"fs-extra";var ye=({projectDir:e})=>{d({projectDir:e,dependencies:["stripe","@stripe/stripe-js","@stripe/react-stripe-js"],devMode:!1});let n=S.join(p,"template/extras"),o=S.join(n,"stripe"),t=S.join(o,"checkout_session"),i=S.join(e,"app/api/checkout_session");ke.copySync(t,i);let s=S.join(o,"webhook/stripe/route.ts"),a=S.join(e,"app/api/webhook/stripe/route.ts");ke.copySync(s,a),x({projectDir:e,scripts:{"webhook:local":"stripe listen --forward-to localhost:3000/api/webhook/stripe"}})};import I from"path";import J from"fs-extra";var _e=({projectDir:e})=>{let n=I.join(p,"template/extras"),o=I.join(n,"shadcnui"),t=I.join(o,"components.json"),i=I.join(e,"components.json");J.copySync(t,i);let s=I.join(o,"globals.css"),a=I.join(e,"app/globals.css");J.writeFileSync(a,J.readFileSync(s,"utf8"))};import P from"path";import xe from"fs-extra";var we=({projectDir:e})=>{d({projectDir:e,dependencies:["@clerk/nextjs"],devMode:!1});let n=P.join(p,"template/extras"),o=P.join(n,"clerk"),t=P.join(o,"proxy.ts"),i=P.join(e,"proxy.ts");xe.copySync(t,i);let s=P.join(o,"layout.tsx"),a=P.join(e,"app/layout.tsx");xe.copySync(s,a)};import Se from"path";import dt from"fs-extra";var Ie=({projectDir:e,packages:n})=>{if(d({projectDir:e,dependencies:["@neondatabase/serverless"],devMode:!1}),n?.drizzle.inUse){let o=Se.join(p,"template/extras/neon/index.ts"),t=Se.join(e,"lib/db/index.ts");dt.copySync(o,t)}};import B from"path";import mt from"fs-extra";var Pe=({projectDir:e})=>{d({projectDir:e,dependencies:["ai","@ai-sdk/react"],devMode:!1});let n=B.join(p,"template/extras"),o=B.join(n,"vercel-ai"),t=B.join(o,"route.ts"),i=B.join(e,"app/api/chat/route.ts");mt.copySync(t,i)};var ve=e=>({docker:{inUse:e.includes("docker"),installer:he},betterAuth:{inUse:e.includes("betterAuth"),installer:me},drizzle:{inUse:e.includes("drizzle"),installer:ge},envVariables:{inUse:!0,installer:ae},supabase:{inUse:e.includes("supabase"),installer:be},stripe:{inUse:e.includes("stripe"),installer:ye},shadcnui:{inUse:e.includes("shadcnui"),installer:_e},clerk:{inUse:e.includes("clerk"),installer:we},neon:{inUse:e.includes("neon"),installer:Ie},vercelAi:{inUse:e.includes("vercelAi"),installer:Pe}});import Ae from"path";var Ee=e=>{let o=U(e).split("/"),t=o[o.length-1];if(t==="."){let a=Ae.resolve(process.cwd());t=Ae.basename(a)}let i=o.findIndex(a=>a.startsWith("@"));o.findIndex(a=>a.startsWith("@"))!==-1&&(t=o.slice(i).join("/"));let s=o.filter(a=>!a.startsWith("@")).join("/");return[t,s]};import ft from"gradient-string";var ut=["#003f5b","#5f5195","#cc4c91","#ff6f4e","#ff7030","#f10062","#b1008f","#2c19a8"],Te=()=>{let e=ft(ut),n=u();(n==="yarn"||n==="pnpm")&&console.log(""),console.log(e.multiline(W))};import gt from"chalk";import{execa as je}from"execa";import ze from"ora";var F=async(e,n,o)=>{let{onDataHandle:t,args:i=["install"],stdout:s="pipe"}=o,a=ze(`Running ${n} install...`).start(),c=je(n,i,{cwd:e,stdout:s});return await new Promise((l,f)=>{t&&c.stdout?.on("data",t(a)),c.on("error",h=>f(h)),c.on("close",()=>l())}),a},ht=async(e,n)=>{switch(e){case"npm":return await je(e,["install"],{cwd:n,stderr:"inherit"}),null;case"pnpm":return F(n,e,{onDataHandle:o=>t=>{let i=t.toString();i.includes("Progress")&&(o.text=i.includes("|")?i.split(" | ")[1]??"":i)}});case"yarn":return F(n,e,{onDataHandle:o=>t=>{o.text=t.toString()}});case"bun":return F(n,e,{stdout:"ignore"})}},Ue=async({projectDir:e})=>{r.info("Installing dependencies...");let n=u();(await ht(n,e)??ze()).succeed(gt.green(`Successfully installed dependencies!
94
- `))};import{execSync as bt}from"child_process";import kt from"https";var Re=e=>{let n=y();n.includes("beta")?(r.warn(" You are using a beta version of next-ts-cli."),r.warn(" Please report any bugs you encounter.")):n.includes("next")?(r.warn(" You are running next-ts-cli with the @next tag which is no longer maintained."),r.warn(" Please run the CLI with @latest instead.")):n!==e&&(r.warn(" You are using an outdated version of next-ts-cli."),r.warn(" Your version:",n+".","Latest version in the npm registry:",e),r.warn(" Please run the CLI with @latest to get the latest updates.")),console.log("")};function yt(){return new Promise((e,n)=>{kt.get("https://registry.npmjs.org/-/package/next-ts-cli/dist-tags",o=>{if(o.statusCode===200){let t="";o.on("data",i=>{t+=i}),o.on("end",()=>{e(JSON.parse(t).latest)})}else n()}).on("error",()=>{n()})})}var Ce=()=>yt().catch(()=>{try{return bt("npm view next-ts-cli version").toString().trim()}catch{return null}});var xt=async()=>{let e=await Ce(),n=u();Te(),e&&Re(e);let{appName:o,packages:t,flags:{alias:i}}=await X(),s=ve(t),[a,c]=Ee(o),l=await te({projectName:c,scopedAppName:a,packages:s,alias:i}),f=Oe.readJSONSync(Be.join(l,"package.json"));if(f.name=a,f.nextTsMetadata={initVersion:y()},n!=="bun"){let{stdout:h}=await _t(n,["-v"],{cwd:l});f.packageManager=`${n}@${h.trim()}`}Oe.writeJSONSync(Be.join(l,"package.json"),f,{spaces:2}),i!=="@/"&&re(l,i),await Ue({projectDir:l}),await oe(l),await ie({projectName:c,packages:s,projectDir:l}),process.exit(0)};xt().catch(e=>{r.error("Aborting installation..."),e instanceof Error?r.error(e):(r.error("An unknown error has occurred. Please open an issue on github with the below:"),console.log(e)),process.exit(1)});
90
+ `),l};import S from"path";import me from"fs-extra";import pe from"path";import de from"fs-extra";import pt from"sort-package-json";var ce={"better-auth":"^1.4.10","drizzle-kit":"^0.31.5","drizzle-orm":"^0.41.0",postgres:"^3.4.7",tailwindcss:"^4.0.15",postcss:"^8.5.3","@tailwindcss/postcss":"^4.0.15","@biomejs/biome":"^2.3.10","@supabase/ssr":"^0.8.0","@supabase/supabase-js":"^2.89.0","@stripe/react-stripe-js":"^5.4.1","@stripe/stripe-js":"^8.6.0",stripe:"^20.1.0","@clerk/nextjs":"^6.36.5","@neondatabase/serverless":"^1.0.2",ai:"^6.0.6","@ai-sdk/react":"^3.0.6"};var d=e=>{let{dependencies:t,devMode:s,projectDir:n}=e,o=de.readJSONSync(pe.join(n,"package.json"));t.forEach(i=>{let c=ce[i];s&&o.devDependencies?o.devDependencies[i]=c:o.dependencies&&(o.dependencies[i]=c)});let r=pt(o);de.writeJSONSync(pe.join(n,"package.json"),r,{spaces:2})};var fe=({projectDir:e,packages:t})=>{let s=t?.drizzle.inUse;d({projectDir:e,dependencies:["better-auth"],devMode:!1});let o=S.join(p,"template/extras"),r=S.join(o,"better-auth"),i="api/auth/[...all]/route.ts",c=S.join(r,i),l=S.join(e,"app",i);me.copySync(c,l);let f=S.join(r,s?"with-drizzle-auth.ts":"base-auth.ts"),b=S.join(e,"lib","auth.ts");me.copySync(f,b)};import v from"path";import ge from"fs-extra";import dt from"path";import ue from"fs-extra";import mt from"sort-package-json";var x=e=>{let{scripts:t,projectDir:s}=e,n=dt.join(s,"package.json"),o=ue.readJSONSync(n);o.scripts={...o.scripts,...t};let r=mt(o);ue.writeJSONSync(n,r,{spaces:2})};var he=({projectDir:e})=>{d({projectDir:e,dependencies:["drizzle-kit"],devMode:!0}),d({projectDir:e,dependencies:["drizzle-orm","postgres"],devMode:!1});let t=v.join(p,"template/extras"),s=v.join(t,"drizzle"),n=v.join(s,"drizzle.config.ts"),o=v.join(e,"drizzle.config.ts");ge.copySync(n,o);let r=v.join(s,"db"),i=v.join(e,"lib/db");ge.copySync(r,i),x({projectDir:e,scripts:{"db:push":"drizzle-kit push","db:studio":"drizzle-kit studio","db:generate":"drizzle-kit generate","db:migrate":"drizzle-kit migrate"}})};import g from"path";import V from"fs-extra";var be=({projectDir:e})=>{let t=g.join(p,"template/extras"),s=g.join(t,"docker");V.copySync(g.join(s,"Dockerfile"),g.join(e,"Dockerfile")),V.copySync(g.join(s,"docker-compose.prod.yml"),g.join(e,"docker-compose.prod.yml")),V.copySync(g.join(s,".dockerignore"),g.join(e,".dockerignore")),x({projectDir:e,scripts:{"docker:build":"docker compose -f docker-compose.prod.yml build","docker:up":"docker compose -f docker-compose.prod.yml up -d","docker:down":"docker compose -f docker-compose.prod.yml down","docker:logs":"docker compose -f docker-compose.prod.yml logs -f","docker:exec":"docker compose -f docker-compose.prod.yml exec app sh","docker:exec:bash":"docker compose -f docker-compose.prod.yml exec app bash","docker:exec:sh":"docker compose -f docker-compose.prod.yml exec app sh","docker:exec:npm":"docker compose -f docker-compose.prod.yml exec app npm"}})};import $ from"path";import gt from"fs-extra";import O from"path";import h from"fs-extra";var w=e=>{let{serverName:t,serverConfig:s,projectDir:n}=e;ft({serverName:t,serverConfig:s,projectDir:n}),ut({serverName:t,serverConfig:s,projectDir:n})},ft=e=>{let{serverName:t,serverConfig:s,projectDir:n}=e,o=O.join(n,".cusror/mpc.json");h.ensureDirSync(O.dirname(o));let r={args:s.args,command:s.command,env:s.env,url:s.url},i={};h.existsSync(o)&&(i=h.readJSONSync(o)),i.mcpServers||(i.mcpServers={}),i.mcpServers[t]={...r},h.writeJSONSync(o,i,{spaces:" "})},ut=e=>{let{serverName:t,serverConfig:s,projectDir:n}=e,o=O.join(n,".vscode/mcp.json");h.ensureDirSync(O.dirname(o));let r={};h.existsSync(o)&&(r=h.readJSONSync(o)),r.servers||(r.servers={}),r.servers[t]={...s},h.writeJSONSync(o,r,{spaces:" "})};var ye=({projectDir:e})=>{d({projectDir:e,dependencies:["@supabase/ssr","@supabase/supabase-js"],devMode:!1});let t=$.join(p,"template/extras"),s=$.join(t,"supabase"),n=$.join(e,"lib","supabase");gt.copySync(s,n),w({serverName:"supabase",serverConfig:{type:"http",url:"https://mcp.supabase.com/mcp?project_ref=<YOUR_SUPABASE_PROJECT_ID>"},projectDir:e})};import P from"path";import ke from"fs-extra";var _e=({projectDir:e})=>{d({projectDir:e,dependencies:["stripe","@stripe/stripe-js","@stripe/react-stripe-js"],devMode:!1});let t=P.join(p,"template/extras"),s=P.join(t,"stripe"),n=P.join(s,"checkout_session"),o=P.join(e,"app/api/checkout_session");ke.copySync(n,o);let r=P.join(s,"webhook/stripe/route.ts"),i=P.join(e,"app/api/webhook/stripe/route.ts");ke.copySync(r,i),x({projectDir:e,scripts:{"webhook:local":"stripe listen --forward-to localhost:3000/api/webhook/stripe"}}),w({serverName:"stripe",serverConfig:{type:"http",url:"https://mcp.stripe.com"},projectDir:e})};import I from"path";import K from"fs-extra";var Se=({projectDir:e})=>{let t=I.join(p,"template/extras"),s=I.join(t,"shadcnui"),n=I.join(s,"components.json"),o=I.join(e,"components.json");K.copySync(n,o);let r=I.join(s,"globals.css"),i=I.join(e,"app/globals.css");K.writeFileSync(i,K.readFileSync(r,"utf8")),w({serverName:"shadcn",serverConfig:{command:"npx",args:["shadcn@latest","mcp"]},projectDir:e})};import A from"path";import xe from"fs-extra";var ve=({projectDir:e})=>{d({projectDir:e,dependencies:["@clerk/nextjs"],devMode:!1});let t=A.join(p,"template/extras"),s=A.join(t,"clerk"),n=A.join(s,"proxy.ts"),o=A.join(e,"proxy.ts");xe.copySync(n,o);let r=A.join(s,"layout.tsx"),i=A.join(e,"app/layout.tsx");xe.copySync(r,i)};import we from"path";import ht from"fs-extra";var Pe=({projectDir:e,packages:t})=>{if(d({projectDir:e,dependencies:["@neondatabase/serverless"],devMode:!1}),t?.drizzle.inUse){let s=we.join(p,"template/extras/neon/index.ts"),n=we.join(e,"lib/db/index.ts");ht.copySync(s,n)}};import B from"path";import bt from"fs-extra";var Ie=({projectDir:e})=>{d({projectDir:e,dependencies:["ai","@ai-sdk/react"],devMode:!1});let t=B.join(p,"template/extras"),s=B.join(t,"vercel-ai"),n=B.join(s,"route.ts"),o=B.join(e,"app/api/chat/route.ts");bt.copySync(n,o)};var Ae=e=>({docker:{inUse:e.includes("docker"),installer:be},betterAuth:{inUse:e.includes("betterAuth"),installer:fe},drizzle:{inUse:e.includes("drizzle"),installer:he},envVariables:{inUse:!0,installer:le},supabase:{inUse:e.includes("supabase"),installer:ye},stripe:{inUse:e.includes("stripe"),installer:_e},shadcnui:{inUse:e.includes("shadcnui"),installer:Se},clerk:{inUse:e.includes("clerk"),installer:ve},neon:{inUse:e.includes("neon"),installer:Pe},vercelAi:{inUse:e.includes("vercelAi"),installer:Ie}});import Ee from"path";var Ce=e=>{let s=U(e).split("/"),n=s[s.length-1];if(n==="."){let i=Ee.resolve(process.cwd());n=Ee.basename(i)}let o=s.findIndex(i=>i.startsWith("@"));s.findIndex(i=>i.startsWith("@"))!==-1&&(n=s.slice(o).join("/"));let r=s.filter(i=>!i.startsWith("@")).join("/");return[n,r]};import yt from"gradient-string";var kt=["#003f5b","#5f5195","#cc4c91","#ff6f4e","#ff7030","#f10062","#b1008f","#2c19a8"],je=()=>{let e=yt(kt),t=u();(t==="yarn"||t==="pnpm")&&console.log(""),console.log(e.multiline(H))};import _t from"chalk";import{execa as Te}from"execa";import ze from"ora";var W=async(e,t,s)=>{let{onDataHandle:n,args:o=["install"],stdout:r="pipe"}=s,i=ze(`Running ${t} install...`).start(),c=Te(t,o,{cwd:e,stdout:r});return await new Promise((l,f)=>{n&&c.stdout?.on("data",n(i)),c.on("error",b=>f(b)),c.on("close",()=>l())}),i},St=async(e,t)=>{switch(e){case"npm":return await Te(e,["install"],{cwd:t,stderr:"inherit"}),null;case"pnpm":return W(t,e,{onDataHandle:s=>n=>{let o=n.toString();o.includes("Progress")&&(s.text=o.includes("|")?o.split(" | ")[1]??"":o)}});case"yarn":return W(t,e,{onDataHandle:s=>n=>{s.text=n.toString()}});case"bun":return W(t,e,{stdout:"ignore"})}},Re=async({projectDir:e})=>{a.info("Installing dependencies...");let t=u();(await St(t,e)??ze()).succeed(_t.green(`Successfully installed dependencies!
91
+ `))};import{execSync as xt}from"child_process";import vt from"https";var Ue=e=>{let t=_();t.includes("beta")?(a.warn(" You are using a beta version of next-ts-cli."),a.warn(" Please report any bugs you encounter.")):t.includes("next")?(a.warn(" You are running next-ts-cli with the @next tag which is no longer maintained."),a.warn(" Please run the CLI with @latest instead.")):t!==e&&(a.warn(" You are using an outdated version of next-ts-cli."),a.warn(" Your version:",t+".","Latest version in the npm registry:",e),a.warn(" Please run the CLI with @latest to get the latest updates.")),console.log("")};function wt(){return new Promise((e,t)=>{vt.get("https://registry.npmjs.org/-/package/next-ts-cli/dist-tags",s=>{if(s.statusCode===200){let n="";s.on("data",o=>{n+=o}),s.on("end",()=>{e(JSON.parse(n).latest)})}else t()}).on("error",()=>{t()})})}var Me=()=>wt().catch(()=>{try{return xt("npm view next-ts-cli version").toString().trim()}catch{return null}});var It=async()=>{let e=await Me(),t=u();je(),e&&Ue(e);let{appName:s,packages:n,flags:{alias:o}}=await q(),r=Ae(n),[i,c]=Ce(s),l=await ne({projectName:c,scopedAppName:i,packages:r,alias:o}),f=Oe.readJSONSync(Ne.join(l,"package.json"));if(f.name=i,f.nextTsMetadata={initVersion:_()},t!=="bun"){let{stdout:b}=await Pt(t,["-v"],{cwd:l});f.packageManager=`${t}@${b.trim()}`}Oe.writeJSONSync(Ne.join(l,"package.json"),f,{spaces:2}),o!=="@/"&&ae(l,o),await Re({projectDir:l}),await oe(l),await re({projectName:c,packages:r,projectDir:l}),process.exit(0)};It().catch(e=>{a.error("Aborting installation..."),e instanceof Error?a.error(e):(a.error("An unknown error has occurred. Please open an issue on github with the below:"),console.log(e)),process.exit(1)});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-ts-cli",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "Create production-ready web application with the Next.js",
5
5
  "author": "Daniele Rossino <daniele.rossino10@gmail.com>",
6
6
  "maintainers": [],
@@ -1,8 +1,5 @@
1
1
  {
2
- "mcpServers": {
3
- "shadcn": {
4
- "command": "npx",
5
- "args": ["shadcn@latest", "mcp"]
6
- }
7
- }
8
- }
2
+ "mcpServers": {
3
+
4
+ }
5
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "servers": {
3
+ }
4
+ }
@@ -4,6 +4,6 @@ import Home from "@/app/page";
4
4
  describe("Home Page", () => {
5
5
  it("renders home page", () => {
6
6
  render(<Home />);
7
- expect(screen.getByText("next-ts")).toBeDefined();
7
+ expect(screen.getByText("Start to edit")).toBeDefined();
8
8
  });
9
9
  });