| 143 | }; |
| 144 | |
| 145 | const packWrapperPackage = async (): Promise<string> => { |
| 146 | if (!existsSync(wrapperDir)) { |
| 147 | throw new Error(`Wrapper package directory not found: ${wrapperDir}`); |
| 148 | } |
| 149 | |
| 150 | await mkdir(releaseDir, { recursive: true }); |
| 151 | |
| 152 | const before = new Set((await readdir(wrapperDir)).filter((entry) => entry.endsWith(".tgz"))); |
| 153 | await runCommand({ |
| 154 | command: "bun", |
| 155 | args: ["pm", "pack"], |
| 156 | cwd: wrapperDir, |
| 157 | }); |
| 158 | |
| 159 | const after = (await readdir(wrapperDir)).filter((entry) => entry.endsWith(".tgz")); |
| 160 | const archiveName = after.find((entry) => !before.has(entry)) ?? after[0]; |
| 161 | |
| 162 | if (!archiveName) { |
| 163 | throw new Error(`bun pm pack did not create a .tgz archive in ${wrapperDir}`); |
| 164 | } |
| 165 | |
| 166 | const sourcePath = join(wrapperDir, archiveName); |
| 167 | const destinationPath = join(releaseDir, archiveName); |
| 168 | |
| 169 | await rm(destinationPath, { force: true }); |
| 170 | await rename(sourcePath, destinationPath); |
| 171 | |
| 172 | return destinationPath; |
| 173 | }; |
| 174 | |
| 175 | const collectReleaseAssetPaths = async ( |
| 176 | wrapperArchivePath: string, |