| 627 | } |
| 628 | |
| 629 | function emitPatch(state: State): void { |
| 630 | const file = path.join(process.cwd(), "src", "demo-format.ts") |
| 631 | const ref = make(state, "apply_patch", { |
| 632 | patchText: "*** Begin Patch\n*** End Patch", |
| 633 | }) |
| 634 | doneTool(state, ref, { |
| 635 | title: "apply_patch", |
| 636 | output: "", |
| 637 | metadata: { |
| 638 | files: [ |
| 639 | { |
| 640 | type: "update", |
| 641 | filePath: file, |
| 642 | relativePath: "src/demo-format.ts", |
| 643 | diff: "@@ -1 +1 @@\n-export const demo = 1\n+export const demo = 42\n", |
| 644 | deletions: 1, |
| 645 | }, |
| 646 | { |
| 647 | type: "add", |
| 648 | filePath: path.join(process.cwd(), "README-demo.md"), |
| 649 | relativePath: "README-demo.md", |
| 650 | diff: "@@ -0,0 +1,4 @@\n+# Demo\n+This is a generated preview file.\n", |
| 651 | deletions: 0, |
| 652 | }, |
| 653 | ], |
| 654 | }, |
| 655 | }) |
| 656 | } |
| 657 | |
| 658 | function emitTask(state: State): void { |
| 659 | const ref = make(state, "task", { |