You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
/*
|
|
|
|
* https://github.com/morethanwords/tweb
|
|
|
|
* Copyright (C) 2019-2021 Eduard Kuzmenko
|
|
|
|
* https://github.com/morethanwords/tweb/blob/master/LICENSE
|
|
|
|
*/
|
|
|
|
|
|
|
|
// @ts-check
|
|
|
|
|
|
|
|
const fs = require('fs');
|
|
|
|
const text = fs.readFileSync('./CHANGELOG.md').toString('utf-8');
|
|
|
|
|
|
|
|
const writeTo = `./public/changelogs/{VERSION}.md`;
|
|
|
|
|
|
|
|
const separator = '### ';
|
|
|
|
const splitted = text.split(separator);
|
|
|
|
splitted.forEach(text => {
|
|
|
|
if(!text.trim()) return;
|
|
|
|
text = separator + text;
|
|
|
|
text = text.replace(/^\*/gm, '•');
|
|
|
|
const splitted = text.split('\n');
|
|
|
|
|
|
|
|
for(let i = splitted.length - 1; i >= 0; --i) {
|
|
|
|
const line = splitted[i];
|
|
|
|
if(!line.trim()) {
|
|
|
|
splitted.splice(i, 1);
|
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const firstLine = splitted.shift();
|
|
|
|
const version = firstLine.split(' ')[1];
|
|
|
|
fs.writeFileSync(writeTo.replace('{VERSION}', version), splitted.join('\n') + '\n');
|
|
|
|
});
|