import fs from 'fs';
import path from 'path';
const filesToFix = [
'src/app/(marketing)/specialty-manufacturing/[slug]/page.tsx',
'src/app/(marketing)/specialty-manufacturing/page.tsx',
'src/app/(marketing)/solutions/[slug]/page.tsx',
'src/app/(marketing)/solutions/page.tsx',
'src/app/(marketing)/insights/page.tsx',
'src/app/(marketing)/industries/[slug]/page.tsx',
'src/app/(marketing)/industries/page.tsx',
'src/app/(marketing)/case-studies/[slug]/page.tsx',
];

filesToFix.forEach(relPath => {
const fullPath = path.join(process.cwd(), relPath);
if (fs.existsSync(fullPath)) {
let content = fs.readFileSync(fullPath, 'utf8');
// Replace force-dynamic and revalidate = 0
content = content.replace(/export const dynamic = ['"]force-dynamic['"];?( \/\/.*)?\n/g, '');
content = content.replace(/export const revalidate = 0;\n/g, 'export const revalidate = 60;\n');
// Fallback if revalidate wasn't there
if (!content.includes('export const revalidate')) {
content = content.replace(/(import .*?\n\n)/, '$1export const revalidate = 60;\n\n');
}
fs.writeFileSync(fullPath, content);
console.log(`Fixed ${relPath}`);
}
});
