|
2 | 2 |
|
3 | 3 | import { promises as fs, constants as fsConstants } from 'fs'; |
4 | 4 | import path from 'path'; |
5 | | -import prettier from 'prettier'; |
6 | 5 | import semver from 'semver'; |
7 | 6 | import type { Argv } from 'yargs'; |
8 | 7 | import { hideBin } from 'yargs/helpers'; |
9 | 8 | import yargs from 'yargs/yargs'; |
10 | 9 |
|
11 | | -import { Formatter } from './changelog'; |
| 10 | +import { format, Formatter } from './changelog'; |
12 | 11 | import { unreleased, Version } from './constants'; |
13 | 12 | import { generateDiff } from './generate-diff'; |
14 | 13 | import { createEmptyChangelog } from './init'; |
@@ -184,7 +183,7 @@ async function validate({ |
184 | 183 | const changelogContent = await readChangelog(changelogPath); |
185 | 184 |
|
186 | 185 | try { |
187 | | - validateChangelog({ |
| 186 | + await validateChangelog({ |
188 | 187 | changelogContent, |
189 | 188 | currentVersion, |
190 | 189 | repoUrl, |
@@ -239,7 +238,7 @@ type InitOptions = { |
239 | 238 | * @param options.tagPrefix - The prefix used in tags before the version number. |
240 | 239 | */ |
241 | 240 | async function init({ changelogPath, repoUrl, tagPrefix }: InitOptions) { |
242 | | - const changelogContent = createEmptyChangelog({ repoUrl, tagPrefix }); |
| 241 | + const changelogContent = await createEmptyChangelog({ repoUrl, tagPrefix }); |
243 | 242 | await saveChangelog(changelogPath, changelogContent); |
244 | 243 | } |
245 | 244 |
|
@@ -466,10 +465,8 @@ async function main() { |
466 | 465 | } |
467 | 466 | } |
468 | 467 |
|
469 | | - const formatter = (changelog: string) => { |
470 | | - return usePrettier |
471 | | - ? prettier.format(changelog, { parser: 'markdown' }) |
472 | | - : changelog; |
| 468 | + const formatter = async (changelog: string) => { |
| 469 | + return usePrettier ? await format(changelog) : changelog; |
473 | 470 | }; |
474 | 471 |
|
475 | 472 | if (command === 'update') { |
|
0 commit comments