From 0a83e38e4254be29c6850c4065b4250ee42e2c43 Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Wed, 21 May 2025 10:10:28 +0200 Subject: [PATCH 1/2] chore: Add changelog generation script --- package.json | 4 +++- yarn.lock | 26 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 1abce4f1..e0f39918 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "build:watch": "nx run-many --target=build:watch --all", "build:graph": "nx graph", "build:npm": "nx run-many --target=build:npm --all", + "changelog": "ts-node ./scripts/get-commit-list.ts", "check:types": "nx run-many --target=check:types --all", "clean": "nx run-many --target=clean --all", "clean:all": "nx run-many --target=clean:all --all && yarn", @@ -32,7 +33,8 @@ "nx": "14.5.10", "prettier": "^2.7.1", "pretty-quick": "^3.1.3", - "npm-run-all": "^4.1.5" + "npm-run-all": "^4.1.5", + "ts-node": "^10.9.2" }, "volta": { "node": "14.21.2", diff --git a/yarn.lock b/yarn.lock index 7ad0c552..74fc835d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11500,6 +11500,13 @@ rollup@2.77.0: optionalDependencies: fsevents "~2.3.2" +rollup@2.79.2: + version "2.79.2" + resolved "https://registry.npmjs.org/rollup/-/rollup-2.79.2.tgz#f150e4a5db4b121a21a747d762f701e5e9f49090" + integrity sha512-fS6iqSPZDs3dr/y7Od6y5nha8dW1YnbgtsyotCVvoFGKbERG++CVRFv1meyGDE1SNItQA8BrnCw7ScdAhRJ3XQ== + optionalDependencies: + fsevents "~2.3.2" + rollup@3.2.0: version "3.2.0" resolved "https://registry.npmjs.org/rollup/-/rollup-3.2.0.tgz#a6f44074418e55217967c8eca622f9638d396388" @@ -12517,6 +12524,25 @@ ts-node@^10.9.1: v8-compile-cache-lib "^3.0.1" yn "3.1.1" +ts-node@^10.9.2: + version "10.9.2" + resolved "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz#70f021c9e185bccdca820e26dc413805c101c71f" + integrity sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ== + dependencies: + "@cspotcode/source-map-support" "^0.8.0" + "@tsconfig/node10" "^1.0.7" + "@tsconfig/node12" "^1.0.7" + "@tsconfig/node14" "^1.0.0" + "@tsconfig/node16" "^1.0.2" + acorn "^8.4.1" + acorn-walk "^8.1.1" + arg "^4.1.0" + create-require "^1.1.0" + diff "^4.0.1" + make-error "^1.1.1" + v8-compile-cache-lib "^3.0.1" + yn "3.1.1" + tsconfig-paths@^3.9.0: version "3.14.2" resolved "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz#6e32f1f79412decd261f92d633a9dc1cfa99f088" From addf27c10b7a056ce087e513ba8524fd9dbc2bd3 Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Wed, 21 May 2025 10:14:45 +0200 Subject: [PATCH 2/2] actually add the sript lol --- scripts/get-commit-list.ts | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 scripts/get-commit-list.ts diff --git a/scripts/get-commit-list.ts b/scripts/get-commit-list.ts new file mode 100644 index 00000000..502ff2ea --- /dev/null +++ b/scripts/get-commit-list.ts @@ -0,0 +1,36 @@ +import { execSync } from "child_process"; + +function run(): void { + const commits = execSync('git log --format="- %s"').toString().split("\n"); + + const lastReleasePos = commits.findIndex((commit) => /- meta(.*)changelog/i.test(commit)); + + const newCommits = commits.splice(0, lastReleasePos).filter((commit) => { + // Filter out merge commits + if (/Merge pull request/.test(commit)) { + return false; + } + // Filter release branch merged + if (/Merge branch/.test(commit)) { + return false; + } + // Filter release commit itself + if (/release:/.test(commit)) { + return false; + } + + return true; + }); + + newCommits.sort((a, b) => a.localeCompare(b)); + + const issueUrl = "https://github.com/getsentry/sentry-javascript-bundler-plugins/pull/"; + const newCommitsWithLink = newCommits.map((commit) => + commit.replace(/#(\d+)/, `[#$1](${issueUrl}$1)`) + ); + + // eslint-disable-next-line no-console + console.log(newCommitsWithLink.join("\n")); +} + +run();