From 7c335c7ed2f212125e85768090af0e39ebf4a2ea Mon Sep 17 00:00:00 2001 From: Slawomir Koszewski Date: Fri, 6 Nov 2026 19:06:46 +0100 Subject: [PATCH] fix: release.mjs reads a summary wrapped over several lines. --- CHANGELOG.md | 7 +++++++ release.mjs | 19 ++++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 16375b3..e291ce5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## 0.6.0-2 + +fix: release.mjs reads a summary wrapped over several lines. + +- `release.mjs` takes the summary of the newest entry as the paragraph after its heading and joins + its lines with single spaces into the commit message. + ## 0.6.0 feature: RowDialog validates a row as part of a larger value, such as a whole document with the row put in. diff --git a/release.mjs b/release.mjs index 5ca5767..e8bb535 100755 --- a/release.mjs +++ b/release.mjs @@ -10,8 +10,9 @@ const CHANGELOG = `${import.meta.dirname}/CHANGELOG.md`; const usage = `Usage: release.mjs [-h|--help] [-n|--dry-run] [--no-push] [-m|--message ] - -m, --message commit message; default: the summary line of the newest CHANGELOG.md entry, - the line between blank lines right after its "## x.y.z" or "## x.y.z-n" heading + -m, --message commit message; default: the summary of the newest CHANGELOG.md entry, the + paragraph between blank lines right after its "## x.y.z" or "## x.y.z-n" + heading, its lines joined with single spaces The tag is the version of the heading: x.y.z for a release of the code, which must be the version of package.json and which the build workflow publishes, x.y.z-n, n from 2, for a later release @@ -48,8 +49,8 @@ function git(...args) { if (status !== 0) process.exit(status ?? 1); } -// The newest entry: its version from the first "## x.y.z" or "## x.y.z-n" heading, n from 2, and its summary line when -// the heading is followed by a blank line, one line that is not a "-" item, and another blank line. +// The newest entry: its version from the first "## x.y.z" or "## x.y.z-n" heading, n from 2, and its summary when the +// heading is followed by a blank line and a paragraph that is not a "-" item; the paragraph's lines are joined with spaces. const lines = readFileSync(CHANGELOG, 'utf8').split('\n'); const heading = lines.findIndex((line) => line.startsWith('## ')); if (heading === -1) fail(`${CHANGELOG} has no "## x.y.z" entry`); @@ -65,12 +66,16 @@ const packageVersion = JSON.parse(readFileSync(`${import.meta.dirname}/package.j if (revision === undefined && version !== packageVersion) { fail(`${CHANGELOG}: ${tag} is not the version of package.json, ${packageVersion}`); } -const [above, line, below] = lines.slice(heading + 1, heading + 4); -const summary = above?.trim() === '' && below?.trim() === '' && line?.trim() && !line.startsWith('-') && !line.startsWith('#') ? line.trim() : undefined; +const end = lines.findIndex((line, index) => index > heading + 1 && line.trim() === ''); +const paragraph = end === -1 ? [] : lines.slice(heading + 2, end); +const summary = + lines[heading + 1]?.trim() === '' && paragraph.length > 0 && !paragraph[0].startsWith('-') && !paragraph.some((line) => line.startsWith('#')) + ? paragraph.map((line) => line.trim()).join(' ') + : undefined; const message = values.message ?? summary; if (!message) { - fail(`no commit message: pass -m, or put a summary line between blank lines right after the newest heading of ${CHANGELOG}`); + fail(`no commit message: pass -m, or put a summary paragraph between blank lines right after the newest heading of ${CHANGELOG}`); } if (spawnSync('git', ['rev-parse', '-q', '--verify', `refs/tags/${tag}`], { cwd: import.meta.dirname }).status === 0) {