@codabytez/create-next-template 0.1.4 → 0.1.6

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.
Files changed (2) hide show
  1. package/dist/index.js +88 -12
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -26,13 +26,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  // src/index.ts
27
27
  var p2 = __toESM(require("@clack/prompts"));
28
28
  var import_chalk2 = __toESM(require("chalk"));
29
- var import_path6 = __toESM(require("path"));
29
+ var import_path7 = __toESM(require("path"));
30
30
 
31
31
  // src/installer.ts
32
32
  var p = __toESM(require("@clack/prompts"));
33
33
  var import_chalk = __toESM(require("chalk"));
34
- var import_fs_extra5 = __toESM(require("fs-extra"));
35
- var import_path5 = __toESM(require("path"));
34
+ var import_fs_extra6 = __toESM(require("fs-extra"));
35
+ var import_path6 = __toESM(require("path"));
36
36
 
37
37
  // src/helpers/copy.ts
38
38
  var import_fs_extra = __toESM(require("fs-extra"));
@@ -107,6 +107,8 @@ var BASE_DEV_DEPS = {
107
107
  "@tailwindcss/postcss": "^4.2.2",
108
108
  postcss: "^8.5.8",
109
109
  // Code quality
110
+ eslint: "^10.1.0",
111
+ "eslint-config-next": "^16.2.0",
110
112
  "@eslint/eslintrc": "^3.3.5",
111
113
  prettier: "^3.8.1",
112
114
  "eslint-config-prettier": "^10.1.8",
@@ -248,6 +250,77 @@ export default function RootLayout({
248
250
  await import_fs_extra4.default.writeFile(import_path4.default.join(appDir, "layout.tsx"), layoutContent);
249
251
  }
250
252
 
253
+ // src/generators/readme.ts
254
+ var import_fs_extra5 = __toESM(require("fs-extra"));
255
+ var import_path5 = __toESM(require("path"));
256
+ var FEATURE_LABELS = {
257
+ animations: "Framer Motion",
258
+ dataFetching: "TanStack Query + Axios",
259
+ forms: "React Hook Form + Zod",
260
+ extraIcons: "Iconsax React",
261
+ auth: "Clerk",
262
+ prisma: "Prisma (PostgreSQL)",
263
+ convex: "Convex",
264
+ appwrite: "Appwrite",
265
+ ui: "shadcn/ui"
266
+ };
267
+ async function generateReadme(projectPath, projectName, packageManager, features) {
268
+ const featureList = features.filter((f) => FEATURE_LABELS[f]).map((f) => `- ${FEATURE_LABELS[f]}`).join("\n");
269
+ const hasPrisma = features.includes("prisma");
270
+ const hasConvex = features.includes("convex");
271
+ const hasAuth = features.includes("auth");
272
+ const hasShadcn = features.includes("ui");
273
+ const envSection = hasPrisma || hasConvex || hasAuth ? `
274
+ ## Environment Variables
275
+
276
+ Copy \`.env.example\` to \`.env\` and fill in the required values:
277
+
278
+ \`\`\`bash
279
+ cp .env.example .env
280
+ \`\`\`
281
+ ` : "";
282
+ const extraSteps = [];
283
+ if (hasShadcn) extraSteps.push(`npx shadcn@latest init`);
284
+ if (hasPrisma) extraSteps.push(`npx prisma migrate dev`);
285
+ if (hasConvex) extraSteps.push(`npx convex dev`);
286
+ const extraSection = extraSteps.length > 0 ? `
287
+ ## Additional Setup
288
+
289
+ \`\`\`bash
290
+ ${extraSteps.join("\n")}
291
+ \`\`\`
292
+ ` : "";
293
+ const content = `# ${projectName}
294
+
295
+ A [Next.js](https://nextjs.org) project bootstrapped with [create-next-template](https://github.com/codabytez/create-next-template).
296
+
297
+ ## Tech Stack
298
+
299
+ - [Next.js](https://nextjs.org)
300
+ - [TypeScript](https://www.typescriptlang.org)
301
+ - [Tailwind CSS](https://tailwindcss.com)
302
+ ${featureList ? featureList + "\n" : ""}
303
+ ## Getting Started
304
+
305
+ \`\`\`bash
306
+ ${packageManager} run dev
307
+ \`\`\`
308
+
309
+ Open [http://localhost:3000](http://localhost:3000) in your browser.
310
+ ${envSection}${extraSection}
311
+ ## Code Quality
312
+
313
+ This project uses ESLint, Prettier, and Husky pre-commit hooks to enforce consistent code style.
314
+
315
+ \`\`\`bash
316
+ ${packageManager} run lint # lint
317
+ ${packageManager} run format # format
318
+ ${packageManager} run check-types # type check
319
+ \`\`\`
320
+ `;
321
+ await import_fs_extra5.default.writeFile(import_path5.default.join(projectPath, "README.md"), content);
322
+ }
323
+
251
324
  // src/installer.ts
252
325
  var FEATURE_TEMPLATE_MAP = {
253
326
  animations: "animations",
@@ -269,7 +342,7 @@ async function runInstaller({
269
342
  }) {
270
343
  const s = p.spinner();
271
344
  if (!inPlace) {
272
- if (await import_fs_extra5.default.pathExists(projectPath)) {
345
+ if (await import_fs_extra6.default.pathExists(projectPath)) {
273
346
  const overwrite = await p.confirm({
274
347
  message: `Directory "${projectName}" already exists. Overwrite?`
275
348
  });
@@ -277,9 +350,9 @@ async function runInstaller({
277
350
  p.cancel("Operation cancelled");
278
351
  process.exit(0);
279
352
  }
280
- await import_fs_extra5.default.remove(projectPath);
353
+ await import_fs_extra6.default.remove(projectPath);
281
354
  }
282
- await import_fs_extra5.default.ensureDir(projectPath);
355
+ await import_fs_extra6.default.ensureDir(projectPath);
283
356
  }
284
357
  s.start("Scaffolding project structure");
285
358
  await copyTemplate("base", projectPath);
@@ -290,12 +363,13 @@ async function runInstaller({
290
363
  }
291
364
  }
292
365
  await generateLayout(projectPath, features);
366
+ await generateReadme(projectPath, projectName, packageManager, features);
293
367
  await mergeEnvExamples(projectPath, features);
294
- const huskyDir = import_path5.default.join(projectPath, ".husky");
368
+ const huskyDir = import_path6.default.join(projectPath, ".husky");
295
369
  for (const hook of ["pre-commit", "pre-push"]) {
296
- const hookPath = import_path5.default.join(huskyDir, hook);
297
- if (await import_fs_extra5.default.pathExists(hookPath)) {
298
- await import_fs_extra5.default.chmod(hookPath, 493);
370
+ const hookPath = import_path6.default.join(huskyDir, hook);
371
+ if (await import_fs_extra6.default.pathExists(hookPath)) {
372
+ await import_fs_extra6.default.chmod(hookPath, 493);
299
373
  }
300
374
  }
301
375
  s.stop("Project structure scaffolded");
@@ -312,6 +386,8 @@ async function runInstaller({
312
386
  }
313
387
  s.start("Initializing git repository");
314
388
  await runCommand("git", ["init"], projectPath);
389
+ await runCommand("git", ["rm", "-r", "--cached", "--quiet", "."], projectPath).catch(() => {
390
+ });
315
391
  await runCommand("git", ["add", "-A"], projectPath);
316
392
  await runCommand(
317
393
  "git",
@@ -366,7 +442,7 @@ async function main() {
366
442
  p2.intro(import_chalk2.default.bgCyan(import_chalk2.default.black(" create-next-template ")));
367
443
  const dirArg = args.find((a) => !a.startsWith("-"));
368
444
  const inPlace = dirArg === ".";
369
- const defaultName = inPlace ? import_path6.default.basename(process.cwd()) : dirArg ?? void 0;
445
+ const defaultName = inPlace ? import_path7.default.basename(process.cwd()) : dirArg ?? void 0;
370
446
  const projectName = await p2.text({
371
447
  message: "What is your project name?",
372
448
  placeholder: "my-next-app",
@@ -430,7 +506,7 @@ async function main() {
430
506
  `You selected multiple databases (${dbChoices.join(", ")}). This is supported but may require manual configuration.`
431
507
  );
432
508
  }
433
- const projectPath = inPlace ? process.cwd() : import_path6.default.resolve(process.cwd(), projectName);
509
+ const projectPath = inPlace ? process.cwd() : import_path7.default.resolve(process.cwd(), projectName);
434
510
  await runInstaller({
435
511
  projectName,
436
512
  projectPath,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codabytez/create-next-template",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "CLI to scaffold Next.js projects with your preferred stack",
5
5
  "bin": {
6
6
  "create-next-template": "./dist/index.js"