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

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

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

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