Skip to content

Commit 5d37d08

Browse files
committed
Merge remote-tracking branch 'origin/main' into v3.x
* origin/main: feat: allow `npm:name@version` dependency redirections in manifest (#158) 4.0.0 (#157) BREAKING: Bump `@metamask/auto-changelog` to `^4.0.0`, and bump related dependencies (#156) chore(devdeps): @lavamoat/allow-scripts@^2.3.1->^3.1.0 (#146)
2 parents 4da1cf7 + 51f2db6 commit 5d37d08

File tree

7 files changed

+709
-272
lines changed

7 files changed

+709
-272
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 }}

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [4.0.0]
10+
### Changed
11+
- **BREAKING:** Bump minimum Node.js version to `^18.18` ([#156](https://github.com/MetaMask/create-release-branch/pull/156))
12+
- **BREAKING:** Bump `@metamask/auto-changelog` to `^4.0.0` ([#156](https://github.com/MetaMask/create-release-branch/pull/156))
13+
- This requires `prettier@>=3.0.0`.
14+
915
## [3.1.0]
1016
### Changed
1117
- Allow `npm:name@version` dependency redirections in manifest ([#158](https://github.com/MetaMask/create-release-branch/pull/158)) ([#159](https://github.com/MetaMask/create-release-branch/pull/159))
@@ -63,7 +69,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6369
- In this first release, this tool only supports monorepos with an independent versioning scheme. We will add support for other kinds of projects in future releases.
6470
- You can learn more on how to use this tool by reading the [documentation](docs/).
6571

66-
[Unreleased]: https://github.com/MetaMask/create-release-branch/compare/v3.1.0...HEAD
72+
[Unreleased]: https://github.com/MetaMask/create-release-branch/compare/v4.0.0...HEAD
73+
[4.0.0]: https://github.com/MetaMask/create-release-branch/compare/v3.1.0...v4.0.0
6774
[3.1.0]: https://github.com/MetaMask/create-release-branch/compare/v3.0.1...v3.1.0
6875
[3.0.1]: https://github.com/MetaMask/create-release-branch/compare/v3.0.0...v3.0.1
6976
[3.0.0]: https://github.com/MetaMask/create-release-branch/compare/v2.0.1...v3.0.0

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@metamask/create-release-branch",
3-
"version": "3.1.0",
3+
"version": "4.0.0",
44
"description": "An interactive command-line tool to prepare a release branch by automatically bumping versions and updating changelogs for desired packages. Works for both polyrepos and monorepos.",
55
"repository": {
66
"type": "git",
@@ -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",
@@ -42,7 +42,7 @@
4242
"@babel/plugin-transform-modules-commonjs": "^7.23.3",
4343
"@babel/preset-env": "^7.23.5",
4444
"@babel/preset-typescript": "^7.23.3",
45-
"@lavamoat/allow-scripts": "^2.3.1",
45+
"@lavamoat/allow-scripts": "^3.1.0",
4646
"@metamask/eslint-config": "^10.0.0",
4747
"@metamask/eslint-config-jest": "^10.0.0",
4848
"@metamask/eslint-config-nodejs": "^10.0.0",
@@ -61,29 +61,29 @@
6161
"babel-jest": "^29.7.0",
6262
"deepmerge": "^4.2.2",
6363
"eslint": "^8.27.0",
64-
"eslint-config-prettier": "^8.5.0",
64+
"eslint-config-prettier": "^9.1.0",
6565
"eslint-plugin-import": "^2.26.0",
6666
"eslint-plugin-jest": "^26.9.0",
6767
"eslint-plugin-jsdoc": "^39.6.2",
6868
"eslint-plugin-node": "^11.1.0",
69-
"eslint-plugin-prettier": "^4.2.1",
69+
"eslint-plugin-prettier": "^5.2.1",
7070
"jest": "^29.7.0",
7171
"jest-it-up": "^3.0.0",
7272
"jest-when": "^3.5.2",
7373
"nanoid": "^3.3.4",
74-
"prettier": "^2.2.1",
75-
"prettier-plugin-packagejson": "^2.3.0",
74+
"prettier": "^3.3.3",
75+
"prettier-plugin-packagejson": "^2.5.2",
7676
"rimraf": "^4.0.5",
7777
"stdio-mock": "^1.2.0",
7878
"tsx": "^4.6.1",
7979
"typescript": "~5.1.6"
8080
},
8181
"peerDependencies": {
82-
"prettier": "^2"
82+
"prettier": ">=3.0.0"
8383
},
8484
"packageManager": "[email protected]",
8585
"engines": {
86-
"node": "^16.20 || ^18.16 || >=20"
86+
"node": "^18.18 || >=20"
8787
},
8888
"publishConfig": {
8989
"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)