Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
45 changes: 31 additions & 14 deletions .changeset/changelog-generator.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { getInfo, getInfoFromPullRequest } from "@changesets/get-github-info";
// the shared eslint config resolves with `eslint-import-resolver-node`, which
// reads `main` and not `exports` — and this package now ships only `exports`
// eslint-disable-next-line import/no-unresolved
import { getCommitInfo, getPullRequestInfo } from "@changesets/get-github-info";

/** @typedef {import("@changesets/types").ChangelogFunctions} ChangelogFunctions */

Expand All @@ -10,6 +13,14 @@ function readEnv() {
return { GITHUB_SERVER_URL };
}

/**
* @param {{ markdownLink: string } | undefined} part commit, pull request or author
* @returns {string | null} its markdown link, or null when it was not found
*/
function markdownLink(part) {
return part ? part.markdownLink : null;
}

/** @type {ChangelogFunctions} */
const changelogFunctions = {
getDependencyReleaseLine: async (changesets, dependenciesUpdated, options) => {
Expand All @@ -24,11 +35,11 @@ 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;
}
}),
)
Expand Down Expand Up @@ -77,26 +88,32 @@ const changelogFunctions = {

const links = await (async () => {
if (prFromSummary !== undefined) {
let { links } = await getInfoFromPullRequest({
const info = await getPullRequestInfo({
repo: options.repo,
pull: prFromSummary,
});
if (commitFromSummary) {
const shortCommitId = commitFromSummary.slice(0, 7);
links = {
...links,
commit: `[\`${shortCommitId}\`](${GITHUB_SERVER_URL}/${options.repo}/commit/${commitFromSummary})`,
};
}
return links;
const commit = commitFromSummary
? `[\`${commitFromSummary.slice(0, 7)}\`](${GITHUB_SERVER_URL}/${options.repo}/commit/${commitFromSummary})`
: markdownLink(info && info.commit);

return {
commit,
pull: markdownLink(info && info.pull),
user: markdownLink(info && info.author),
};
}
const commitToFetchFrom = commitFromSummary || changeset.commit;
if (commitToFetchFrom) {
const { links } = await getInfo({
const info = await getCommitInfo({
repo: options.repo,
commit: commitToFetchFrom,
});
return links;

return {
commit: markdownLink(info && info.commit),
pull: markdownLink(info && info.pull),
user: markdownLink(info && info.author),
};
}
return {
commit: null,
Expand Down
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.1.2/schema.json",
"$schema": "https://unpkg.com/@changesets/config@4.0.0/schema.json",
"changelog": ["./changelog-generator.mjs", { "repo": "webpack/webpack-cli" }],
"fixed": [],
"linked": [],
Expand Down
5 changes: 5 additions & 0 deletions .changeset/toml-5-peer-range.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"webpack-cli": patch
---

feat: allow `toml@5` as a peer dependency for TOML configuration files
4 changes: 4 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ jobs:

- name: Run tests and generate coverage
run: npm run test:coverage -- --ci
env:
# c8 remaps every script V8 reported before applying its include
# filter, which exceeds Node.js 20's default heap on macOS runners
NODE_OPTIONS: --max-old-space-size=4096

- name: Upload coverage to Codecov
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
Expand Down
Loading
Loading