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

let html = fs.readFileSync(path, 'utf8');

const injectionTarget = '<script src="petty_cash_module.js" defer></script>';
const injectionStr = '<script src="accounting_module.js" defer></script>\n  ';

if (!html.includes('accounting_module.js')) {
    html = html.replace(injectionTarget, injectionStr + injectionTarget);
    fs.writeFileSync(path, html, 'utf8');
    console.log('Injected accounting_module.js successfully');
} else {
    console.log('Already injected');
}
