@codabytez/create-next-template 0.1.0 → 0.1.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/README.md +3 -3
- package/dist/index.js +82 -49
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -7,14 +7,14 @@ An interactive CLI that scaffolds a production-ready Next.js project with your p
|
|
|
7
7
|
## Quick start
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
npx create-next-template
|
|
10
|
+
npx @codabytez/create-next-template@latest
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
Or with a specific package manager:
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
pnpm dlx create-next-template
|
|
17
|
-
bunx create-next-template
|
|
16
|
+
pnpm dlx @codabytez/create-next-template
|
|
17
|
+
bunx @codabytez/create-next-template
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
---
|
package/dist/index.js
CHANGED
|
@@ -76,71 +76,71 @@ var import_path3 = __toESM(require("path"));
|
|
|
76
76
|
|
|
77
77
|
// src/helpers/run.ts
|
|
78
78
|
var import_execa = require("execa");
|
|
79
|
-
async function runCommand(command,
|
|
80
|
-
await (0, import_execa.execa)(command,
|
|
79
|
+
async function runCommand(command, args2, cwd) {
|
|
80
|
+
await (0, import_execa.execa)(command, args2, { cwd, stdio: "inherit" });
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
// src/helpers/packages.ts
|
|
84
84
|
var BASE_DEPS = {
|
|
85
|
-
next: "^
|
|
86
|
-
react: "^
|
|
87
|
-
"react-dom": "^
|
|
85
|
+
next: "^16.2.0",
|
|
86
|
+
react: "^19.2.4",
|
|
87
|
+
"react-dom": "^19.2.4",
|
|
88
88
|
clsx: "^2.1.1",
|
|
89
|
-
"tailwind-merge": "^
|
|
90
|
-
"class-variance-authority": "^0.7.
|
|
91
|
-
zod: "^3.
|
|
92
|
-
"date-fns": "^
|
|
93
|
-
"cookies-next": "^
|
|
94
|
-
"lucide-react": "^0.
|
|
89
|
+
"tailwind-merge": "^3.5.0",
|
|
90
|
+
"class-variance-authority": "^0.7.1",
|
|
91
|
+
zod: "^4.3.6",
|
|
92
|
+
"date-fns": "^4.1.0",
|
|
93
|
+
"cookies-next": "^6.1.1",
|
|
94
|
+
"lucide-react": "^0.577.0"
|
|
95
95
|
};
|
|
96
96
|
var BASE_DEV_DEPS = {
|
|
97
|
-
typescript: "^5.
|
|
98
|
-
"@types/node": "^
|
|
99
|
-
"@types/react": "^
|
|
100
|
-
"@types/react-dom": "^
|
|
101
|
-
tailwindcss: "^4.
|
|
102
|
-
"@tailwindcss/postcss": "^4.
|
|
103
|
-
postcss: "^8.
|
|
97
|
+
typescript: "^5.9.3",
|
|
98
|
+
"@types/node": "^25.5.0",
|
|
99
|
+
"@types/react": "^19.2.14",
|
|
100
|
+
"@types/react-dom": "^19.2.3",
|
|
101
|
+
tailwindcss: "^4.2.2",
|
|
102
|
+
"@tailwindcss/postcss": "^4.2.2",
|
|
103
|
+
postcss: "^8.5.8",
|
|
104
104
|
// Code quality
|
|
105
|
-
"@eslint/eslintrc": "^3.
|
|
106
|
-
prettier: "^3.
|
|
107
|
-
"eslint-config-prettier": "^
|
|
108
|
-
"eslint-plugin-prettier": "^5.
|
|
105
|
+
"@eslint/eslintrc": "^3.3.5",
|
|
106
|
+
prettier: "^3.8.1",
|
|
107
|
+
"eslint-config-prettier": "^10.1.8",
|
|
108
|
+
"eslint-plugin-prettier": "^5.5.5",
|
|
109
109
|
// Git hooks
|
|
110
|
-
husky: "^9.1.
|
|
111
|
-
"lint-staged": "^
|
|
110
|
+
husky: "^9.1.7",
|
|
111
|
+
"lint-staged": "^16.4.0"
|
|
112
112
|
};
|
|
113
113
|
var FEATURE_DEPS = {
|
|
114
114
|
animations: {
|
|
115
|
-
"framer-motion": "^
|
|
115
|
+
"framer-motion": "^12.38.0"
|
|
116
116
|
},
|
|
117
117
|
dataFetching: {
|
|
118
|
-
"@tanstack/react-query": "^5.
|
|
119
|
-
axios: "^1.
|
|
118
|
+
"@tanstack/react-query": "^5.91.3",
|
|
119
|
+
axios: "^1.13.6"
|
|
120
120
|
},
|
|
121
121
|
forms: {
|
|
122
|
-
"react-hook-form": "^7.
|
|
123
|
-
"@hookform/resolvers": "^
|
|
122
|
+
"react-hook-form": "^7.71.2",
|
|
123
|
+
"@hookform/resolvers": "^5.2.2"
|
|
124
124
|
},
|
|
125
125
|
extraIcons: {
|
|
126
|
-
"iconsax-reactjs": "^
|
|
126
|
+
"iconsax-reactjs": "^0.0.8"
|
|
127
127
|
},
|
|
128
128
|
auth: {
|
|
129
|
-
"@clerk/nextjs": "^
|
|
129
|
+
"@clerk/nextjs": "^7.0.6"
|
|
130
130
|
},
|
|
131
131
|
prisma: {
|
|
132
|
-
"@prisma/client": "^5.
|
|
132
|
+
"@prisma/client": "^7.5.0"
|
|
133
133
|
},
|
|
134
134
|
convex: {
|
|
135
|
-
convex: "^1.
|
|
135
|
+
convex: "^1.34.0"
|
|
136
136
|
},
|
|
137
137
|
appwrite: {
|
|
138
|
-
appwrite: "^
|
|
138
|
+
appwrite: "^23.0.0"
|
|
139
139
|
}
|
|
140
140
|
};
|
|
141
141
|
var FEATURE_DEV_DEPS = {
|
|
142
142
|
prisma: {
|
|
143
|
-
prisma: "^5.
|
|
143
|
+
prisma: "^7.5.0"
|
|
144
144
|
}
|
|
145
145
|
};
|
|
146
146
|
function buildPackageJson(projectName, features) {
|
|
@@ -259,20 +259,23 @@ async function runInstaller({
|
|
|
259
259
|
projectName,
|
|
260
260
|
projectPath,
|
|
261
261
|
packageManager,
|
|
262
|
-
features
|
|
262
|
+
features,
|
|
263
|
+
inPlace
|
|
263
264
|
}) {
|
|
264
265
|
const s = p.spinner();
|
|
265
|
-
if (
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
p.
|
|
271
|
-
|
|
266
|
+
if (!inPlace) {
|
|
267
|
+
if (await import_fs_extra5.default.pathExists(projectPath)) {
|
|
268
|
+
const overwrite = await p.confirm({
|
|
269
|
+
message: `Directory "${projectName}" already exists. Overwrite?`
|
|
270
|
+
});
|
|
271
|
+
if (!overwrite || p.isCancel(overwrite)) {
|
|
272
|
+
p.cancel("Operation cancelled");
|
|
273
|
+
process.exit(0);
|
|
274
|
+
}
|
|
275
|
+
await import_fs_extra5.default.remove(projectPath);
|
|
272
276
|
}
|
|
273
|
-
await import_fs_extra5.default.
|
|
277
|
+
await import_fs_extra5.default.ensureDir(projectPath);
|
|
274
278
|
}
|
|
275
|
-
await import_fs_extra5.default.ensureDir(projectPath);
|
|
276
279
|
s.start("Scaffolding project structure");
|
|
277
280
|
await copyTemplate("base", projectPath);
|
|
278
281
|
for (const feature of features) {
|
|
@@ -317,8 +320,8 @@ async function runInstaller({
|
|
|
317
320
|
const hasAppwrite = features.includes("appwrite");
|
|
318
321
|
console.log();
|
|
319
322
|
p.outro(
|
|
320
|
-
import_chalk.default.green("\u2714 Project created successfully!\n\n") + ` ${import_chalk.default.cyan("cd")} ${projectName}
|
|
321
|
-
` + (hasShadcn ? ` ${import_chalk.default.cyan("npx shadcn@latest init")} ${import_chalk.default.gray("# set up shadcn/ui")}
|
|
323
|
+
import_chalk.default.green("\u2714 Project created successfully!\n\n") + (inPlace ? "" : ` ${import_chalk.default.cyan("cd")} ${projectName}
|
|
324
|
+
`) + (hasShadcn ? ` ${import_chalk.default.cyan("npx shadcn@latest init")} ${import_chalk.default.gray("# set up shadcn/ui")}
|
|
322
325
|
` : "") + (hasPrisma ? ` ${import_chalk.default.gray("# update DATABASE_URL in .env, then:")}
|
|
323
326
|
${import_chalk.default.cyan("npx prisma migrate dev")}
|
|
324
327
|
` : "") + (hasConvex ? ` ${import_chalk.default.cyan("npx convex dev")} ${import_chalk.default.gray("# start Convex backend")}
|
|
@@ -328,12 +331,41 @@ async function runInstaller({
|
|
|
328
331
|
}
|
|
329
332
|
|
|
330
333
|
// src/index.ts
|
|
334
|
+
var args = process.argv.slice(2);
|
|
335
|
+
if (args.includes("--help") || args.includes("-h")) {
|
|
336
|
+
console.log(
|
|
337
|
+
`
|
|
338
|
+
${import_chalk2.default.bgCyan(import_chalk2.default.black(" create-next-template "))}
|
|
339
|
+
|
|
340
|
+
${import_chalk2.default.bold("Usage:")}
|
|
341
|
+
pnpx @codabytez/create-next-template ${import_chalk2.default.green("[directory]")}
|
|
342
|
+
|
|
343
|
+
${import_chalk2.default.bold("Arguments:")}
|
|
344
|
+
${import_chalk2.default.green("directory")} Where to scaffold the project.
|
|
345
|
+
Use ${import_chalk2.default.cyan(".")} to scaffold into the current directory,
|
|
346
|
+
or omit to be prompted for a name.
|
|
347
|
+
|
|
348
|
+
${import_chalk2.default.bold("Options:")}
|
|
349
|
+
${import_chalk2.default.cyan("-h, --help")} Show this help message
|
|
350
|
+
|
|
351
|
+
${import_chalk2.default.bold("Examples:")}
|
|
352
|
+
pnpx @codabytez/create-next-template
|
|
353
|
+
pnpx @codabytez/create-next-template ${import_chalk2.default.green("my-app")}
|
|
354
|
+
pnpx @codabytez/create-next-template ${import_chalk2.default.green(".")}
|
|
355
|
+
`
|
|
356
|
+
);
|
|
357
|
+
process.exit(0);
|
|
358
|
+
}
|
|
331
359
|
async function main() {
|
|
332
360
|
console.log();
|
|
333
361
|
p2.intro(import_chalk2.default.bgCyan(import_chalk2.default.black(" create-next-template ")));
|
|
362
|
+
const dirArg = args.find((a) => !a.startsWith("-"));
|
|
363
|
+
const inPlace = dirArg === ".";
|
|
364
|
+
const defaultName = inPlace ? import_path6.default.basename(process.cwd()) : dirArg ?? void 0;
|
|
334
365
|
const projectName = await p2.text({
|
|
335
366
|
message: "What is your project name?",
|
|
336
367
|
placeholder: "my-next-app",
|
|
368
|
+
initialValue: defaultName,
|
|
337
369
|
validate(value) {
|
|
338
370
|
if (!value) return "Project name is required";
|
|
339
371
|
if (!/^[a-z0-9-_]+$/.test(value))
|
|
@@ -393,12 +425,13 @@ async function main() {
|
|
|
393
425
|
`You selected multiple databases (${dbChoices.join(", ")}). This is supported but may require manual configuration.`
|
|
394
426
|
);
|
|
395
427
|
}
|
|
396
|
-
const projectPath = import_path6.default.resolve(process.cwd(), projectName);
|
|
428
|
+
const projectPath = inPlace ? process.cwd() : import_path6.default.resolve(process.cwd(), projectName);
|
|
397
429
|
await runInstaller({
|
|
398
430
|
projectName,
|
|
399
431
|
projectPath,
|
|
400
432
|
packageManager,
|
|
401
|
-
features: selectedFeatures
|
|
433
|
+
features: selectedFeatures,
|
|
434
|
+
inPlace
|
|
402
435
|
});
|
|
403
436
|
}
|
|
404
437
|
main().catch((err) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codabytez/create-next-template",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "CLI to scaffold Next.js projects with your preferred stack",
|
|
5
5
|
"bin": {
|
|
6
6
|
"create-next-template": "./dist/index.js"
|
|
@@ -9,6 +9,11 @@
|
|
|
9
9
|
"dist",
|
|
10
10
|
"templates"
|
|
11
11
|
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "tsup src/index.ts --format cjs --clean",
|
|
14
|
+
"dev": "tsx src/index.ts",
|
|
15
|
+
"lint": "tsc --noEmit"
|
|
16
|
+
},
|
|
12
17
|
"dependencies": {
|
|
13
18
|
"@clack/prompts": "^0.7.0",
|
|
14
19
|
"chalk": "^5.3.0",
|
|
@@ -22,10 +27,5 @@
|
|
|
22
27
|
"tsup": "^8.0.0",
|
|
23
28
|
"tsx": "^4.7.0",
|
|
24
29
|
"typescript": "^5.4.0"
|
|
25
|
-
},
|
|
26
|
-
"scripts": {
|
|
27
|
-
"build": "tsup src/index.ts --format cjs --clean",
|
|
28
|
-
"dev": "tsx src/index.ts",
|
|
29
|
-
"lint": "tsc --noEmit"
|
|
30
30
|
}
|
|
31
|
-
}
|
|
31
|
+
}
|