Skip to content

Commit ea04da5

Browse files
authored
chore: Add changelog generation script (#744)
* chore: Add changelog generation script * actually add the sript lol
1 parent 219cbee commit ea04da5

File tree

3 files changed

+65
-1
lines changed

3 files changed

+65
-1
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"build:watch": "nx run-many --target=build:watch --all",
1414
"build:graph": "nx graph",
1515
"build:npm": "nx run-many --target=build:npm --all",
16+
"changelog": "ts-node ./scripts/get-commit-list.ts",
1617
"check:types": "nx run-many --target=check:types --all",
1718
"clean": "nx run-many --target=clean --all",
1819
"clean:all": "nx run-many --target=clean:all --all && yarn",
@@ -32,7 +33,8 @@
3233
"nx": "14.5.10",
3334
"prettier": "^2.7.1",
3435
"pretty-quick": "^3.1.3",
35-
"npm-run-all": "^4.1.5"
36+
"npm-run-all": "^4.1.5",
37+
"ts-node": "^10.9.2"
3638
},
3739
"volta": {
3840
"node": "14.21.2",

scripts/get-commit-list.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { execSync } from "child_process";
2+
3+
function run(): void {
4+
const commits = execSync('git log --format="- %s"').toString().split("\n");
5+
6+
const lastReleasePos = commits.findIndex((commit) => /- meta(.*)changelog/i.test(commit));
7+
8+
const newCommits = commits.splice(0, lastReleasePos).filter((commit) => {
9+
// Filter out merge commits
10+
if (/Merge pull request/.test(commit)) {
11+
return false;
12+
}
13+
// Filter release branch merged
14+
if (/Merge branch/.test(commit)) {
15+
return false;
16+
}
17+
// Filter release commit itself
18+
if (/release:/.test(commit)) {
19+
return false;
20+
}
21+
22+
return true;
23+
});
24+
25+
newCommits.sort((a, b) => a.localeCompare(b));
26+
27+
const issueUrl = "https://github.com/getsentry/sentry-javascript-bundler-plugins/pull/";
28+
const newCommitsWithLink = newCommits.map((commit) =>
29+
commit.replace(/#(\d+)/, `[#$1](${issueUrl}$1)`)
30+
);
31+
32+
// eslint-disable-next-line no-console
33+
console.log(newCommitsWithLink.join("\n"));
34+
}
35+
36+
run();

yarn.lock

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11500,6 +11500,13 @@ rollup@2.77.0:
1150011500
optionalDependencies:
1150111501
fsevents "~2.3.2"
1150211502

11503+
rollup@2.79.2:
11504+
version "2.79.2"
11505+
resolved "https://registry.npmjs.org/rollup/-/rollup-2.79.2.tgz#f150e4a5db4b121a21a747d762f701e5e9f49090"
11506+
integrity sha512-fS6iqSPZDs3dr/y7Od6y5nha8dW1YnbgtsyotCVvoFGKbERG++CVRFv1meyGDE1SNItQA8BrnCw7ScdAhRJ3XQ==
11507+
optionalDependencies:
11508+
fsevents "~2.3.2"
11509+
1150311510
rollup@3.2.0:
1150411511
version "3.2.0"
1150511512
resolved "https://registry.npmjs.org/rollup/-/rollup-3.2.0.tgz#a6f44074418e55217967c8eca622f9638d396388"
@@ -12517,6 +12524,25 @@ ts-node@^10.9.1:
1251712524
v8-compile-cache-lib "^3.0.1"
1251812525
yn "3.1.1"
1251912526

12527+
ts-node@^10.9.2:
12528+
version "10.9.2"
12529+
resolved "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz#70f021c9e185bccdca820e26dc413805c101c71f"
12530+
integrity sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==
12531+
dependencies:
12532+
"@cspotcode/source-map-support" "^0.8.0"
12533+
"@tsconfig/node10" "^1.0.7"
12534+
"@tsconfig/node12" "^1.0.7"
12535+
"@tsconfig/node14" "^1.0.0"
12536+
"@tsconfig/node16" "^1.0.2"
12537+
acorn "^8.4.1"
12538+
acorn-walk "^8.1.1"
12539+
arg "^4.1.0"
12540+
create-require "^1.1.0"
12541+
diff "^4.0.1"
12542+
make-error "^1.1.1"
12543+
v8-compile-cache-lib "^3.0.1"
12544+
yn "3.1.1"
12545+
1252012546
tsconfig-paths@^3.9.0:
1252112547
version "3.14.2"
1252212548
resolved "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz#6e32f1f79412decd261f92d633a9dc1cfa99f088"

0 commit comments

Comments
 (0)