GithubHelp home page GithubHelp logo

oliwierptak / prisma-generator-builder Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 1.22 MB

Creates ready to run latest prisma generator. Together with pre-configured packages, and pluggable architecture, it creates project ready for prisma generator development.

License: MIT License

JavaScript 26.36% TypeScript 73.64%
generator prisma-generator prisma-orm prisma4 typescript

prisma-generator-builder's Introduction

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.

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

<project root>
└──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.

FileWriter Helper

Handles file writing.

saveFile() - saves any file

FileWriter.saveFile("foo.txt", `foo`);

saveTypescriptFile() - saves and formats typescript file

FileWriter.saveTypescriptFile("foo.ts", `const foo="foo"; console.log(foo);`);

Tests

Generated package comes together with pre-configured jest.

npx jest

prisma-generator-builder's People

Contributors

oliwierptak avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.