-
Notifications
You must be signed in to change notification settings - Fork 0
Version 2.0.0 #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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.
…te to project during setup
…aClient configuration
…example API handlers
…risma and Drizzle)
…ct structure for Drizzle, forms, auth, i18n, DevOps, testing, and code quality.
…date package version and test scripts.
There was a problem hiding this 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.
| // updateNotifier({ pkg }).notify(); | ||
| console.log("CLI Starting..."); |
Copilot
AI
Dec 31, 2025
There was a problem hiding this comment.
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.
| // updateNotifier({ pkg }).notify(); | |
| console.log("CLI Starting..."); | |
| updateNotifier({ pkg }).notify(); |
| deps.addDevDep("prisma@dev"); | ||
| deps.addDevDep("dotenv"); | ||
| deps.addDep("@prisma/client@dev"); |
Copilot
AI
Dec 31, 2025
There was a problem hiding this comment.
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.
| 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"); |
| export const intlMiddleware = `import createMiddleware from 'next-intl/middleware'; | ||
| export default createMiddleware({ | ||
| // A list of all locales that are supported | ||
| locales: ['en', 'dk', 'de'], |
Copilot
AI
Dec 31, 2025
There was a problem hiding this comment.
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.
| import fs from "fs-extra"; | ||
| import { initialPrompt } from "./prompts"; | ||
|
|
||
| import updateNotifier from "update-notifier"; |
Copilot
AI
Dec 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused import updateNotifier.
| import updateNotifier from "update-notifier"; |
| const funcDecl = sourceFile.getFunction( | ||
| exportDefault.getName() || "RootLayout" | ||
| ); // Often unnamed default, need to handle that. |
Copilot
AI
Dec 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused variable funcDecl.
| const funcDecl = sourceFile.getFunction( | |
| exportDefault.getName() || "RootLayout" | |
| ); // Often unnamed default, need to handle that. |
| pm: PackageManager, | ||
| config: ProjectConfig | ||
| ): string => { | ||
| const runCmd = pm === "npm" ? "npm run" : pm; |
Copilot
AI
Dec 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused variable runCmd.
| const runCmd = pm === "npm" ? "npm run" : pm; |
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
--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
README.mdto 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
pr-checks.ymlworkflow for PR validation (build & smoke tests) and enhanced theauto-publish.ymlworkflow 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
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
package.json,Features Checklist & Roadmap.md) [1] [2]