(projectPath: string)
| 662 | } |
| 663 | |
| 664 | private async readWorkspaceBranchMap(projectPath: string): Promise<Record<string, string>> { |
| 665 | try { |
| 666 | const contents = await fsPromises.readFile( |
| 667 | await this.getWorkspaceBranchMapPath(projectPath), |
| 668 | "utf8" |
| 669 | ); |
| 670 | const parsed: unknown = JSON.parse(contents); |
| 671 | if (typeof parsed !== "object" || parsed === null) { |
| 672 | return {}; |
| 673 | } |
| 674 | return Object.fromEntries( |
| 675 | Object.entries(parsed).filter(([workspaceName, branchName]) => { |
| 676 | return ( |
| 677 | workspaceName.trim().length > 0 && |
| 678 | typeof branchName === "string" && |
| 679 | branchName.trim().length > 0 |
| 680 | ); |
| 681 | }) |
| 682 | ); |
| 683 | } catch { |
| 684 | return {}; |
| 685 | } |
| 686 | } |
| 687 | |
| 688 | private async writeWorkspaceBranchMap( |
| 689 | projectPath: string, |
no test coverage detected