Skip to content

Commit

Permalink
feat: add generator flag support to specify generator
Browse files Browse the repository at this point in the history
  • Loading branch information
satya-nutella committed Jan 4, 2024
1 parent 1474283 commit d3d8736
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/nx-prisma/src/executors/generate/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,18 @@ export default async function run(options: GenerateExecutorSchema, ctx: Executor
const getArgs = (options: GenerateExecutorSchema, ctx: ExecutorContext): string[] => {
const args = [];
const schema = options?.schema ?? getDefaultScheme(ctx);
const generator = options?.generator;

args.push(`--schema=${schema}`);

if (options?.['data-proxy']) {
args.push('--data-proxy');
}

if (generator) {
args.push('--generator=${generator}');
}

if (options?.watch) {
args.push('--watch');
}
Expand Down
4 changes: 4 additions & 0 deletions packages/nx-prisma/src/executors/generate/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ export interface GenerateExecutorSchema extends PrismaBase {
* The generate command will generate Prisma Client for use with the Data Proxy.
*/
'data-proxy'?: boolean;
/**
* Specifies the generator to use
*/
generator?: string;
/**
* The generate command will continue to watch the schema.prisma file and re-generate Prisma Client on file changes.
*/
Expand Down
4 changes: 4 additions & 0 deletions packages/nx-prisma/src/executors/generate/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
"description": "The generate command generates assets like Prisma Client based on the generator and data model blocks defined in your schema.prisma file.",
"type": "object",
"properties": {
"generator": {
"type": "string",
"description": "Specifies the generator to use."
},
"schema": {
"type": "string",
"description": "Specifies the path to the desired schema.prisma file to be processed instead of the default path. Both absolute and relative paths are supported."
Expand Down

0 comments on commit d3d8736

Please sign in to comment.