New build infra

This commit is contained in:
SukkaW
2022-12-08 18:10:59 +08:00
parent 6646a1ec98
commit ffb4e24e8a
14 changed files with 353 additions and 78 deletions

View File

@@ -6,12 +6,33 @@
* @returns {string}
*/
const withBanner = (title, description, date, content) => {
return `########################################
return `########################################
# ${title}
${description.map(line => `# ${line}`).join('\n')}
# Last Updated: ${date.toISOString()}
# Size: ${content.length}
${description.map(line => line ? `# ${line}` : '#').join('\n')}
########################################\n` + content.join('\n') + '\n################# END ###################\n';
};
/**
* @param {string} title
* @param {string[]} description
* @param {Date} date
* @param {string[]} content
* @returns {string[]}
*/
const withBannerArray = (title, description, date, content) => {
return [
`########################################`,
`# ${title}`,
`# Last Updated: ${date.toISOString()}`,
`# Size: ${content.length}`,
...description.map(line => line ? `# ${line}` : '#'),
`########################################`,
...content,
`################# END ###################`,
''
];
};
module.exports.withBanner = withBanner;
module.exports.withBannerArray = withBannerArray;