NestJS Prisma Generator is a command-line tool for generating NestJS and Prisma code.
- Automatically generate Entity code, synchronized with Prisma models
- Generate Enum code to ensure type safety
- Create complete Module structures, including controllers, services, and DTOs
- Support generating all types of code to meet different development needs
- Generate code structures that comply with my own best practices(This is an opinionated tool)
- Support custom templates for flexible adaptation to project requirements (TBD)
npm install @gylove1994/npg -g
You can use the following command to generate code:
npg
Follow the prompts to select the type of code you want to generate, the path to your Prisma schema file, and the output directory.
wip
src/index.ts
- Main entry file, defines the core logic of the command-line toolsrc/generateEntity.ts
- Module responsible for generating entity codesrc/generateEnum.ts
- Handles the logic for generating enum codesrc/generateNestModule.ts
- Core code for generating NestJS module structuressrc/generateNestController.ts
- Module for creating controller codesrc/generateNestDto.ts
- Logic for generating Data Transfer Objects (DTOs)src/utils
- Utility functions, including file operations, type mapping, etc.
npm run dev
npm run build
npm run lint
gylove1994
We welcome and appreciate any form of contribution! If you want to contribute to the project, please follow these steps:
- Fork this repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request