const fs = require('fs');
let html = fs.readFileSync('d:/برنامج مخازن/index.html', 'utf8');

const v = '?v=' + Date.now();

['app_final.js', 'entities_module.js', 'store_module.js', 'contractors_module.js'].forEach(script => {
    // Replace script.js or script.js?v=123 with script.js?v=newTime
    const regex = new RegExp(script.replace('.', '\\.') + '(\\?v=\\d+)?', 'g');
    html = html.replace(regex, script + v);
});

fs.writeFileSync('d:/برنامج مخازن/index.html', html, 'utf8');
console.log('Cache busted.');
