- Global shortcut setting: press-to-record input (Esc cancels, Backspace clears); requires a modifier or F-key so plain typing can't be hijacked - Terminal toolbar: three settings-gated buttons — session-log record (default off), open logs dir (default off), open working directory (default on, new; local sessions only, cwd tracked via cd/OSC 7) - Input suggestions + command history now default off, with a one-time migration that resets persisted true values for existing installs - Settings dialog: fix broken scrolling — antd v6 renamed the Tabs scroll container to .ant-tabs-body-holder; theme gallery drops its nested scroll (single outer scrollbar) - Offline changelog: CHANGELOG.md at repo root bundled via ?raw; About tab reads it first, network sources stay as fallback; scripts/sync-changelog.cjs merges RELEASE_NOTES.md per release (release.cjs fails without an entry) - commands.ts history prefs default aligned with new off-by-default
40 lines
1.6 KiB
JavaScript
40 lines
1.6 KiB
JavaScript
/* Merge RELEASE_NOTES.md into CHANGELOG.md as the section for the current
|
|
package.json version. Idempotent: skips if the version is already present.
|
|
Run BEFORE `npm run dist` — the changelog is bundled into the app.
|
|
Usage: node scripts/sync-changelog.cjs */
|
|
const fs = require('node:fs')
|
|
const path = require('node:path')
|
|
|
|
const ROOT = path.join(__dirname, '..')
|
|
const pkgVersion = JSON.parse(fs.readFileSync(path.join(ROOT, 'package.json'), 'utf8')).version
|
|
const notesPath = path.join(ROOT, 'RELEASE_NOTES.md')
|
|
const changelogPath = path.join(ROOT, 'CHANGELOG.md')
|
|
const HEADER = '# OpenTerminal 更新日志'
|
|
|
|
const notes = fs.readFileSync(notesPath, 'utf8')
|
|
// Drop the notes' own leading title / `## vX` heading — the section heading
|
|
// is constructed here so CHANGELOG stays uniform (`## vX.Y.Z - date`).
|
|
.replace(/^#.*\n/gm, '')
|
|
.replace(new RegExp(`^## v${pkgVersion}.*\\n`), '')
|
|
.replace(/^\s+/, '')
|
|
.trimEnd()
|
|
|
|
if (!notes) {
|
|
console.error('RELEASE_NOTES.md is empty — write release notes first')
|
|
process.exit(1)
|
|
}
|
|
|
|
const section = `## v${pkgVersion} - ${new Date().toISOString().slice(0, 10)}\n\n${notes}\n`
|
|
const existing = fs.existsSync(changelogPath) ? fs.readFileSync(changelogPath, 'utf8') : ''
|
|
if (existing.includes(`## v${pkgVersion} `)) {
|
|
console.log(`CHANGELOG.md already has v${pkgVersion} — nothing to do`)
|
|
process.exit(0)
|
|
}
|
|
|
|
const updated = existing
|
|
? existing.replace(new RegExp(`^(${HEADER}\\n\\n)`), `$1${section}\n`)
|
|
: `${HEADER}\n\n${section}`
|
|
|
|
fs.writeFileSync(changelogPath, updated, 'utf8')
|
|
console.log(`CHANGELOG.md: added v${pkgVersion} (${notes.split('\n').length} lines)`)
|