Skip to content

Commit 427ad6b

Browse files
committed
Bump @metamask/auto-changelog to ^4.0.0, and bump related dependencies
1 parent 4fa46bf commit 427ad6b

File tree

4 files changed

+143
-89
lines changed

4 files changed

+143
-89
lines changed

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
},
2727
"dependencies": {
2828
"@metamask/action-utils": "^1.0.0",
29-
"@metamask/auto-changelog": "~3.3.0",
29+
"@metamask/auto-changelog": "^4.0.0",
3030
"@metamask/utils": "^9.0.0",
3131
"debug": "^4.3.4",
3232
"execa": "^8.0.1",
@@ -69,19 +69,19 @@
6969
"jest-it-up": "^3.0.0",
7070
"jest-when": "^3.5.2",
7171
"nanoid": "^3.3.4",
72-
"prettier": "^2.2.1",
73-
"prettier-plugin-packagejson": "^2.3.0",
72+
"prettier": "^3.3.3",
73+
"prettier-plugin-packagejson": "^2.5.2",
7474
"rimraf": "^4.0.5",
7575
"stdio-mock": "^1.2.0",
7676
"tsx": "^4.6.1",
7777
"typescript": "~5.1.6"
7878
},
7979
"peerDependencies": {
80-
"prettier": "^2"
80+
"prettier": ">=3.0.0"
8181
},
8282
"packageManager": "[email protected]",
8383
"engines": {
84-
"node": "^16.20 || ^18.16 || >=20"
84+
"node": "^18.18 || >=20"
8585
},
8686
"publishConfig": {
8787
"access": "public",

src/package.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { when } from 'jest-when';
44
import * as autoChangelog from '@metamask/auto-changelog';
55
import { SemVer } from 'semver';
66
import { MockWritable } from 'stdio-mock';
7-
import { buildChangelog, withSandbox } from '../tests/helpers';
7+
import { buildChangelog, withSandbox } from '../tests/helpers.js';
88
import {
99
buildMockPackage,
1010
buildMockProject,
@@ -682,7 +682,7 @@ describe('package', () => {
682682
});
683683

684684
describe('formatChangelog', () => {
685-
it('formats a changelog', () => {
685+
it('formats a changelog', async () => {
686686
const unformattedChangelog = `# Changelog
687687
## 1.0.0
688688
@@ -692,7 +692,8 @@ describe('package', () => {
692692
- Some other change
693693
`;
694694

695-
expect(formatChangelog(unformattedChangelog)).toMatchInlineSnapshot(`
695+
expect(await formatChangelog(unformattedChangelog))
696+
.toMatchInlineSnapshot(`
696697
"# Changelog
697698
698699
## 1.0.0

src/package.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import fs, { WriteStream } from 'fs';
22
import path from 'path';
33
import { format } from 'util';
44
import { parseChangelog, updateChangelog } from '@metamask/auto-changelog';
5-
import prettier from 'prettier';
5+
import { format as formatPrettier } from 'prettier/standalone';
6+
import * as markdown from 'prettier/plugins/markdown';
67
import { WriteStreamLike, readFile, writeFile, writeJsonFile } from './fs.js';
78
import { isErrorWithCode } from './misc-utils.js';
89
import {
@@ -278,7 +279,7 @@ export async function migrateUnreleasedChangelogChangesToRelease({
278279

279280
changelog.addRelease({ version });
280281
changelog.migrateUnreleasedChangesToRelease(version);
281-
await writeFile(pkg.changelogPath, changelog.toString());
282+
await writeFile(pkg.changelogPath, await changelog.toString());
282283
}
283284

284285
/**
@@ -288,8 +289,11 @@ export async function migrateUnreleasedChangelogChangesToRelease({
288289
* @param changelog - The changelog to format.
289290
* @returns The formatted changelog.
290291
*/
291-
export function formatChangelog(changelog: string) {
292-
return prettier.format(changelog, { parser: 'markdown' });
292+
export async function formatChangelog(changelog: string) {
293+
return await formatPrettier(changelog, {
294+
parser: 'markdown',
295+
plugins: [markdown],
296+
});
293297
}
294298

295299
/**

0 commit comments

Comments
 (0)