From bedeb1ff79cf96d1044556ddbe2a5480bc2649ba Mon Sep 17 00:00:00 2001 From: alexander-akait Date: Wed, 2 Sep 2026 09:42:54 +0000 Subject: [PATCH 1/2] build: update changesets tooling Move the changelog generator to the @changesets/get-github-info 1.0 API (getInfo/getInfoFromPullRequest became getCommitInfo/getPullRequestInfo, the links bag became per-entity markdownLink fields, and both lookups can now return undefined), and take dependabot's changesets/action v2.1.0 pin. The package is now ESM-only and ships an exports map with no main, which the eslint import resolver cannot follow, so import/no-unresolved is off for that one file. --- .changeset/changelog-generator.mjs | 66 ++++++++++++++++++------ .changeset/update-changesets-tooling.md | 5 ++ .github/workflows/release.yml | 2 +- eslint.config.mjs | 8 +++ package-lock.json | 68 +++++-------------------- package.json | 2 +- 6 files changed, 78 insertions(+), 73 deletions(-) create mode 100644 .changeset/update-changesets-tooling.md diff --git a/.changeset/changelog-generator.mjs b/.changeset/changelog-generator.mjs index 62b6c8ce0..59cb430af 100644 --- a/.changeset/changelog-generator.mjs +++ b/.changeset/changelog-generator.mjs @@ -1,6 +1,15 @@ -import { getInfo, getInfoFromPullRequest } from "@changesets/get-github-info"; +import { getCommitInfo, getPullRequestInfo } from "@changesets/get-github-info"; /** @typedef {import("@changesets/types").ChangelogFunctions} ChangelogFunctions */ +/** @typedef {import("@changesets/get-github-info").CommitInfo} CommitInfo */ +/** @typedef {import("@changesets/get-github-info").PullRequestInfo} PullRequestInfo */ + +/** + * @typedef {object} Links + * @property {string | null} commit markdown link to the commit + * @property {string | null} pull markdown link to the pull request + * @property {string | null} user markdown link to the author + */ /** * @returns {{ GITHUB_SERVER_URL: string }} value @@ -11,6 +20,24 @@ function readEnv() { return { GITHUB_SERVER_URL }; } +/** + * Flattens what GitHub reported into the three links a changelog line uses. + * Every field is null when the lookup found nothing. + * @param {CommitInfo | PullRequestInfo | undefined} info what GitHub reported + * @returns {Links} links + */ +function toLinks(info) { + if (!info) { + return { commit: null, pull: null, user: null }; + } + + return { + commit: info.commit ? info.commit.markdownLink : null, + pull: info.pull ? info.pull.markdownLink : null, + user: info.author ? info.author.markdownLink : null, + }; +} + /** @type {ChangelogFunctions} */ const changelogFunctions = { getDependencyReleaseLine: async ( @@ -29,12 +56,15 @@ const changelogFunctions = { await Promise.all( changesets.map(async (cs) => { if (cs.commit) { - const { links } = await getInfo({ + const info = await getCommitInfo({ repo: options.repo, commit: cs.commit, }); - return links.commit; + + return info ? info.commit.markdownLink : undefined; } + + return undefined; }), ) ) @@ -84,26 +114,32 @@ const changelogFunctions = { const links = await (async () => { if (prFromSummary !== undefined) { - let { links } = await getInfoFromPullRequest({ - repo: options.repo, - pull: prFromSummary, - }); + const linksFromPullRequest = toLinks( + await getPullRequestInfo({ + repo: options.repo, + pull: prFromSummary, + }), + ); + if (commitFromSummary) { const shortCommitId = commitFromSummary.slice(0, 7); - links = { - ...links, + + return { + ...linksFromPullRequest, commit: `[\`${shortCommitId}\`](${GITHUB_SERVER_URL}/${options.repo}/commit/${commitFromSummary})`, }; } - return links; + + return linksFromPullRequest; } const commitToFetchFrom = commitFromSummary || changeset.commit; if (commitToFetchFrom) { - const { links } = await getInfo({ - repo: options.repo, - commit: commitToFetchFrom, - }); - return links; + return toLinks( + await getCommitInfo({ + repo: options.repo, + commit: commitToFetchFrom, + }), + ); } return { commit: null, diff --git a/.changeset/update-changesets-tooling.md b/.changeset/update-changesets-tooling.md new file mode 100644 index 000000000..0a6705fc3 --- /dev/null +++ b/.changeset/update-changesets-tooling.md @@ -0,0 +1,5 @@ +--- +"webpack-dev-middleware": patch +--- + +Update the changelog generator to the `@changesets/get-github-info` 1.0 API. diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6c765383a..4e80d388a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,7 +32,7 @@ jobs: - name: Create Release Pull Request or Publish to npm id: changesets - uses: changesets/action@a45c4d594aa4e2c509dc14a9f2b3b67ba3780d0d # v1.9.0 + uses: changesets/action@198f833dd7d863100ea6e28967bc9a9fdefadb0a # v2.1.0 with: version: npm run version publish: npm run release diff --git a/eslint.config.mjs b/eslint.config.mjs index 62d1491ed..966a05ef7 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -13,6 +13,14 @@ export default defineConfig([ "n/hashbang": "off", }, }, + { + // `@changesets/get-github-info` is ESM-only and ships an `exports` map with + // no `main`, which the import resolver cannot follow. Node resolves it. + files: [".changeset/changelog-generator.mjs"], + rules: { + "import/no-unresolved": "off", + }, + }, { files: ["client-src/**/*"], extends: [configs["browser-outdated-recommended-module"]], diff --git a/package-lock.json b/package-lock.json index e7270c9da..6a3b7b0f9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,7 +20,7 @@ "@babel/core": "^7.29.7", "@babel/preset-env": "^7.29.7", "@changesets/cli": "^3.0.1", - "@changesets/get-github-info": "^0.8.0", + "@changesets/get-github-info": "^1.0.0", "@fastify/express": "^4.0.7", "@hapi/hapi": "^21.4.10", "@hono/node-server": "^2.1.1", @@ -2094,14 +2094,16 @@ } }, "node_modules/@changesets/get-github-info": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/@changesets/get-github-info/-/get-github-info-0.8.0.tgz", - "integrity": "sha512-cRnC+xdF0JIik7coko3iUP9qbnfi1iJQ3sAa6dE+Tx3+ET8bjFEm63PA4WEohgjYcmsOikPHWzPsMWWiZmntOQ==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@changesets/get-github-info/-/get-github-info-1.0.0.tgz", + "integrity": "sha512-nf5zPSqEKW0eXiJ4ltbjyIQ/srUHfxbghkLCjKdOLI3LehKXhiqxXcpja39eGPaj6qqGx2lFCrLJ7VWYUf9H2w==", "dev": true, "license": "MIT", "dependencies": { - "dataloader": "^1.4.0", - "node-fetch": "^2.5.0" + "dataloader": "^2.2.3" + }, + "engines": { + "node": "^22.11 || ^24 || >=26" } }, "node_modules/@changesets/git": { @@ -8334,11 +8336,11 @@ } }, "node_modules/dataloader": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/dataloader/-/dataloader-1.4.0.tgz", - "integrity": "sha512-68s5jYdlvasItOJnCuI2Q9s4q98g0pCyL3HrcKJu8KNugUl8ahgmZYg38ysLTgQjjXX3H8CJLkAvWrclWfcalw==", + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/dataloader/-/dataloader-2.2.3.tgz", + "integrity": "sha512-y2krtASINtPFS1rSDjacrFgn1dcUuoREVabwlOGOe4SdxenREqwjwjElAdwvbGM7kgZz9a3KVicWR7vcz8rnzA==", "dev": true, - "license": "BSD-3-Clause" + "license": "MIT" }, "node_modules/debug": { "version": "4.4.3", @@ -15337,52 +15339,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/node-fetch": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", - "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", - "dev": true, - "license": "MIT", - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, - "node_modules/node-fetch/node_modules/tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", - "dev": true, - "license": "MIT" - }, - "node_modules/node-fetch/node_modules/webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", - "dev": true, - "license": "BSD-2-Clause" - }, - "node_modules/node-fetch/node_modules/whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "dev": true, - "license": "MIT", - "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, "node_modules/node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", diff --git a/package.json b/package.json index bdffcef21..7e9bcf9ad 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "@babel/core": "^7.29.7", "@babel/preset-env": "^7.29.7", "@changesets/cli": "^3.0.1", - "@changesets/get-github-info": "^0.8.0", + "@changesets/get-github-info": "^1.0.0", "@fastify/express": "^4.0.7", "@hapi/hapi": "^21.4.10", "@hono/node-server": "^2.1.1", From f5754e3d1be25a6971973265cca077751edf5a10 Mon Sep 17 00:00:00 2001 From: alexander-akait Date: Wed, 2 Sep 2026 09:55:36 +0000 Subject: [PATCH 2/2] build: use the changesets/action v2 input names v2 renamed every input this workflow passes (version -> version-script, publish -> publish-script, commit -> commit-message, title -> pr-title), so a bare SHA bump silently drops them. Without publish-script the action only opens a version pull request and never publishes. Also stop the changelog generator printing a literal 'null' when a changeset names an author but GitHub reports no commit or pull request, which 1.0 can now do because both lookups may return undefined. --- .changeset/changelog-generator.mjs | 10 ++++++++-- .github/workflows/release.yml | 10 ++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.changeset/changelog-generator.mjs b/.changeset/changelog-generator.mjs index 59cb430af..2583400b4 100644 --- a/.changeset/changelog-generator.mjs +++ b/.changeset/changelog-generator.mjs @@ -157,9 +157,15 @@ const changelogFunctions = { .join(", ") : links.user; + // 1.0 reports nothing when a commit or pull request is not found, so the + // link half has to be dropped rather than printed as `null`. + const link = links.pull || links.commit; + let suffix = ""; - if (links.pull || links.commit || users) { - suffix = `(${users ? `by ${users} ` : ""}in ${links.pull || links.commit})`; + if (link) { + suffix = `(${users ? `by ${users} ` : ""}in ${link})`; + } else if (users) { + suffix = `(by ${users})`; } return `\n\n- ${firstLine} ${suffix}\n${futureLines.map((l) => ` ${l}`).join("\n")}`; diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4e80d388a..e7302c40b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,10 +34,12 @@ jobs: id: changesets uses: changesets/action@198f833dd7d863100ea6e28967bc9a9fdefadb0a # v2.1.0 with: - version: npm run version - publish: npm run release - commit: "chore(release): new release" - title: "chore(release): new release" + version-script: npm run version + publish-script: npm run release + commit-message: "chore(release): new release" + pr-title: "chore(release): new release" env: + # v2 no longer reads this for its own auth, but `changeset version` + # runs the changelog generator, which needs it to query GitHub. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: "" # https://github.com/changesets/changesets/issues/1152#issuecomment-3190884868