@@ -259,7 +259,7 @@ export async function doFinalComponentCodegen(
259
259
serverContents ,
260
260
"typescript" ,
261
261
serverDTSPath ,
262
- opts ,
262
+ { prettierIgnore : true , ... opts } ,
263
263
) ;
264
264
265
265
const apiDTSPath = path . join ( codegenDir , "api.d.ts" ) ;
@@ -269,14 +269,10 @@ export async function doFinalComponentCodegen(
269
269
rootComponent ,
270
270
componentDirectory ,
271
271
) ;
272
- await writeFormattedFile (
273
- ctx ,
274
- tmpDir ,
275
- apiContents ,
276
- "typescript" ,
277
- apiDTSPath ,
278
- opts ,
279
- ) ;
272
+ await writeFormattedFile ( ctx , tmpDir , apiContents , "typescript" , apiDTSPath , {
273
+ prettierIgnore : true ,
274
+ ...opts ,
275
+ } ) ;
280
276
281
277
if ( opts ?. generateCommonJSApi || projectConfig . generateCommonJSApi ) {
282
278
const apiCjsDTSPath = path . join ( codegenDir , "api_cjs.d.ts" ) ;
@@ -286,7 +282,7 @@ export async function doFinalComponentCodegen(
286
282
apiContents ,
287
283
"typescript" ,
288
284
apiCjsDTSPath ,
289
- opts ,
285
+ { prettierIgnore : true , ... opts } ,
290
286
) ;
291
287
}
292
288
}
@@ -356,7 +352,7 @@ async function doDataModelCodegen(
356
352
schemaContent . DTS ,
357
353
"typescript" ,
358
354
path . join ( codegenDir , "dataModel.d.ts" ) ,
359
- opts ,
355
+ { prettierIgnore : true , ... opts } ,
360
356
) ;
361
357
return [ "dataModel.d.ts" ] ;
362
358
}
@@ -374,7 +370,7 @@ async function doServerCodegen(
374
370
serverContent . JS ,
375
371
"typescript" ,
376
372
path . join ( codegenDir , "server.js" ) ,
377
- opts ,
373
+ { prettierIgnore : true , ... opts } ,
378
374
) ;
379
375
380
376
await writeFormattedFile (
@@ -383,7 +379,7 @@ async function doServerCodegen(
383
379
serverContent . DTS ,
384
380
"typescript" ,
385
381
path . join ( codegenDir , "server.d.ts" ) ,
386
- opts ,
382
+ { prettierIgnore : true , ... opts } ,
387
383
) ;
388
384
389
385
return [ "server.js" , "server.d.ts" ] ;
@@ -402,7 +398,7 @@ async function doInitialComponentServerCodegen(
402
398
componentServerJS ( ) ,
403
399
"typescript" ,
404
400
path . join ( codegenDir , "server.js" ) ,
405
- opts ,
401
+ { prettierIgnore : true , ... opts } ,
406
402
) ;
407
403
408
404
// Don't write our stub if the file already exists: It probably
@@ -415,7 +411,7 @@ async function doInitialComponentServerCodegen(
415
411
componentServerStubDTS ( isRoot ) ,
416
412
"typescript" ,
417
413
path . join ( codegenDir , "server.d.ts" ) ,
418
- opts ,
414
+ { prettierIgnore : true , ... opts } ,
419
415
) ;
420
416
}
421
417
@@ -437,7 +433,7 @@ async function doInitialComponentApiCodegen(
437
433
apiJS ,
438
434
"typescript" ,
439
435
path . join ( codegenDir , "api.js" ) ,
440
- opts ,
436
+ { prettierIgnore : true , ... opts } ,
441
437
) ;
442
438
443
439
// Don't write the `.d.ts` stub if it already exists.
@@ -450,7 +446,7 @@ async function doInitialComponentApiCodegen(
450
446
apiStubDTS ,
451
447
"typescript" ,
452
448
apiDTSPath ,
453
- opts ,
449
+ { prettierIgnore : true , ... opts } ,
454
450
) ;
455
451
}
456
452
@@ -464,7 +460,7 @@ async function doInitialComponentApiCodegen(
464
460
apiCjsJS ,
465
461
"typescript" ,
466
462
path . join ( codegenDir , "api_cjs.cjs" ) ,
467
- opts ,
463
+ { prettierIgnore : true , ... opts } ,
468
464
) ;
469
465
470
466
const cjsStubPath = path . join ( codegenDir , "api_cjs.d.cts" ) ;
@@ -475,7 +471,7 @@ async function doInitialComponentApiCodegen(
475
471
apiStubDTS ,
476
472
"typescript" ,
477
473
cjsStubPath ,
478
- opts ,
474
+ { prettierIgnore : true , ... opts } ,
479
475
) ;
480
476
}
481
477
writtenFiles . push ( "api_cjs.cjs" , "api_cjs.d.cts" ) ;
@@ -502,15 +498,15 @@ async function doApiCodegen(
502
498
apiContent . JS ,
503
499
"typescript" ,
504
500
path . join ( codegenDir , "api.js" ) ,
505
- opts ,
501
+ { prettierIgnore : true , ... opts } ,
506
502
) ;
507
503
await writeFormattedFile (
508
504
ctx ,
509
505
tmpDir ,
510
506
apiContent . DTS ,
511
507
"typescript" ,
512
508
path . join ( codegenDir , "api.d.ts" ) ,
513
- opts ,
509
+ { prettierIgnore : true , ... opts } ,
514
510
) ;
515
511
const writtenFiles = [ "api.js" , "api.d.ts" ] ;
516
512
@@ -522,15 +518,15 @@ async function doApiCodegen(
522
518
apiCjsContent . JS ,
523
519
"typescript" ,
524
520
path . join ( codegenDir , "api_cjs.cjs" ) ,
525
- opts ,
521
+ { prettierIgnore : true , ... opts } ,
526
522
) ;
527
523
await writeFormattedFile (
528
524
ctx ,
529
525
tmpDir ,
530
526
apiCjsContent . DTS ,
531
527
"typescript" ,
532
528
path . join ( codegenDir , "api_cjs.d.cts" ) ,
533
- opts ,
529
+ { prettierIgnore : true , ... opts } ,
534
530
) ;
535
531
writtenFiles . push ( "api_cjs.cjs" , "api_cjs.d.cts" ) ;
536
532
}
@@ -547,6 +543,7 @@ async function writeFormattedFile(
547
543
options ?: {
548
544
dryRun ?: boolean ;
549
545
debug ?: boolean ;
546
+ prettierIgnore ?: boolean ;
550
547
} ,
551
548
) {
552
549
// Run prettier so we don't have to think about formatting!
@@ -558,11 +555,13 @@ async function writeFormattedFile(
558
555
pluginSearchDirs : false ,
559
556
} ) ;
560
557
// Then add prettierignore comments so we don't fight with users' prettier configs
561
- formattedContents = `/* prettier-ignore-start */
558
+ if ( options ?. prettierIgnore ) {
559
+ formattedContents = `/* prettier-ignore-start */
562
560
563
561
${ formattedContents }
564
562
/* prettier-ignore-end */
565
563
` ;
564
+ }
566
565
if ( options ?. debug ) {
567
566
// NB: The `test_codegen_projects_are_up_to_date` smoke test depends
568
567
// on this output format.
0 commit comments