assayo/scripts/add-local.js
2024-09-07 01:55:28 +03:00

17 lines
568 B
JavaScript

const fs = require('node:fs');
const prefixes = [ './', '../', '../../', '/'];
const suffixes = (new Array(6)).fill(1).map((a, i) => i + 1);
const paths = [];
prefixes.forEach((prefix) => {
paths.push(`<script src='${prefix}log.txt'></script>`);
suffixes.forEach((suffix) => {
paths.push(`<script src='${prefix}log-${suffix}.txt'></script>`);
});
});
const content = paths.join('');
const html = fs.readFileSync('../build/index.html', 'utf8');
const text = html.replace(/<\/title>/gim, `</title>${content}`);
fs.writeFileSync('../build/index.html', text);