Release notes: a story for big releases, and the 2.0 story
A CHANGELOG section may open with prose before its first bullet. The build bakes it into the page and version.json, and "What's new" tells it in full with a link to every change on GitHub instead of the first sentences of five bullets. The 2.0.0 section gets its story and every change grouped under headings, Architect runs included.
This commit is contained in:
parent
dbd2fa7b55
commit
abd55c0846
8 changed files with 150 additions and 49 deletions
|
|
@ -1,10 +1,12 @@
|
|||
#!/usr/bin/env node
|
||||
// Prints the CHANGELOG.md bullets for one version as a JSON array of strings.
|
||||
// Usage: node scripts/release-notes.js 1.2.0
|
||||
// node scripts/release-notes.js 2.0.0 --story the release's story instead: the paragraphs of prose between
|
||||
// its heading and its first bullet or ### heading (often none)
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
const version = process.argv[2];
|
||||
const version = process.argv[2], story = process.argv.includes('--story');
|
||||
const text = fs.readFileSync(path.join(__dirname, '..', 'CHANGELOG.md'), 'utf8');
|
||||
const lines = text.split('\n');
|
||||
const start = lines.findIndex((l) => l.startsWith(`## [${version}]`));
|
||||
|
|
@ -16,4 +18,15 @@ if (start >= 0) {
|
|||
else if (/^\s{2,}\S/.test(l) && notes.length) notes[notes.length - 1] += ' ' + l.trim();
|
||||
}
|
||||
}
|
||||
process.stdout.write(JSON.stringify(notes));
|
||||
if (story) {
|
||||
const paras = [];
|
||||
if (start >= 0) {
|
||||
let cur = [];
|
||||
for (let i = start + 1; i < lines.length && !lines[i].startsWith('## [') && !/^\s*-\s+/.test(lines[i]) && !lines[i].startsWith('###'); i++) {
|
||||
const l = lines[i].trim();
|
||||
if (l) cur.push(l); else if (cur.length) { paras.push(cur.join(' ')); cur = []; }
|
||||
}
|
||||
if (cur.length) paras.push(cur.join(' '));
|
||||
}
|
||||
process.stdout.write(JSON.stringify(paras));
|
||||
} else process.stdout.write(JSON.stringify(notes));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue