| 118 | }; |
| 119 | |
| 120 | const packWrapperPackage = async (): Promise<string> => { |
| 121 | if (!existsSync(wrapperDir)) { |
| 122 | throw new Error(`Wrapper package directory not found: ${wrapperDir}`); |
| 123 | } |
| 124 | |
| 125 | await mkdir(releaseDir, { recursive: true }); |
| 126 | |
| 127 | const before = new Set((await readdir(wrapperDir)).filter((entry) => entry.endsWith(".tgz"))); |
| 128 | await runCommand({ |
| 129 | command: "bun", |
| 130 | args: ["pm", "pack"], |
| 131 | cwd: wrapperDir, |
| 132 | }); |
| 133 | |
| 134 | const after = (await readdir(wrapperDir)).filter((entry) => entry.endsWith(".tgz")); |
| 135 | const archiveName = after.find((entry) => !before.has(entry)) ?? after[0]; |
| 136 | |
| 137 | if (!archiveName) { |
| 138 | throw new Error(`bun pm pack did not create a .tgz archive in ${wrapperDir}`); |
| 139 | } |
| 140 | |
| 141 | const sourcePath = join(wrapperDir, archiveName); |
| 142 | const destinationPath = join(releaseDir, archiveName); |
| 143 | |
| 144 | await rm(destinationPath, { force: true }); |
| 145 | await rename(sourcePath, destinationPath); |
| 146 | |
| 147 | return destinationPath; |
| 148 | }; |
| 149 | |
| 150 | const collectReleaseAssetPaths = async ( |
| 151 | wrapperArchivePath: string, |