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

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

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

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