mirror of
https://github.com/SableClient/Sable.git
synced 2026-11-20 00:51:17 -08:00
fix(flatpak): read the changelog date without building a regex from input
This commit is contained in:
1 file changed
+6
-3
@@ -15,9 +15,12 @@ if (!version || !/^\d+\.\d+\.\d+/.test(version)) {
|
||||
}
|
||||
|
||||
const changelog = readFileSync('CHANGELOG.md', 'utf8');
|
||||
const date = changelog.match(
|
||||
new RegExp(`\\n## ${version.replaceAll('.', '\\.')} \\((\\d{4}-\\d{2}-\\d{2})\\)`)
|
||||
)?.[1];
|
||||
const heading = `\n## ${version} (`;
|
||||
const start = changelog.indexOf(heading);
|
||||
const date =
|
||||
start === -1
|
||||
? undefined
|
||||
: changelog.slice(start + heading.length).match(/^(\d{4}-\d{2}-\d{2})\)/)?.[1];
|
||||
if (!date) {
|
||||
console.error(`No "## ${version} (YYYY-MM-DD)" section in CHANGELOG.md`);
|
||||
process.exit(1);
|
||||
|
||||
Reference in new issue
Block a user