0.2.0 • Published 3 months ago

prisma-frontend v0.2.0

Weekly downloads
-
License
(MIT or CC0 1.0)
Repository
github
Last release
3 months ago

prisma-frontend

A Prisma generator for creating frontend-friendly exports (types and enums).

  • Generated outputs can be used just as easily in the backend or frontend, unifying the import source of your model types and enums.
  • Generated outputs are in ESM format.
  • This is experimental. Please open bug tickets in GitHub.

Install

npm i -D prisma-frontend

Usage

Prisma Schema

Insert this as a generator in your Prisma schema file:

// the standard client generator
generator jsClient {
    provider = "prisma-client-js"
}

// this package's generator
generator jsFrontend {
    provider = "prisma-frontend"
}

This generator requires the prisma-client-js generator to be used as well (as shown above).

Imports

Import model types and enums from prisma-frontend:

import {type User, AuthRole} from 'prisma-frontend';

export function authenticateAdmin(user: Partial<User>): boolean {
    return user.authRole === AuthRole.Admin;
}
0.2.0

3 months ago

0.1.6

4 months ago

0.1.5

7 months ago

0.1.0

10 months ago

0.1.2

9 months ago

0.1.1

9 months ago

0.1.4

9 months ago

0.1.3

9 months ago

0.0.13

10 months ago

0.0.12

10 months ago

0.0.11

10 months ago

0.0.10

10 months ago

0.0.9

10 months ago

0.0.8

10 months ago

0.0.7

10 months ago

0.0.6

10 months ago

0.0.5

10 months ago

0.0.4

10 months ago

0.0.3

10 months ago

0.0.2

10 months ago

0.0.1

10 months ago

0.0.0

10 months ago