Skip to content

Commit 2cf67b0

Browse files
authored
chore: fix changelog log on release command (#483)
1 parent 2e69ea4 commit 2cf67b0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

scripts/release.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { readFileSync, writeFileSync } from 'node:fs'
22
import { release } from '@vitejs/release-scripts'
33
import colors from 'picocolors'
44

5+
const nextH2RE = /^## /gm
6+
57
release({
68
repo: 'vite-plugin-react',
79
packages: ['plugin-react', 'plugin-react-swc', 'plugin-react-oxc'],
@@ -18,11 +20,9 @@ release({
1820
throw new Error("Can't find '## Unreleased' section in CHANGELOG.md")
1921
}
2022
const index = changelog.indexOf('## Unreleased') + 13
21-
console.log(
22-
colors.dim(
23-
changelog.slice(index, changelog.indexOf('## ', index)).trim(),
24-
),
25-
)
23+
nextH2RE.lastIndex = index
24+
const nextH2Pos = nextH2RE.exec(changelog)?.index
25+
console.log(colors.dim(changelog.slice(index, nextH2Pos).trim()))
2626
},
2727
generateChangelog: async (pkgName, version) => {
2828
if (pkgName === 'plugin-react-swc') {

0 commit comments

Comments
 (0)