Skip to content

Commit 20ced4b

Browse files
authored
BREAKING: Bump @metamask/auto-changelog to ^4.0.0, and bump related dependencies (#156)
1 parent 4fa46bf commit 20ced4b

File tree

6 files changed

+159
-117
lines changed

6 files changed

+159
-117
lines changed

.github/workflows/build-test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
YARN_VERSION: ${{ steps.yarn-version.outputs.YARN_VERSION }}
1515
strategy:
1616
matrix:
17-
node-version: [16.x, 18.x, 20.x]
17+
node-version: [18.x, 20.x]
1818
steps:
1919
- uses: actions/checkout@v3
2020
- name: Use Node.js ${{ matrix.node-version }}
@@ -41,7 +41,7 @@ jobs:
4141
- prepare
4242
strategy:
4343
matrix:
44-
node-version: [16.x, 18.x, 20.x]
44+
node-version: [18.x, 20.x]
4545
steps:
4646
- uses: actions/checkout@v3
4747
- name: Use Node.js ${{ matrix.node-version }}
@@ -69,7 +69,7 @@ jobs:
6969
- prepare
7070
strategy:
7171
matrix:
72-
node-version: [16.x, 18.x, 20.x]
72+
node-version: [18.x, 20.x]
7373
steps:
7474
- uses: actions/checkout@v3
7575
- name: Use Node.js ${{ matrix.node-version }}
@@ -103,7 +103,7 @@ jobs:
103103
- prepare
104104
strategy:
105105
matrix:
106-
node-version: [16.x, 18.x, 20.x]
106+
node-version: [18.x, 20.x]
107107
steps:
108108
- uses: actions/checkout@v3
109109
- name: Use Node.js ${{ matrix.node-version }}

package.json

Lines changed: 7 additions & 7 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",
@@ -59,29 +59,29 @@
5959
"babel-jest": "^29.7.0",
6060
"deepmerge": "^4.2.2",
6161
"eslint": "^8.27.0",
62-
"eslint-config-prettier": "^8.5.0",
62+
"eslint-config-prettier": "^9.1.0",
6363
"eslint-plugin-import": "^2.26.0",
6464
"eslint-plugin-jest": "^26.9.0",
6565
"eslint-plugin-jsdoc": "^39.6.2",
6666
"eslint-plugin-node": "^11.1.0",
67-
"eslint-plugin-prettier": "^4.2.1",
67+
"eslint-plugin-prettier": "^5.2.1",
6868
"jest": "^29.7.0",
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
/**

src/project.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,12 @@ export async function readProject(
113113
});
114114
}),
115115
)
116-
).reduce((obj, pkg) => {
117-
return { ...obj, [pkg.validatedManifest.name]: pkg };
118-
}, {} as Record<string, Package>);
116+
).reduce(
117+
(obj, pkg) => {
118+
return { ...obj, [pkg.validatedManifest.name]: pkg };
119+
},
120+
{} as Record<string, Package>,
121+
);
119122

120123
const isMonorepo = Object.keys(workspacePackages).length > 0;
121124

0 commit comments

Comments
 (0)