( rootDir: string, filename: string, releases: BumpFileRelease[], summary: string, )
| 231 | |
| 232 | /** Write a bump file */ |
| 233 | export async function writeBumpFile( |
| 234 | rootDir: string, |
| 235 | filename: string, |
| 236 | releases: BumpFileRelease[], |
| 237 | summary: string, |
| 238 | ): Promise<string> { |
| 239 | const dir = getBumpyDir(rootDir); |
| 240 | const filePath = resolve(dir, `${filename}.md`); |
| 241 | |
| 242 | // Build frontmatter object |
| 243 | const frontmatter: Record<string, unknown> = {}; |
| 244 | for (const release of releases) { |
| 245 | if ('cascade' in release && Object.keys(release.cascade).length > 0) { |
| 246 | frontmatter[release.name] = { bump: release.type, cascade: release.cascade }; |
| 247 | } else { |
| 248 | frontmatter[release.name] = release.type; |
| 249 | } |
| 250 | } |
| 251 | |
| 252 | const yamlStr = yaml.dump(frontmatter, { lineWidth: -1, quotingType: '"' }).trim(); |
| 253 | const content = `---\n${yamlStr}\n---\n\n${summary}\n`; |
| 254 | await writeText(filePath, content); |
| 255 | return filePath; |
| 256 | } |
| 257 | |
| 258 | /** |
| 259 | * Recover bump files that were deleted by the version commit. |
no test coverage detected
searching dependent graphs…