const fs = require('fs');

if (fs.existsSync('vouchers_returns.js')) {
    let js = fs.readFileSync('vouchers_returns.js', 'utf8');
    
    // Fix description -> desc
    const searchString = "description: descStr,";
    const replaceString = "desc: descStr,";
    
    js = js.replace(searchString, replaceString);

    fs.writeFileSync('vouchers_returns.js', js, 'utf8');
    console.log('Patched description to desc in vouchers_returns.js');
}

// Cache buster
let html = fs.readFileSync('index.html', 'utf8');
html = html.replace(/v=\d+/g, 'v=' + Date.now());
fs.writeFileSync('index.html', html, 'utf8');
