Skip to content

Conversation

@PrabothCharith
Copy link
Owner

This pull request introduces a major update (v2.0.0) to nxt-gen-cli, significantly expanding its feature set, improving documentation, and enhancing CI/CD automation. The most important changes include a comprehensive CLI option overhaul, a rewritten and expanded README, new CI workflows, and several developer experience and dependency improvements.

Key changes:

CLI & Feature Expansion

  • Added new CLI options for advanced stack customization, including support for Drizzle ORM, authentication providers, forms (React Hook Form + Zod), internationalization, Docker, CI/CD, Husky, Vitest, Playwright, Storybook, and more. The CLI now uses a unified and extensible options format (e.g., --orm <type>, --auth <type>, etc.) and validates project names for npm compatibility. (src/index.ts, README.md, package.json) [1] [2] [3] [4] [5] [6] [7] [8]

Documentation & Usability

  • Rewrote and greatly expanded the README.md to document all new features, CLI options, and project structure. Added a new "Features Checklist & Roadmap" to track planned improvements. (README.md, Features Checklist & Roadmap.md) [1] [2] [3] [4] [5] [6]

CI/CD & Automation

  • Introduced a new pr-checks.yml workflow for PR validation (build & smoke tests) and enhanced the auto-publish.yml workflow to include smoke testing and secure npm publishing with token authentication. (.github/workflows/pr-checks.yml, .github/workflows/auto-publish.yml) [1] [2]

Developer Experience & Dependencies

  • Upgraded project to ESM (type: "module"), added new dependencies for improved CLI visuals and update notifications, and introduced smoke and integration test scripts. (package.json, src/index.ts) [1] [2] [3]

Versioning & Roadmap

  • Bumped version to 2.0.0 to reflect breaking changes and major new features. Added roadmap items for future CI/CD automation and local file CRUD support. (package.json, Features Checklist & Roadmap.md) [1] [2]

Added src/lib/pm.ts with helper functions to detect package manager (npm, pnpm, yarn, bun) and generate corresponding install/execution commands.
Refactored CLI to detect and use the active package manager (npm, pnpm, yarn, bun). Updated scaffold logic and bumped version to 1.2.0.
Added gradient-string, figlet, and boxen for a richer CLI experience. Implemented update-notifier and strict project name validation. Migrated codebase to ESM.
Added support for generating Dockerfile, GitHub Actions CI workflow, and .env.example. Integrated Husky and lint-staged for code quality checks.
Added optional scaffolding for Vitest (Unit/Integration), Playwright (E2E), and Storybook. Updated CLI prompts and scaffold logic.
Replaced safer string replacement logic with robust AST transformations for 'layout.tsx' and 'tailwind.config.ts' modifications. Added 'src/lib/ast.ts'.
Implemented automatic generation of project documentation including README.md with feature list and LICENSE file (MIT/Apache).
Implemented support for Auth.js (NextAuth v5 Beta) and Clerk. Includes dependency installation, config file generation (auth.ts, middleware.ts, api routes), environment variable setup, and updated CLI prompts.
Implemented support for React Hook Form and Zod. Includes installing dependencies, generating generic validation schemas, and creating an example contact form component.
Implemented support for Internationalization using next-intl. Includes dependency installation, locale message generation, i18n config, and middleware setup.
Added command-line options for all features. Created smoke test suite to verify build and template integrity.
- Added onCancel handler to prevent silent failures when user cancels prompts\n- Added directory existence check to provide clear error message\n- Prevents create-next-app from failing on existing directories
Changed Examples prompt initial from string 'none' to numeric index 3. The prompts library requires numeric indices for select-type prompts, not string values.
Wrapped Storybook init in try-catch to handle cases where it prompts for input. Now provides helpful manual setup instructions if automated setup fails.
BREAKING CHANGE: Refactored entire scaffolding process to collect dependencies first, then install in batch at user's discretion.\n\n- Created DependencyCollector class for tracking dependencies\n- Updated all 12 setup functions to use DependencyCollector\n- Added user prompt for installation choice\n- Batch install all dependencies at once (much faster)\n- Added post-install commands for Husky, Prisma, Playwright\n- Files generate in seconds, installation is optional\n- Better error handling and user feedback\n\nBenefits:\n- 5-10x faster file generation\n- User control over when to install\n- Cleaner separation of concerns\n- More maintainable code
- Removed Prisma init from post-install (files already created during generation)\n- Removed Husky init from post-install (files already created during generation)\n- Added Husky file generation to setupQuality function\n- Only keeping Playwright browser installation in post-install\n- Fixes errors where init commands failed because directories already existed
Fixed bug in AST helper that was adding both defaultImport and namedImports for Providers, causing syntax error in generated layout.tsx
Fixed handlers export - should export handlers first, then destructure GET/POST separately
Changed from v5 beta syntax to v4 stable syntax for better compatibility and stability
NextAuth v4 doesn't use the same middleware pattern as v5. Removed middleware.ts creation to prevent build errors.
Prisma schema requires url field in datasource. Added default SQLite file path.
Updated Prisma schema template for Prisma 7 compatibility: removed unsupported 'url' property and added explicit output path to ensure client generation works in nested environments.
Replaced placeholder auth page with fully functional examples for NextAuth (Dashboard/Sign-In) and Clerk (UserButton/SignInButton). Also exported authOptions from auth.ts for server-side usage.
Added ?callbackUrl=/auth to NextAuth sign-in link in the example page. This ensures users are redirected back to the dashboard after successful login, instead of the home page.
…ct structure for Drizzle, forms, auth, i18n, DevOps, testing, and code quality.
@PrabothCharith PrabothCharith self-assigned this Dec 31, 2025
@PrabothCharith PrabothCharith added documentation Improvements or additions to documentation enhancement New feature or request labels Dec 31, 2025
@github-project-automation github-project-automation bot moved this to Backlog in nxt-gen-cli Dec 31, 2025
@PrabothCharith PrabothCharith moved this from Backlog to In progress in nxt-gen-cli Dec 31, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR represents a major v2.0.0 release of nxt-gen-cli, introducing significant feature expansion and architectural improvements to the Next.js project scaffolding CLI.

Purpose: Transform nxt-gen-cli from a basic scaffolding tool into a comprehensive project generator with support for multiple ORMs, authentication providers, testing frameworks, internationalization, and DevOps configurations.

Key Changes:

  • Migrated from CommonJS to ESM module system with NodeNext resolution
  • Expanded CLI options to support Drizzle ORM, authentication (NextAuth/Clerk), forms (React Hook Form + Zod), internationalization, Docker, CI/CD, testing frameworks, and more
  • Implemented batch dependency installation with user confirmation
  • Added AST-based code manipulation for safer file modifications
  • Introduced comprehensive testing infrastructure with smoke and integration tests
  • Enhanced CI/CD with PR checks and improved auto-publish workflow

Reviewed changes

Copilot reviewed 27 out of 31 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
package.json Version bump to 2.0.0, ESM migration, new dependencies for CLI enhancements
tsconfig.json Updated module resolution to NodeNext for ESM support
bin/nxt-gen-cli Updated entry point with ESM import pattern
src/index.ts Expanded CLI options, added validation, improved UX with banner
src/prompts.ts New configuration options for ORM, auth, forms, testing, i18n
src/scaffold.ts Refactored scaffolding logic with batch installation and new feature setups
src/lib/* New utility modules for package management, dependency collection, AST manipulation, validation
src/templates/* New template files for auth, forms, intl, testing, docs, devops, drizzle, local-db
test/* New smoke and integration test files
.github/workflows/* Enhanced CI/CD with PR checks and improved publishing workflow
README.md Comprehensive documentation update reflecting all new features

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +19 to +20
// updateNotifier({ pkg }).notify();
console.log("CLI Starting...");
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The update notifier is commented out with a console.log left in place. Either remove the console.log debugging statement or properly implement the update notifier feature. This debug output will show to users in production.

Suggested change
// updateNotifier({ pkg }).notify();
console.log("CLI Starting...");
updateNotifier({ pkg }).notify();

Copilot uses AI. Check for mistakes.
Comment on lines +476 to +478
deps.addDevDep("prisma@dev");
deps.addDevDep("dotenv");
deps.addDep("@prisma/client@dev");
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The prisma dependency is pinned to @dev tag which is unstable. Consider using a specific stable version like "^6.0.0" or the latest stable release instead of the dev channel for production use.

Suggested change
deps.addDevDep("prisma@dev");
deps.addDevDep("dotenv");
deps.addDep("@prisma/client@dev");
deps.addDevDep("prisma@^6.0.0");
deps.addDevDep("dotenv");
deps.addDep("@prisma/client@^6.0.0");

Copilot uses AI. Check for mistakes.
Comment on lines +24 to +28
export const intlMiddleware = `import createMiddleware from 'next-intl/middleware';
export default createMiddleware({
// A list of all locales that are supported
locales: ['en', 'dk', 'de'],
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent locale codes. The middleware defines locales as ['en', 'dk', 'de'] but the config file only references 'en' and 'es'. This mismatch will cause runtime errors when users try to navigate to Danish pages.

Copilot uses AI. Check for mistakes.
import fs from "fs-extra";
import { initialPrompt } from "./prompts";

import updateNotifier from "update-notifier";
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused import updateNotifier.

Suggested change
import updateNotifier from "update-notifier";

Copilot uses AI. Check for mistakes.
Comment on lines +39 to +41
const funcDecl = sourceFile.getFunction(
exportDefault.getName() || "RootLayout"
); // Often unnamed default, need to handle that.
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused variable funcDecl.

Suggested change
const funcDecl = sourceFile.getFunction(
exportDefault.getName() || "RootLayout"
); // Often unnamed default, need to handle that.

Copilot uses AI. Check for mistakes.
pm: PackageManager,
config: ProjectConfig
): string => {
const runCmd = pm === "npm" ? "npm run" : pm;
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused variable runCmd.

Suggested change
const runCmd = pm === "npm" ? "npm run" : pm;

Copilot uses AI. Check for mistakes.
@PrabothCharith PrabothCharith merged commit fcc68b0 into main Dec 31, 2025
8 checks passed
@github-project-automation github-project-automation bot moved this from In progress to Done in nxt-gen-cli Dec 31, 2025
@PrabothCharith PrabothCharith changed the title Development Version 2.0.0 Dec 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants