Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7c335c7ed2 |
No files matched your search
@@ -1,5 +1,12 @@
|
|||||||
# Changelog
|
# 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
|
## 0.6.0
|
||||||
|
|
||||||
feature: RowDialog validates a row as part of a larger value, such as a whole document with the row put in.
|
feature: RowDialog validates a row as part of a larger value, such as a whole document with the row put in.
|
||||||
|
|||||||
+12
-7
@@ -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 <message>]
|
const usage = `Usage: release.mjs [-h|--help] [-n|--dry-run] [--no-push] [-m|--message <message>]
|
||||||
|
|
||||||
-m, --message commit message; default: the summary line of the newest CHANGELOG.md entry,
|
-m, --message commit message; default: the summary of the newest CHANGELOG.md entry, the
|
||||||
the line between blank lines right after its "## x.y.z" or "## x.y.z-n" heading
|
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
|
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
|
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);
|
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 newest entry: its version from the first "## x.y.z" or "## x.y.z-n" heading, n from 2, and its summary when the
|
||||||
// the heading is followed by a blank line, one line that is not a "-" item, and another blank line.
|
// 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 lines = readFileSync(CHANGELOG, 'utf8').split('\n');
|
||||||
const heading = lines.findIndex((line) => line.startsWith('## '));
|
const heading = lines.findIndex((line) => line.startsWith('## '));
|
||||||
if (heading === -1) fail(`${CHANGELOG} has no "## x.y.z" entry`);
|
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) {
|
if (revision === undefined && version !== packageVersion) {
|
||||||
fail(`${CHANGELOG}: ${tag} is not the version of package.json, ${packageVersion}`);
|
fail(`${CHANGELOG}: ${tag} is not the version of package.json, ${packageVersion}`);
|
||||||
}
|
}
|
||||||
const [above, line, below] = lines.slice(heading + 1, heading + 4);
|
const end = lines.findIndex((line, index) => index > heading + 1 && line.trim() === '');
|
||||||
const summary = above?.trim() === '' && below?.trim() === '' && line?.trim() && !line.startsWith('-') && !line.startsWith('#') ? line.trim() : undefined;
|
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;
|
const message = values.message ?? summary;
|
||||||
if (!message) {
|
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) {
|
if (spawnSync('git', ['rev-parse', '-q', '--verify', `refs/tags/${tag}`], { cwd: import.meta.dirname }).status === 0) {
|
||||||
|
|||||||
Reference in new issue
Block a user