17 lines
610 B
JavaScript
17 lines
610 B
JavaScript
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
// Generate version number with timestamp
|
|
const version = new Date().toISOString().replace(/[-:.]/g, '').slice(0, 15);
|
|
|
|
// Read the HTML file
|
|
const indexPath = path.join(__dirname, 'public', 'index.html');
|
|
let indexHtml = fs.readFileSync(indexPath, 'utf8');
|
|
|
|
// Replace the version placeholder with the generated version number
|
|
indexHtml = indexHtml.replace(/<!-- VERSION_PLACEHOLDER -->/g, `Version: ${version}`);
|
|
|
|
// Write the updated HTML back to the file
|
|
fs.writeFileSync(indexPath, indexHtml);
|
|
|
|
console.log(`Version number updated to: ${version}`); |