const fs = require('fs'); let content = fs.readFileSync('frontend/src/menuAside.ts', 'utf8'); // Replace READ_ with UPDATE_ for specific items const itemsToUpdate = [ 'READ_CUSTOMERS', 'READ_VEHICLES', 'READ_WORKERS_COMP_CLASSES', 'READ_PAY_TYPES', 'READ_EMPLOYEE_PAY_TYPES', 'READ_CHEMICAL_PRODUCTS', 'READ_JOB_CHEMICAL_USAGES', ]; itemsToUpdate.forEach(perm => { content = content.replace(new RegExp(`permissions: '${perm}'`, 'g'), `permissions: '${perm.replace('READ_', 'UPDATE_')}'`); }); // For All Job Logs, we need to be careful not to replace My Logs which is also READ_JOB_LOGS content = content.replace(/label: 'All Job Logs',\n\s*icon: [^,]+,\n\s*permissions: 'READ_JOB_LOGS'/g, (match) => { return match.replace("permissions: 'READ_JOB_LOGS'", "permissions: 'UPDATE_JOB_LOGS'"); }); fs.writeFileSync('frontend/src/menuAside.ts', content); console.log("Patched menuAside.ts");