@@ -5,16 +5,16 @@ import path from 'node:path';
55const plugin : CliPlugin = {
66 name : 'Prisma Schema Generator' ,
77 statusText : 'Generating Prisma schema' ,
8- async generate ( { model, defaultOutputPath, pluginOptions } ) {
9- let outDir = defaultOutputPath ;
8+ async generate ( { model, schemaFile , defaultOutputPath, pluginOptions } ) {
9+ let outFile = path . join ( defaultOutputPath , 'schema.prisma' ) ;
1010 if ( typeof pluginOptions [ 'output' ] === 'string' ) {
11- outDir = path . resolve ( defaultOutputPath , pluginOptions [ 'output' ] ) ;
12- if ( ! fs . existsSync ( outDir ) ) {
13- fs . mkdirSync ( outDir , { recursive : true } ) ;
11+ outFile = path . resolve ( path . dirname ( schemaFile ) , pluginOptions [ 'output' ] ) ;
12+ if ( ! fs . existsSync ( path . dirname ( outFile ) ) ) {
13+ fs . mkdirSync ( path . dirname ( outFile ) , { recursive : true } ) ;
1414 }
1515 }
1616 const prismaSchema = await new PrismaSchemaGenerator ( model ) . generate ( ) ;
17- fs . writeFileSync ( path . join ( outDir , 'schema.prisma' ) , prismaSchema ) ;
17+ fs . writeFileSync ( outFile , prismaSchema ) ;
1818 } ,
1919} ;
2020
0 commit comments