Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Bump @metamask/auto-changelog to ^4.0.0, and bump related depende…
…ncies
  • Loading branch information
Mrtenz committed Sep 23, 2024
commit 427ad6b790b41925f2cdc6320e7db5a2c9dead20
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
},
"dependencies": {
"@metamask/action-utils": "^1.0.0",
"@metamask/auto-changelog": "~3.3.0",
"@metamask/auto-changelog": "^4.0.0",
"@metamask/utils": "^9.0.0",
"debug": "^4.3.4",
"execa": "^8.0.1",
Expand Down Expand Up @@ -69,19 +69,19 @@
"jest-it-up": "^3.0.0",
"jest-when": "^3.5.2",
"nanoid": "^3.3.4",
"prettier": "^2.2.1",
"prettier-plugin-packagejson": "^2.3.0",
"prettier": "^3.3.3",
"prettier-plugin-packagejson": "^2.5.2",
"rimraf": "^4.0.5",
"stdio-mock": "^1.2.0",
"tsx": "^4.6.1",
"typescript": "~5.1.6"
},
"peerDependencies": {
"prettier": "^2"
"prettier": ">=3.0.0"
},
"packageManager": "[email protected]",
"engines": {
"node": "^16.20 || ^18.16 || >=20"
"node": "^18.18 || >=20"
},
"publishConfig": {
"access": "public",
Expand Down
7 changes: 4 additions & 3 deletions src/package.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { when } from 'jest-when';
import * as autoChangelog from '@metamask/auto-changelog';
import { SemVer } from 'semver';
import { MockWritable } from 'stdio-mock';
import { buildChangelog, withSandbox } from '../tests/helpers';
import { buildChangelog, withSandbox } from '../tests/helpers.js';
import {
buildMockPackage,
buildMockProject,
Expand Down Expand Up @@ -682,7 +682,7 @@ describe('package', () => {
});

describe('formatChangelog', () => {
it('formats a changelog', () => {
it('formats a changelog', async () => {
const unformattedChangelog = `# Changelog
## 1.0.0

Expand All @@ -692,7 +692,8 @@ describe('package', () => {
- Some other change
`;

expect(formatChangelog(unformattedChangelog)).toMatchInlineSnapshot(`
expect(await formatChangelog(unformattedChangelog))
.toMatchInlineSnapshot(`
"# Changelog

## 1.0.0
Expand Down
12 changes: 8 additions & 4 deletions src/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import fs, { WriteStream } from 'fs';
import path from 'path';
import { format } from 'util';
import { parseChangelog, updateChangelog } from '@metamask/auto-changelog';
import prettier from 'prettier';
import { format as formatPrettier } from 'prettier/standalone';
import * as markdown from 'prettier/plugins/markdown';
import { WriteStreamLike, readFile, writeFile, writeJsonFile } from './fs.js';
import { isErrorWithCode } from './misc-utils.js';
import {
Expand Down Expand Up @@ -278,7 +279,7 @@ export async function migrateUnreleasedChangelogChangesToRelease({

changelog.addRelease({ version });
changelog.migrateUnreleasedChangesToRelease(version);
await writeFile(pkg.changelogPath, changelog.toString());
await writeFile(pkg.changelogPath, await changelog.toString());
}

/**
Expand All @@ -288,8 +289,11 @@ export async function migrateUnreleasedChangelogChangesToRelease({
* @param changelog - The changelog to format.
* @returns The formatted changelog.
*/
export function formatChangelog(changelog: string) {
return prettier.format(changelog, { parser: 'markdown' });
export async function formatChangelog(changelog: string) {
return await formatPrettier(changelog, {
parser: 'markdown',
plugins: [markdown],
});
}

/**
Expand Down
Loading