Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/oliwierptak/prisma-generator-builder
Creates ready to run latest prisma generator. Together with pre-configured packages, and pluggable architecture, it creates project ready for prisma generator development.
https://github.com/oliwierptak/prisma-generator-builder
generator prisma-generator prisma-orm prisma4 typescript
Last synced: 2 days ago
JSON representation
Creates ready to run latest prisma generator. Together with pre-configured packages, and pluggable architecture, it creates project ready for prisma generator development.
- Host: GitHub
- URL: https://github.com/oliwierptak/prisma-generator-builder
- Owner: oliwierptak
- License: mit
- Created: 2023-07-02T14:50:11.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-02T09:42:51.000Z (about 1 year ago)
- Last Synced: 2024-12-12T02:19:33.304Z (30 days ago)
- Topics: generator, prisma-generator, prisma-orm, prisma4, typescript
- Language: TypeScript
- Homepage:
- Size: 1.19 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# prisma-generator-builder
Creates ready to run latest `prisma generator`.
Together with pre-configured packages, and pluggable architecture,
it creates project ready for prisma generator development.### Preconfigured packages
- typescript
- prisma
- eslint
- prettier
- jest### Pluggable architecture
Read more about [plugins here](README_PLUGINS.md).
## Installation
Install as dev dependency:
```
npm install prisma-generator-builder -D
```## Usage
Run the builder to get started.
```
npx prisma-generator-builder
```Switch to the output directory and run
```
npm install
npx prisma generate
```That's it.
## Requirements
Prisma ORM `version 5.x.x`.
## Custom Builder Development
### Project structure
```
└──src
├── bin.ts
└── generator
├── helper
├ ├── helper.file-writer.test.ts
├ ├── helper.file-writer.ts
├ ├── helper.hello-world.test.ts
├ ├── helper.hello-world.ts
└── builder.ts
├── package.json
...
└── README.md
```### Helpers
#### HelloWorld Helper
The generator uses very basic `HelloWorld` helper example.
However, thanks to this separation, prisma and custom generator
logic are not mixed together.To see the example check [builder.ts](src/generator/generator.ts).
#### FileWriter Helper
Handles file writing.
`saveFile()` - saves any file
```typescript
FileWriter.saveFile("foo.txt", `foo`);
````saveTypescriptFile()` - saves and formats typescript file
```typescript
FileWriter.saveTypescriptFile("foo.ts", `const foo="foo"; console.log(foo);`);
```### Tests
Generated package comes together with pre-configured `jest`.
`npx jest`