()
| 174 | } |
| 175 | |
| 176 | async function main() { |
| 177 | try { |
| 178 | const { changelog, out, packageName, version } = parseArgs(process.argv.slice(2)); |
| 179 | const changelogContent = await readFile(changelog, 'utf8').catch(() => { |
| 180 | throw new Error(`Could not read CHANGELOG.md at ${changelog}`); |
| 181 | }); |
| 182 | |
| 183 | const section = extractChangelogSection(changelogContent, version); |
| 184 | const body = buildReleaseBody(version, section, packageName); |
| 185 | |
| 186 | if (out) { |
| 187 | await writeFile(out, body, 'utf8'); |
| 188 | return; |
| 189 | } |
| 190 | |
| 191 | process.stdout.write(body); |
| 192 | } catch (error) { |
| 193 | const message = error instanceof Error ? error.message : String(error); |
| 194 | process.stderr.write(`❌ ${message}\n`); |
| 195 | process.exit(1); |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | await main(); |
no test coverage detected