create-tnt-stack 0.3.2 → 0.3.4
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 +15 -4
- package/dist/index.js +20 -20
- package/package.json +11 -8
- package/template/base/package.json +4 -8
- /package/template/{base → packages/config}/eslint.config.mjs +0 -0
package/README.md
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
<picture>
|
3
3
|
<source
|
4
4
|
media="(prefers-color-scheme: dark)"
|
5
|
-
srcset="https://github.com/SlickYeet/create-tnt-stack/blob/8fbac6741f1a0003bbd36e512e8a859b52db0793/
|
5
|
+
srcset="https://github.com/SlickYeet/create-tnt-stack/blob/8fbac6741f1a0003bbd36e512e8a859b52db0793/docs/public/logo.light.png"
|
6
6
|
/>
|
7
7
|
<img
|
8
|
-
src="https://github.com/SlickYeet/create-tnt-stack/blob/8fbac6741f1a0003bbd36e512e8a859b52db0793/
|
8
|
+
src="https://github.com/SlickYeet/create-tnt-stack/blob/8fbac6741f1a0003bbd36e512e8a859b52db0793/docs/public/logo.dark.png"
|
9
9
|
width="130"
|
10
10
|
alt="TNT-Powered logo"
|
11
11
|
/>
|
@@ -18,7 +18,10 @@
|
|
18
18
|
Simply run `npm create tnt-stack@latest` to get started!
|
19
19
|
|
20
20
|
[![PRs-Welcome][contribute-image]][contribute-url]
|
21
|
-
[![NPM version][npm-image]][npm-url]
|
21
|
+
[![NPM version][npm-image]][npm-url]
|
22
|
+
[![Downloads][downloads-image]][npm-url]<br />
|
23
|
+
[![Release][release-image]][release-url]
|
24
|
+
[![Prepelease][prerelease-image]][prerelease-url]
|
22
25
|
[![License][license-image]][license-url]
|
23
26
|
|
24
27
|
</div>
|
@@ -84,7 +87,7 @@ For more information, visit the
|
|
84
87
|
<h2 id="documentation">📖 Documentation</h2>
|
85
88
|
|
86
89
|
Full documentation is available at
|
87
|
-
[create.tntstack.org](https://create.tntstack.org/docs)
|
90
|
+
[create.tntstack.org](https://create.tntstack.org/docs).
|
88
91
|
|
89
92
|
<h2 id="credits">❤️ Credits</h2>
|
90
93
|
|
@@ -134,3 +137,11 @@ so you understand the branching strategy and local development environment.
|
|
134
137
|
[license-url]: https://github.com/SlickYeet/create-tnt-stack/blob/main/LICENSE
|
135
138
|
[downloads-image]:
|
136
139
|
https://img.shields.io/npm/dm/create-tnt-stack?color=364fc7&logoColor=364fc7
|
140
|
+
[release-image]:
|
141
|
+
https://github.com/SlickYeet/create-tnt-stack/actions/workflows/release.yml/badge.svg
|
142
|
+
[release-url]:
|
143
|
+
https://github.com/SlickYeet/create-tnt-stack/actions/workflows/release.yml
|
144
|
+
[prerelease-image]:
|
145
|
+
https://github.com/SlickYeet/create-tnt-stack/actions/workflows/prerelease.yml/badge.svg
|
146
|
+
[prerelease-url]:
|
147
|
+
https://github.com/SlickYeet/create-tnt-stack/actions/workflows/prerelease.yml
|
package/dist/index.js
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
#!/usr/bin/env node
|
2
|
-
import
|
2
|
+
import Se from"path";import{execa as rt}from"execa";import Ce from"fs-extra";import{confirm as N,input as re,select as J}from"@inquirer/prompts";import{Command as qe}from"commander";import B from"path";import{fileURLToPath as je}from"url";var Me=je(import.meta.url),De=B.dirname(Me),c=B.join(De,"../"),H=` ___ ___ ___ _ _____ ___ _____ _ _ _____ ___ _____ _ ___ _ __
|
3
3
|
/ __| _ \\ __| /_\\_ _| __| |_ _| \\| |_ _| / __|_ _/_\\ / __| |/ /
|
4
4
|
| (__| / _| / _ \\| | | _| | | | .\` | | | \\__ \\ | |/ _ \\ (__| ' <
|
5
5
|
\\___|_|_\\___/_/ \\_\\_| |___| |_| |_|\\_| |_| |___/ |_/_/ \\_\\___|_|\\_\\
|
6
|
-
`,P="my-tnt-stack",D="create-tnt-stack";import
|
6
|
+
`,P="my-tnt-stack",D="create-tnt-stack";import C from"path";import R from"fs-extra";import Y from"path";import Q from"fs-extra";import Re from"sort-package-json";var K={"next-auth":"^4.24.11","@auth/prisma-adapter":"^2.8.0",prisma:"^6.5.0","@prisma/client":"^6.5.0","@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.3","@eslint/eslintrc":"^3"};var u=e=>{let{dependencies:t,devMode:a,projectDir:n}=e,i=Q.readJsonSync(Y.join(n,"package.json"));t.forEach(s=>{let l=K[s];a&&i.devDependencies?i.devDependencies[s]=l:i.dependencies&&(i.dependencies[s]=l)});let o=Re(i);Q.writeJsonSync(Y.join(n,"package.json"),o,{spaces:2})};var X=({projectDir:e,scopedAppName:t,packages:a,databaseProvider:n})=>{let i=a?.envVariables.inUse,o=a?.nextAuth.inUse,s=a?.prisma.inUse,l=[];i&&(l.push("@t3-oss/env-nextjs"),l.push("zod")),u({projectDir:e,dependencies:l,devMode:!1});let m=s,d=Ge(!!o,!!s,t,n),p="";if(m?o?p="with-next-auth-db.js":p="with-db.js":o&&(p="with-next-auth.js"),p!==""){let Oe=C.join(c,"template/packages/src/env",p),Ne=C.join(e,"src/env.js");R.copyFileSync(Oe,Ne)}let g=C.join(e,".env"),w=C.join(e,".env.example"),M=$e+d,Te=Buffer.from(crypto.getRandomValues(new Uint8Array(32))).toString("base64"),Ee=d.replace('AUTH_SECRET=""',`AUTH_SECRET="${Te}" # Generated by create-tnt-stack`);R.writeFileSync(g,Ee,"utf-8"),R.writeFileSync(w,M,"utf-8")};function Ge(e,t,a,n){let i=`
|
7
7
|
# When adding additional environment variables, the schema in "/src/env.js"
|
8
8
|
# should be updated accordingly.
|
9
9
|
`.trim().concat(`
|
10
|
-
`);return t&&(
|
10
|
+
`);return t&&(i+=`
|
11
11
|
# Prisma
|
12
12
|
# https://www.prisma.io/docs/reference/database-reference/connection-urls#env
|
13
|
-
`),t&&(
|
14
|
-
`),e&&(
|
13
|
+
`),t&&(n==="mysql"?i+=`DATABASE_URL="mysql://root:password@localhost:3306/${a}"`:n==="postgresql"?i+=`DATABASE_URL="postgresql://postgres:password@localhost:5432/${a}"`:n==="sqlite"&&(i+='DATABASE_URL="file:./db.sqlite"'),i+=`
|
14
|
+
`),e&&(i+=`
|
15
15
|
# Next Auth
|
16
16
|
# You can generate a new secret on the command line with:
|
17
17
|
# npx auth secret
|
@@ -21,11 +21,11 @@ import xe from"path";import{execa as it}from"execa";import Ae from"fs-extra";imp
|
|
21
21
|
# Next Auth Discord Provider
|
22
22
|
DISCORD_CLIENT_ID=""
|
23
23
|
DISCORD_CLIENT_SECRET=""
|
24
|
-
`),!e&&!t&&(
|
24
|
+
`),!e&&!t&&(i+=`
|
25
25
|
# Example:
|
26
26
|
# SERVERVAR="foo"
|
27
27
|
# NEXT_PUBLIC_CLIENTVAR="bar"
|
28
|
-
`),
|
28
|
+
`),i}var $e=`
|
29
29
|
# Since the ".env" file is gitignored, you can use the ".env.example" file to
|
30
30
|
# build a new ".env" file when you clone the repo. Keep this file up-to-date
|
31
31
|
# when you add new variables to \`.env\`.
|
@@ -35,19 +35,19 @@ import xe from"path";import{execa as it}from"execa";import Ae from"fs-extra";imp
|
|
35
35
|
# ".env" and populate it with your secrets.
|
36
36
|
`.trim().concat(`
|
37
37
|
|
38
|
-
`);import
|
38
|
+
`);import G from"path";import $ from"fs-extra";var Z=({projectDir:e,packages:t})=>{let a=t?.eslint.inUse,n=[];a&&(n.push("eslint"),n.push("eslint-config-next"),n.push("@eslint/eslintrc")),u({projectDir:e,dependencies:n,devMode:!0});let i=G.join(c,"template/packages/config","eslint.config.mjs"),o=G.join(e,"eslint.config.mjs"),s=G.join(e,"package.json"),l=$.readJSONSync(s);l.scripts={...l.scripts,lint:"next lint"},$.copyFileSync(i,o),$.writeJSONSync(s,l,{spaces:2})};import v from"path";import U from"fs-extra";var ee=({projectDir:e,packages:t})=>{let a=t?.prisma.inUse,n=["next-auth"];a&&n.push("@auth/prisma-adapter"),u({projectDir:e,dependencies:n,devMode:!1});let i=v.join(c,"template/packages"),o="src/app/api/auth/[...nextauth]/route.ts",s=v.join(i,o),l=v.join(e,o),m=v.join(i,"src/server/auth/config",a?"next-auth-with-prisma.ts":"next-auth.ts"),d=v.join(e,"src/server/auth/config.ts"),p=v.join(i,"src/server/auth/next-auth.ts"),g=v.join(e,"src/server/auth/index.ts");U.copySync(s,l),U.copySync(m,d),U.copySync(p,g)};import te from"path";import Ue from"fs-extra";var ne=({projectDir:e,packages:t})=>{let a=t?.prettier.inUse,n=[];a&&(n.push("prettier"),n.push("prettier-plugin-tailwindcss"),n.push("@ianvs/prettier-plugin-sort-imports")),u({projectDir:e,dependencies:n,devMode:!0});let i=te.join(c,"template/packages/config","prettier.config.mjs"),o=te.join(e,"prettier.config.mjs");Ue.copyFileSync(i,o)};import h from"path";import y from"fs-extra";var ie=({projectDir:e,packages:t,databaseProvider:a})=>{u({projectDir:e,dependencies:["prisma"],devMode:!0}),u({projectDir:e,dependencies:["@prisma/client"],devMode:!1});let n=h.join(c,"template/packages"),i=h.join(n,"prisma/schema",`${t?.nextAuth.inUse?"with-next-auth":"base"}.prisma`),o=y.readFileSync(i,"utf-8");a!=="sqlite"&&(o=o.replace('provider = "sqlite"',`provider = "${{mysql:"mysql",postgresql:"postgresql"}[a]}"`),["mysql"].includes(a)&&(o=o.replace("// @db.Text","@db.Text")));let s=h.join(e,"prisma/schema.prisma");y.mkdirSync(h.dirname(s),{recursive:!0}),y.writeFileSync(s,o);let l=h.join(n,"src/server/db/db-prisma.ts"),m=h.join(e,"src/server/db/index.ts");y.mkdirSync(h.dirname(m),{recursive:!0}),y.writeFileSync(m,y.readFileSync(l,"utf-8"));let d=h.join(e,"package.json"),p=y.readJSONSync(d);p.scripts={...p.scripts,postinstall:"prisma generate","db:push":"prisma db push","db:studio":"prisma studio","db:generate":"prisma migrate dev","db:migrate":"prisma migrate deploy"},y.writeJSONSync(d,p,{spaces:2})};var T=["sqlite","mysql","postgresql"],ae=e=>({nextAuth:{inUse:e.includes("nextAuth"),installer:ee},prisma:{inUse:e.includes("prisma"),installer:ie},envVariables:{inUse:!0,installer:X},prettier:{inUse:e.includes("prettier"),installer:ne},eslint:{inUse:!0,installer:Z}});import Je from"path";import We from"fs-extra";function k(){let e=Je.join(c,"package.json");return We.readJSONSync(e).version??"1.0.0"}var f=()=>{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 x=class extends Error{constructor(t){super(t)}};import E from"chalk";var r={error(...e){console.log(E.red(...e))},warn(...e){console.log(E.yellow(...e))},info(...e){console.log(E.cyan(...e))},success(...e){console.log(E.green(...e))}};var O=e=>(e.length>1&&e.endsWith("/")&&(e=e.slice(0,-1)),e);var Le=/^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/;function oe(e){let t=O(e),a=t.split("/"),n=a.findIndex(o=>o.startsWith("@")),i=a[a.length-1];return a.findIndex(o=>o.startsWith("@"))!==-1&&(i=a.slice(n).join("/")),t=="."||Le.test(i??"")?!0:"App name must consist of only lowercase alphanumeric characters, '-', and '_'"}var se=e=>e.startsWith(".")||e.startsWith("/")?"Import alias can't start with '.' or '/'":!0;var b={appName:P,packages:[],flags:{noGit:!1,noInstall:!1,default:!1,CI:!1,nextAuth:!1,prisma:!1,prettier:!1,importAlias:"@/",dbProvider:"sqlite"},databaseProvider:"sqlite"};async function le(){let e=b,t=new qe().name(D).description("CLI for scaffolding new web apps with the TNT-Powered stack").version(k(),"-v, --version","Output the current version of TNT").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 tnt-stack",!1).option("--CI","Boolean value if we're running in CI",!1).option("--nextAuth [boolean]","Experimental: Boolean value if we should install NextAuth.js. Must be used in conjunction with `--CI`.",n=>!!n&&n!=="false").option("--prisma [boolean]","Experimental: Boolean value if we should install Prisma. Must be used in conjunction with `--CI`.",n=>!!n&&n!=="false").option("--prettier [boolean]","Experimental: Boolean value if we should install Prettier. Must be used in conjunction with `--CI`.",n=>!!n&&n!=="false").option("-i, --import-alias [alias]","Explicitly tell the CLI to use a custom import alias",b.flags.importAlias).option("--dbProvider [provider]",`Choose a database provider to use. Possible values: ${T.join(", ")}`,b.flags.dbProvider).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,
|
39
39
|
and likely to result in a crash. Please run create-tnt-stack with another
|
40
40
|
package manager such as pnpm, npm, or Yarn Classic.
|
41
|
-
See: https://github.com/t3-oss/create-t3-app/issues/57`);let
|
41
|
+
See: https://github.com/t3-oss/create-t3-app/issues/57`);let a=t.args[0];if(a&&(e.appName=a),e.flags=t.opts(),e.flags.CI)return e.packages=[],e.flags.nextAuth&&e.packages.push("nextAuth"),e.flags.prisma&&e.packages.push("prisma"),e.flags.prettier&&e.packages.push("prettier"),T.includes(e.flags.dbProvider)===!1&&(r.warn(`Incompatible database provided. Use: ${T.join(", ")}. Exiting.`),process.exit(0)),e.databaseProvider=e.packages.includes("prisma")?e.flags.dbProvider:"sqlite",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
|
42
42
|
using Git Bash. If that's that case, please use Git Bash from another terminal, such as Windows Terminal. Alternatively, you
|
43
|
-
can provide the arguments from the CLI directly: https://create.tntstack.org/installation#experimental-usage to skip the prompts.`),new x("Non-interactive environment");let
|
44
|
-
Using: ${_.cyan.bold(
|
45
|
-
`);let o=
|
46
|
-
`).start();if(
|
47
|
-
`);else{o.stopAndPersist();let l=await
|
48
|
-
`),
|
49
|
-
`)}async function
|
50
|
-
`).start(),
|
51
|
-
`)}catch{t.fail(`${
|
52
|
-
`)}}import
|
53
|
-
`))};var
|
43
|
+
can provide the arguments from the CLI directly: https://create.tntstack.org/installation#experimental-usage to skip the prompts.`),new x("Non-interactive environment");let n=f(),i={};a||(i.name=await re({message:"What will your project be called?",default:P,validate:s=>oe(s)})),i.authentication=await J({message:"What authentication provider would you like to use?",choices:[{value:"none",name:"None"},{value:"nextAuth",name:"NextAuth.js"}],default:"none"}),i.database=await J({message:"What database ORM would you like to use?",choices:[{value:"none",name:"None"},{value:"prisma",name:"Prisma"}],default:"none"}),i.database!=="none"&&(i.databaseProvider=await J({message:"What database provider would you like to use?",choices:[{value:"sqlite",name:"SQLite"},{value:"mysql",name:"MySQL"},{value:"postgresql",name:"PostgreSQL"}],default:"sqlite"})),i.prettier=await N({message:"Should we install Prettier?",default:!b.flags.prettier}),e.flags.noGit||(i.noGit=await N({message:"Should we initialize a Git repository and stage the changes?",default:!b.flags.noGit})),e.flags.noInstall||(i.noInstall=await N({message:`Should we run '${n}`+(n==="yarn"?"'?":" install' for you?"),default:!b.flags.noInstall})),i.importAlias=await re({message:"What import alias would you like to use?",default:b.flags.importAlias,validate:se});let o=[];return i.authentication==="nextAuth"&&o.push("nextAuth"),i.database==="prisma"&&o.push("prisma"),i.prettier&&o.push("prettier"),{appName:i.name??e.appName,packages:o,flags:{...e.flags,noGit:!i.noGit||e.flags.noGit,noInstall:!i.noInstall||e.flags.noInstall,importAlias:i.importAlias??e.flags.importAlias},databaseProvider:i.databaseProvider||"sqlite"}}catch(n){if(n instanceof x)r.warn(`${D} needs an interactive terminal to run.`),await N({message:"Continue scaffolding with default options?",default:!0})||(r.info("Exiting..."),process.exit(0)),r.info(`Scaffolding default tnt app in ./${e.appName}`);else throw n}return e}import He from"path";import pe from"chalk";import Ve from"ora";function ce(e){let{packages:t}=e;r.info("Adding boilerplate...");for(let[a,n]of Object.entries(t))if(n.inUse){let i=Ve(`Boilerplating ${a}...`).start();n.installer(e),i.succeed(pe.green(`${pe.green.bold(a)}`))}r.info("")}import W from"path";import{confirm as ze,select as Fe}from"@inquirer/prompts";import _ from"chalk";import I from"fs-extra";import Be from"ora";async function me({projectName:e,projectDir:t,pkgManager:a,noInstall:n}){let i=W.join(c,"template/base");n?r.info(""):r.info(`
|
44
|
+
Using: ${_.cyan.bold(a)}
|
45
|
+
`);let o=Be(`Scaffolding in: ${t}...
|
46
|
+
`).start();if(I.existsSync(t))if(I.readdirSync(t).length===0)e!=="."&&o.info(`${_.cyan.bold(e)} exists but is empty, continuing...
|
47
|
+
`);else{o.stopAndPersist();let l=await Fe({message:`${_.redBright.bold("Warning:")} ${_.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"});l==="abort"&&(o.fail("Aborting installation..."),process.exit(1)),await ze({message:`Are you sure you want to ${l==="clear"?"clear the directory":"overwrite conflicting files"}`,default:!1})||(o.fail("Aborting installation..."),process.exit(1)),l==="clear"&&(o.info(`Emptying ${_.cyan.bold(e)} and creating tnt app...
|
48
|
+
`),I.emptyDirSync(t))}o.start(),I.copySync(i,t),I.renameSync(W.join(t,"_gitignore"),W.join(t,".gitignore"));let s=e==="."?"App":_.cyan.bold(e);o.succeed(`${s} ${_.green.bold("scaffolded successfully!")}
|
49
|
+
`)}async function de({projectName:e,scopedAppName:t,packages:a,noInstall:n,databaseProvider:i}){let o=f(),s=He.resolve(process.cwd(),e);return await me({projectName:e,projectDir:s,pkgManager:o,scopedAppName:t,noInstall:n,databaseProvider:i}),ce({projectName:e,scopedAppName:t,projectDir:s,pkgManager:o,packages:a,noInstall:n,databaseProvider:i}),s}import{execSync as q}from"child_process";import L from"path";import{confirm as fe}from"@inquirer/prompts";import A from"chalk";import{execa as S}from"execa";import ge from"fs-extra";import Ke from"ora";function Ye(e){try{return q("git --version",{cwd:e}),!0}catch{return!1}}function V(e){return ge.existsSync(L.join(e,".git"))}async function z(e){try{return await S("git",["rev-parse","--is-inside-work-tree"],{cwd:e,stdout:"ignore"}),!0}catch{return!1}}function Qe(){let t=q("git --version").toString().trim().split(" ")[2],a=t?.split(".")[0],n=t?.split(".")[1];return{major:Number(a),minor:Number(n)}}function Xe(){return q("git config --global init.defaultBranch || echo main").toString().trim()}async function ue(e){if(r.info("Initializing Git..."),!Ye(e)){r.warn("Git is not installed. Skipping Git initialization.");return}let t=Ke(`Creating a new git repo...
|
50
|
+
`).start(),a=V(e),n=await z(e),i=L.parse(e).name;if(n&&a){if(t.stop(),!await fe({message:`${A.redBright.bold("Warning:")} Git is already initialized in "${i}". Initializing a new git repository would delete the previous history. Would you like to continue anyways?`,default:!1})){t.info("Skipping Git initialization.");return}ge.removeSync(L.join(e,".git"))}else if(n&&!a&&(t.stop(),!await fe({message:`${A.redBright.bold("Warning:")} "${i}" is already in a git worktree. Would you still like to initialize a new git repository in this directory?`,default:!1}))){t.info("Skipping Git initialization.");return}try{let o=Xe(),{major:s,minor:l}=Qe();s<2||s==2&&l<28?(await S("git",["init"],{cwd:e}),await S("git",["symbolic-ref","HEAD",`refs/heads/${o}`],{cwd:e})):await S("git",["init",`--initial-branch=${o}`],{cwd:e}),await S("git",["add","."],{cwd:e}),t.succeed(`${A.green("Successfully initialized and staged")} ${A.green.bold("git")}
|
51
|
+
`)}catch{t.fail(`${A.bold.red("Failed:")} could not initialize git. Update git to the latest version!
|
52
|
+
`)}}import Ze from"chalk";import{execa as he}from"execa";import ye from"ora";var F=async(e,t,a)=>{let{onDataHandle:n,args:i=["install"],stdout:o="pipe"}=a,s=ye(`Running ${t} install...`).start(),l=he(t,i,{cwd:e,stdout:o});return await new Promise((m,d)=>{n&&l.stdout?.on("data",n(s)),l.on("error",p=>d(p)),l.on("close",()=>m())}),s},et=async(e,t)=>{switch(e){case"npm":return await he(e,["install"],{cwd:t,stderr:"inherit"}),null;case"pnpm":return F(t,e,{onDataHandle:a=>n=>{let i=n.toString();i.includes("Progress")&&(a.text=i.includes("|")?i.split(" | ")[1]??"":i)}});case"yarn":return F(t,e,{onDataHandle:a=>n=>{a.text=n.toString()}});case"bun":return F(t,e,{stdout:"ignore"})}},ve=async({projectDir:e})=>{r.info("Installing dependencies...");let t=f();(await et(t,e)??ye()).succeed(Ze.green(`Successfully installed dependencies!
|
53
|
+
`))};var be=async({projectName:e=P,packages:t,noInstall:a,projectDir:n,databaseProvider:i})=>{let o=f();r.info("Next steps:"),e!=="."&&r.info(` cd ${e}`),a&&(o==="yarn"?r.info(` ${o}`):r.info(` ${o} install`)),["postgresql","mysql"].includes(i)&&r.info(" Add your database connection string to .env"),t?.nextAuth.inUse&&r.info(" Fill in your .env with necessary values. See https://create.tntstack.org/usage/first-steps for more info."),["npm"].includes(o)?r.info(` ${o} run dev`):r.info(` ${o} dev`),!await z(n)&&!V(n)&&r.info(" git init"),r.info(' git commit -m "initial commit"')};import j from"fs";import tt from"path";function _e(e,t,a){j.readdirSync(e).forEach(i=>{let o=tt.join(e,i);if(j.statSync(o).isDirectory())_e(o,t,a);else{let l=j.readFileSync(o,"utf8").replace(new RegExp(t,"g"),a);j.writeFileSync(o,l,"utf8")}})}function we(e,t){let a=t.replace(/\*/g,"").replace(/[^\/]$/,"$&/");_e(e,"@/",a)}import ke from"path";function Pe(e){let a=O(e).split("/"),n=a[a.length-1];if(n==="."){let s=ke.resolve(process.cwd());n=ke.basename(s)}let i=a.findIndex(s=>s.startsWith("@"));a.findIndex(s=>s.startsWith("@"))!==-1&&(n=a.slice(i).join("/"));let o=a.filter(s=>!s.startsWith("@")).join("/");return[n,o]}import nt from"gradient-string";var it={magenta:"#765bc8",pink:"#a48897",yellow:"#c7b561",green:"#8bb8a0",blue:"#4b97d5",cyan:"#22b6d2"};function xe(){let e=nt(Object.values(it)),t=f();(t==="yarn"||t==="pnpm")&&console.log(""),console.log(e.multiline(H))}import{execSync as at}from"child_process";import ot from"https";function Ie(e){let t=k();t.includes("beta")?(r.warn(" You are using a beta version of create-tnt-stack."),r.warn(" Please report any bugs you encounter.")):t!==e&&(r.warn(" You are using an outdated version of create-tnt-stack."),r.warn(" Your version:",t+".","Latest version in the npm registry:",e),r.warn(" Please run the CLI with @latest to get the latest updates.")),console.log("")}function st(){return new Promise((e,t)=>{ot.get("https://registry.npmjs.org/-/package/tnt-stack/dist-tags",a=>{if(a.statusCode===200){let n="";a.on("data",i=>n+=i),a.on("end",()=>{e(JSON.parse(n).latest)})}else t()}).on("error",()=>{t()})})}var Ae=()=>st().catch(()=>{try{return at("npm view create-tnt-stack version").toString().trim()}catch{return null}});async function lt(){let e=await Ae(),t=f();xe(),e&&Ie(e);let{appName:a,packages:n,flags:{noGit:i,noInstall:o,importAlias:s},databaseProvider:l}=await le(),m=ae(n),[d,p]=Pe(a),g=await de({projectName:p,scopedAppName:d,packages:m,noInstall:o,databaseProvider:l}),w=Ce.readJsonSync(Se.join(g,"package.json"));w.name=d,w.ctntaMetadata={initVersion:k()};let{stdout:M}=await rt(t,["-v"],{cwd:g});w.packageManager=`${t}@${M.trim()}`,Ce.writeJSONSync(Se.join(g,"package.json"),w,{spaces:2}),s!=="@/"&&we(g,s),o||await ve({projectDir:g}),i||await ue(g),await be({projectDir:g,projectName:p,packages:m,noInstall:o,databaseProvider:l}),process.exit(0)}lt().catch(e=>{r.error("Aborting installation..."),e instanceof Error?r.error(e.message):(r.error("An unknown error occurred. Please open an issue on GitHub with the below:"),console.error(e)),process.exit(1)});
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "create-tnt-stack",
|
3
|
-
"version": "0.3.
|
3
|
+
"version": "0.3.4",
|
4
4
|
"description": "Create web application with the TNT-Powered stack",
|
5
5
|
"license": "MIT",
|
6
6
|
"repository": {
|
@@ -31,11 +31,11 @@
|
|
31
31
|
"node": ">=18"
|
32
32
|
},
|
33
33
|
"scripts": {
|
34
|
+
"dev": "tsup --watch",
|
34
35
|
"build": "tsup",
|
35
36
|
"start": "node dist/index.js",
|
36
|
-
"dev": "tsup --watch",
|
37
|
-
"lint": "eslint . --ext .ts,.tsx",
|
38
37
|
"format": "prettier '**/*.{cjs,mjs,ts,tsx,md,json}' --ignore-path ../.gitignore --ignore-unknown --no-error-on-unmatched-pattern --write",
|
38
|
+
"format:check": "prettier '**/*.{cjs,mjs,ts,tsx,md,json}' --ignore-path ../.gitignore --ignore-unknown --no-error-on-unmatched-pattern --check",
|
39
39
|
"typecheck": "tsc",
|
40
40
|
"clean": "rm -rf dist .turbo node_modules",
|
41
41
|
"release": "changeset version",
|
@@ -43,7 +43,7 @@
|
|
43
43
|
"pub:release": "bun run build && npm publish"
|
44
44
|
},
|
45
45
|
"dependencies": {
|
46
|
-
"@inquirer/prompts": "^7.
|
46
|
+
"@inquirer/prompts": "^7.4.0",
|
47
47
|
"chalk": "^5.4.1",
|
48
48
|
"commander": "^13.1.0",
|
49
49
|
"execa": "^9.5.2",
|
@@ -54,18 +54,21 @@
|
|
54
54
|
},
|
55
55
|
"devDependencies": {
|
56
56
|
"@auth/prisma-adapter": "^2.8.0",
|
57
|
+
"@eslint/eslintrc": "^3.3.0",
|
57
58
|
"@ianvs/prettier-plugin-sort-imports": "^4.4.1",
|
58
|
-
"@prisma/client": "^6.
|
59
|
+
"@prisma/client": "^6.5.0",
|
59
60
|
"@t3-oss/env-nextjs": "^0.12.0",
|
60
61
|
"@types/fs-extra": "^11.0.4",
|
61
|
-
"
|
62
|
+
"eslint": "^9.22.0",
|
63
|
+
"eslint-config-next": "^15.2.3",
|
64
|
+
"next": "^15.2.3",
|
62
65
|
"next-auth": "^4.24.11",
|
63
66
|
"prettier": "^3.5.3",
|
64
67
|
"prettier-plugin-tailwindcss": "^0.6.11",
|
65
|
-
"prisma": "^6.
|
68
|
+
"prisma": "^6.5.0",
|
66
69
|
"react": "^19.0.0",
|
67
70
|
"react-dom": "^19.0.0",
|
68
|
-
"tailwindcss": "^4.0.
|
71
|
+
"tailwindcss": "^4.0.14",
|
69
72
|
"tsup": "^8.4.0",
|
70
73
|
"type-fest": "^4.37.0",
|
71
74
|
"typescript": "^5.8.2",
|
@@ -6,23 +6,19 @@
|
|
6
6
|
"scripts": {
|
7
7
|
"dev": "next dev --turbopack",
|
8
8
|
"build": "next build",
|
9
|
-
"start": "next start"
|
10
|
-
"lint": "next lint"
|
9
|
+
"start": "next start"
|
11
10
|
},
|
12
11
|
"dependencies": {
|
13
12
|
"react": "^19.0.0",
|
14
13
|
"react-dom": "^19.0.0",
|
15
|
-
"next": "15.2.
|
14
|
+
"next": "^15.2.3"
|
16
15
|
},
|
17
16
|
"devDependencies": {
|
18
|
-
"typescript": "^5",
|
17
|
+
"typescript": "^5.8.2",
|
19
18
|
"@types/node": "^22",
|
20
19
|
"@types/react": "^19",
|
21
20
|
"@types/react-dom": "^19",
|
22
21
|
"@tailwindcss/postcss": "^4",
|
23
|
-
"tailwindcss": "^4"
|
24
|
-
"eslint": "^9",
|
25
|
-
"eslint-config-next": "15.2.1",
|
26
|
-
"@eslint/eslintrc": "^3"
|
22
|
+
"tailwindcss": "^4.0.14"
|
27
23
|
}
|
28
24
|
}
|
File without changes
|