chokibasic 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/readme.md +3 -0
- package/src/watcher.js +2 -0
package/package.json
CHANGED
package/readme.md
CHANGED
package/src/watcher.js
CHANGED
|
@@ -361,6 +361,7 @@ async function copyFilePreserveTree(absSrc, src, dist, ig) {
|
|
|
361
361
|
async function walkAndCopy(dir, src, dest, ig, stats, banner = null) {
|
|
362
362
|
const entries = await fsprom.readdir(dir, { withFileTypes: true });
|
|
363
363
|
const bannerContent = (await fsprom.readFile(banner || path.join(__dirname, 'banner.txt'), 'utf8')).replace(/###DATE###/, formatFrDate());
|
|
364
|
+
const today = (d => `${d.getFullYear()}-${String(d.getMonth()+1).padStart(2,'0')}-${String(d.getDate()).padStart(2,'0')}`)(new Date());
|
|
364
365
|
|
|
365
366
|
for (const de of entries) {
|
|
366
367
|
const abs = path.join(dir, de.name);
|
|
@@ -381,6 +382,7 @@ async function walkAndCopy(dir, src, dest, ig, stats, banner = null) {
|
|
|
381
382
|
else if (lower.endsWith('.html')) await fsprom.writeFile(copied, "<!--\n\n" + bannerContent + "\n\n\-->\n" + (await fsprom.readFile(copied, 'utf8'))
|
|
382
383
|
.replaceAll(/###YEAR###/g, (new Date).getFullYear())
|
|
383
384
|
.replaceAll(/###TIMESTAMP###/g, Math.floor(Date.now() / 1000)), "utf8");
|
|
385
|
+
else if (lower.endsWith('sitemap.xml')) await fsprom.writeFile(copied, (await fsprom.readFile(copied, 'utf8')).replaceAll(/###TODAY###/g, today), "utf8");
|
|
384
386
|
stats.copied++;
|
|
385
387
|
}
|
|
386
388
|
else stats.skipped++;
|