Skip to content

Commit

Permalink
BREAKING: Bump @metamask/auto-changelog to ^4.0.0, and bump relat…
Browse files Browse the repository at this point in the history
…ed dependencies (#156)
  • Loading branch information
Mrtenz authored Sep 23, 2024
1 parent 4fa46bf commit 20ced4b
Show file tree
Hide file tree
Showing 6 changed files with 159 additions and 117 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
YARN_VERSION: ${{ steps.yarn-version.outputs.YARN_VERSION }}
strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
node-version: [18.x, 20.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
Expand All @@ -41,7 +41,7 @@ jobs:
- prepare
strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
node-version: [18.x, 20.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:
- prepare
strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
node-version: [18.x, 20.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
Expand Down Expand Up @@ -103,7 +103,7 @@ jobs:
- prepare
strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
node-version: [18.x, 20.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
Expand Down
14 changes: 7 additions & 7 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 @@ -59,29 +59,29 @@
"babel-jest": "^29.7.0",
"deepmerge": "^4.2.2",
"eslint": "^8.27.0",
"eslint-config-prettier": "^8.5.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^26.9.0",
"eslint-plugin-jsdoc": "^39.6.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-prettier": "^5.2.1",
"jest": "^29.7.0",
"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": "yarn@3.2.1",
"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
9 changes: 6 additions & 3 deletions src/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,12 @@ export async function readProject(
});
}),
)
).reduce((obj, pkg) => {
return { ...obj, [pkg.validatedManifest.name]: pkg };
}, {} as Record<string, Package>);
).reduce(
(obj, pkg) => {
return { ...obj, [pkg.validatedManifest.name]: pkg };
},
{} as Record<string, Package>,
);

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

Expand Down
Loading

0 comments on commit 20ced4b

Please sign in to comment.