@@ -354,7 +354,7 @@ describe("updateLocalFiles", () => {
354
354
} ) ;
355
355
mockReplaceInFile . mockResolvedValue ( [ ] ) ;
356
356
357
- await updateLocalFiles ( options ) ;
357
+ await updateLocalFiles ( options , { resetPackageVersion : true } ) ;
358
358
359
359
expect ( mockReplaceInFile . mock . calls ) . toMatchInlineSnapshot ( `
360
360
[
@@ -508,4 +508,158 @@ describe("updateLocalFiles", () => {
508
508
]
509
509
` ) ;
510
510
} ) ;
511
+ it ( "does not overwrite package version when resetPackageVersion parameter is not set" , async ( ) => {
512
+ mockReadFileSafeAsJson . mockResolvedValue ( {
513
+ description : "Existing description" ,
514
+ version : "1.2.3" ,
515
+ } ) ;
516
+ mockReplaceInFile . mockResolvedValue ( [ ] ) ;
517
+
518
+ await updateLocalFiles ( options ) ;
519
+
520
+ expect ( mockReplaceInFile . mock . calls ) . toMatchInlineSnapshot ( `
521
+ [
522
+ [
523
+ {
524
+ "files": [
525
+ "./.github/**/*",
526
+ "./*.*",
527
+ ],
528
+ "from": /Create TypeScript App/g,
529
+ "to": "Stub Title",
530
+ },
531
+ ],
532
+ [
533
+ {
534
+ "files": [
535
+ "./.github/**/*",
536
+ "./*.*",
537
+ ],
538
+ "from": /JoshuaKGoldberg\\(\\?!\\\\/console-fail-test\\)/g,
539
+ "to": "StubOwner",
540
+ },
541
+ ],
542
+ [
543
+ {
544
+ "files": [
545
+ "./.github/**/*",
546
+ "./*.*",
547
+ ],
548
+ "from": /create-typescript-app/g,
549
+ "to": "stub-repository",
550
+ },
551
+ ],
552
+ [
553
+ {
554
+ "files": ".eslintrc.cjs",
555
+ "from": /\\\\/\\\\\\*\\\\n\\.\\+\\\\\\*\\\\/\\\\n\\\\n/gs,
556
+ "to": "",
557
+ },
558
+ ],
559
+ [
560
+ {
561
+ "files": "./package.json",
562
+ "from": /"author": "\\.\\+"/g,
563
+ "to": "\\"author\\": \\"undefined\\"",
564
+ },
565
+ ],
566
+ [
567
+ {
568
+ "files": "./package.json",
569
+ "from": /"bin": "\\.\\+\\\\n/g,
570
+ "to": "",
571
+ },
572
+ ],
573
+ [
574
+ {
575
+ "files": "./package.json",
576
+ "from": /"test:create": "\\.\\+\\\\n/g,
577
+ "to": "",
578
+ },
579
+ ],
580
+ [
581
+ {
582
+ "files": "./package.json",
583
+ "from": /"test:initialize": "\\.\\*/g,
584
+ "to": "",
585
+ },
586
+ ],
587
+ [
588
+ {
589
+ "files": "./package.json",
590
+ "from": /"initialize": "\\.\\*/g,
591
+ "to": "",
592
+ },
593
+ ],
594
+ [
595
+ {
596
+ "files": "./package.json",
597
+ "from": /"test:migrate": "\\.\\+\\\\n/g,
598
+ "to": "",
599
+ },
600
+ ],
601
+ [
602
+ {
603
+ "files": "./README.md",
604
+ "from": /## Getting Started\\.\\*## Development/gs,
605
+ "to": "## Development",
606
+ },
607
+ ],
608
+ [
609
+ {
610
+ "files": "./.github/DEVELOPMENT.md",
611
+ "from": /\\\\n## Setup Scripts\\.\\*\\$/gs,
612
+ "to": "",
613
+ },
614
+ ],
615
+ [
616
+ {
617
+ "files": "./knip.jsonc",
618
+ "from": " \\"src/initialize/index.ts\\",
619
+ ",
620
+ "to": "",
621
+ },
622
+ ],
623
+ [
624
+ {
625
+ "files": "./knip.jsonc",
626
+ "from": " \\"src/migrate/index.ts\\",
627
+ ",
628
+ "to": "",
629
+ },
630
+ ],
631
+ [
632
+ {
633
+ "files": "./knip.jsonc",
634
+ "from": "[\\"src/index.ts!\\", \\"script/initialize*.js\\"]",
635
+ "to": "\\"src/index.ts!\\"",
636
+ },
637
+ ],
638
+ [
639
+ {
640
+ "files": "./knip.jsonc",
641
+ "from": "[\\"src/**/*.ts!\\", \\"script/**/*.js\\"]",
642
+ "to": "\\"src/**/*.ts!\\"",
643
+ },
644
+ ],
645
+ [
646
+ {
647
+ "files": "./README.md",
648
+ "from": "> 💙 This package is based on [@StubOwner](https://github.com/StubOwner)'s [stub-repository](https://github.com/JoshuaKGoldberg/stub-repository).",
649
+ "to": "> 💙 This package is based on [@JoshuaKGoldberg](https://github.com/JoshuaKGoldberg)'s [create-typescript-app](https://github.com/JoshuaKGoldberg/create-typescript-app).",
650
+ },
651
+ ],
652
+ [
653
+ {
654
+ "files": [
655
+ "./.github/**/*",
656
+ "./*.*",
657
+ ],
658
+ "from": /Existing description/g,
659
+ "to": "Stub description.",
660
+ },
661
+ ],
662
+ ]
663
+ ` ) ;
664
+ } ) ;
511
665
} ) ;
0 commit comments