read readme changes
This commit is contained in:
@@ -36,15 +36,23 @@ function getReadmeFileName() {
|
||||
}
|
||||
function readReadmeFile(readmeFile) {
|
||||
let content = (0, fs_1.readFileSync)(readmeFile).toString();
|
||||
const regex = /<!-- START INSTALL LINKS -->(?:.|\n)*?<!-- END INSTALL LINKS -->/;
|
||||
const regex = /\n{0,1}<!-- START INSTALL LINKS -->(?:.|\n)*?<!-- END INSTALL LINKS -->\n{0,1}/;
|
||||
const index = regex.exec(content)?.index;
|
||||
let contentPre = '', contentPost = '';
|
||||
if (index === undefined) {
|
||||
if (!content.endsWith('\n')) {
|
||||
content += '\n';
|
||||
}
|
||||
return [content, ''];
|
||||
contentPre = content;
|
||||
}
|
||||
content = content.replace(regex, '');
|
||||
return [content.slice(0, index), content.slice(index)];
|
||||
else {
|
||||
content = content.replace(regex, '');
|
||||
contentPre = content.slice(0, index);
|
||||
contentPost = content.slice(index);
|
||||
}
|
||||
if (!contentPre.endsWith('\n')) {
|
||||
contentPre += '\n';
|
||||
}
|
||||
if (!contentPost.endsWith('\n')) {
|
||||
contentPost += '\n';
|
||||
}
|
||||
return [contentPre, contentPost];
|
||||
}
|
||||
//# sourceMappingURL=readmefile.js.map
|
||||
Reference in New Issue
Block a user