@@ -114,21 +114,18 @@ export class EnhancerGenerator {
114
114
115
115
if ( this . needsLogicalClient ) {
116
116
prismaTypesFixed = true ;
117
- resultPrismaTypeImport = `${ LOGICAL_CLIENT_GENERATION_PATH } /index-fixed ` ;
117
+ resultPrismaTypeImport = `${ LOGICAL_CLIENT_GENERATION_PATH } /index` ;
118
118
const result = await this . generateLogicalPrisma ( ) ;
119
119
dmmf = result . dmmf ;
120
120
}
121
121
122
122
// reexport PrismaClient types (original or fixed)
123
- const modelsDts = this . project . createSourceFile (
124
- path . join ( this . outDir , 'models.d. ts' ) ,
123
+ const modelsTs = this . project . createSourceFile (
124
+ path . join ( this . outDir , 'models.ts' ) ,
125
125
`export * from '${ resultPrismaTypeImport } ';` ,
126
126
{ overwrite : true }
127
127
) ;
128
- await modelsDts . save ( ) ;
129
-
130
- // reexport values from the original PrismaClient (enums, etc.)
131
- fs . writeFileSync ( path . join ( this . outDir , 'models.js' ) , `module.exports = require('${ prismaImport } ');` ) ;
128
+ await modelsTs . save ( ) ;
132
129
133
130
const authDecl = getAuthDecl ( getDataModelAndTypeDefs ( this . model ) ) ;
134
131
const authTypes = authDecl ? generateAuthType ( this . model , authDecl ) : '' ;
177
174
return {
178
175
dmmf,
179
176
newPrismaClientDtsPath : prismaTypesFixed
180
- ? path . resolve ( this . outDir , LOGICAL_CLIENT_GENERATION_PATH , 'index-fixed .d.ts' )
177
+ ? path . resolve ( this . outDir , LOGICAL_CLIENT_GENERATION_PATH , 'index.d.ts' )
181
178
: undefined ,
182
179
} ;
183
180
}
@@ -457,7 +454,7 @@ export type Enhanced<Client> =
457
454
}
458
455
459
456
private async processClientTypes ( prismaClientDir : string ) {
460
- // make necessary updates to the generated `index.d.ts` file and save it as `index-fixed.d.ts`
457
+ // make necessary updates to the generated `index.d.ts` file and overwrite it
461
458
const project = new Project ( ) ;
462
459
const sf = project . addSourceFileAtPath ( path . join ( prismaClientDir , 'index.d.ts' ) ) ;
463
460
@@ -474,7 +471,7 @@ export type Enhanced<Client> =
474
471
475
472
// transform index.d.ts and save it into a new file (better perf than in-line editing)
476
473
477
- const sfNew = project . createSourceFile ( path . join ( prismaClientDir , 'index-fixed .d.ts' ) , undefined , {
474
+ const sfNew = project . createSourceFile ( path . join ( prismaClientDir , 'index.d.ts' ) , undefined , {
478
475
overwrite : true ,
479
476
} ) ;
480
477
0 commit comments