@gylove1994/npg
v0.4.3
Published
A command-line tool for generating NestJS code form schema.prisma file.
Downloads
4
Maintainers
Readme
NestJS Prisma Generator
Project Overview
NestJS Prisma Generator is a command-line tool for generating NestJS and Prisma code.
Features
- 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)
Installation
npm install @gylove1994/npg -g
Usage
Generating Code
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.
Command Line Options
wip
Project Structure
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.
Development
Local Development
npm run dev
Build
npm run build
Code Linting
npm run lint
License
Author
gylove1994
Contribution Guidelines
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