@@ -129,13 +129,19 @@ export class EnhancerGenerator {
129129 }
130130
131131 // `models.ts` for exporting model types
132- const modelsTsContent = [
133- `export * from '${ resultPrismaBaseImport } /models';` ,
134- `export * from './json-types';` ,
135- ] . join ( '\n' ) ;
136- const modelsTs = this . project . createSourceFile ( path . join ( this . outDir , 'models.ts' ) , modelsTsContent , {
137- overwrite : true ,
138- } ) ;
132+
133+ const modelsTsContent = [ `export * from '${ resultPrismaBaseImport } /models';` ] ;
134+ if ( this . model . declarations . some ( ( d ) => isTypeDef ( d ) ) ) {
135+ modelsTsContent . push ( `export * from './json-types';` ) ;
136+ }
137+
138+ const modelsTs = this . project . createSourceFile (
139+ path . join ( this . outDir , 'models.ts' ) ,
140+ modelsTsContent . join ( '\n' ) ,
141+ {
142+ overwrite : true ,
143+ }
144+ ) ;
139145 this . saveSourceFile ( modelsTs ) ;
140146
141147 // `enums.ts` for exporting enums
@@ -159,7 +165,8 @@ export class EnhancerGenerator {
159165 this . saveSourceFile ( clientTs ) ;
160166
161167 // `enhance.ts` and `enhance-edge.ts`
162- for ( const target of [ 'node' , 'edge' ] as const ) {
168+ const targets = this . isNewPrismaClientGenerator ? ( [ 'node' ] as const ) : ( [ 'node' , 'edge' ] as const ) ;
169+ for ( const target of targets ) {
163170 this . generateEnhance ( prismaImport , `${ resultPrismaBaseImport } /client` , needsLogicalClient , target ) ;
164171 }
165172
@@ -596,12 +603,13 @@ export type Enhanced<Client> =
596603 fs . renameSync ( internalFilenameFixed , internalFilename ) ;
597604
598605 // Create a shared file for all JSON fields type definitions
599- const jsonFieldsFile = project . createSourceFile ( path . join ( this . outDir , 'json-types.ts' ) , undefined , {
600- overwrite : true ,
601- } ) ;
602-
603- this . generateExtraTypes ( jsonFieldsFile ) ;
604- await saveSourceFile ( jsonFieldsFile ) ;
606+ if ( this . model . declarations . some ( isTypeDef ) ) {
607+ const jsonFieldsFile = project . createSourceFile ( path . join ( this . outDir , 'json-types.ts' ) , undefined , {
608+ overwrite : true ,
609+ } ) ;
610+ this . generateExtraTypes ( jsonFieldsFile ) ;
611+ await saveSourceFile ( jsonFieldsFile ) ;
612+ }
605613
606614 for ( const d of this . model . declarations . filter ( isDataModel ) ) {
607615 const fileName = `${ prismaClientDir } /models/${ d . name } .ts` ;
0 commit comments