zenstackhq / zenstack

Fullstack TypeScript toolkit that enhances Prisma ORM with flexible Authorization layer for RBAC/ABAC/PBAC/ReBAC, offering auto-generated type-safe APIs and frontend hooks.
https://zenstack.dev
MIT License
2.07k stars 88 forks source link

Monorepo generated client support #602

Closed matijaboban closed 7 months ago

matijaboban commented 1 year ago

Is your feature request related to a problem? Please describe. Currently, the zenstack client gets generated in node_modules/.zenstack folder. While that's fine for single-repo projects, it fails in a mono-repo environment with multiple zenstack projects.

Describe the solution you'd like A custom output path similar to Prisma client generator (https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#generator)

Describe alternatives you've considered Manual moving the generated files into an appropriate location will not work in the current configuration as the generated files are not standalone.

Additional context n/a

jiashengguo commented 1 year ago

@matijaboban Actually you can specify the custom output path for the access policy plugin as below:

plugin zod {
  provider = '@core/access-policy'
  output = 'src/lib/zenstack'
  compile = false
}

See more detail on the below page: https://zenstack.dev/docs/reference/plugins/access-policy

Let me know if it could solve your problem in mono-repo.

ymc9 commented 1 year ago

There're a number of built-in plugins that by default output to ".zenstack". Maybe we should add a CLI option to override the global default location? What do you think @matijaboban @jiashengguo ?

ymc9 commented 7 months ago

CLI already has a "--output" option to globally control output dir. Closing.