Dine360-Marketing-Website/do_replacements.mjs

44 lines
1.8 KiB
JavaScript

import fs from 'fs';
// 1. fast-food page
let fastFoodPath = 'src/app/restaurant-types/fast-food/page.tsx';
let fastFood = fs.readFileSync(fastFoodPath, 'utf8');
const multiBranchImport = "import FastFoodMultiBranch from '@/assets/restaurant/types/fast-food-restaurant/MULTI BRANCH RESTAURANTS.webp';\n";
if (!fastFood.includes('FastFoodMultiBranch')) {
fastFood = fastFood.replace(/(import FastFood1 [^\n]+\n)/, `$1${multiBranchImport}`);
}
fastFood = fastFood.replace(
/"https:\/\/images\.unsplash\.com\/photo-1552566626-52f8b828add9\?auto=format&fit=crop&q=80&w=800"/,
"{FastFoodMultiBranch}"
);
fs.writeFileSync(fastFoodPath, fastFood);
// 2. fine-dining page
let fineDiningPath = 'src/app/restaurant-types/fine-dining/page.tsx';
let fineDining = fs.readFileSync(fineDiningPath, 'utf8');
fineDining = fineDining.replace(
/"https:\/\/images\.unsplash\.com\/photo-1551218808-94e220e084d2\?auto=format&fit=crop&q=80&w=600",/,
"Journey3,"
);
fineDining = fineDining.replace(
/"https:\/\/images\.unsplash\.com\/photo-1467003909585-2f8a72700288\?auto=format&fit=crop&q=80&w=600",/,
"Journey2,"
);
fs.writeFileSync(fineDiningPath, fineDining);
// 3. Remove commented out URLs
let footerPath = 'src/components/Footer.tsx';
let footer = fs.readFileSync(footerPath, 'utf8');
footer = footer.replace(/.*https:\/\/cdn-icons-png\.flaticon\.com.*\n/g, "");
footer = footer.replace(/.*https:\/\/images\.unsplash\.com\/photo-1543353071-10c8ba85a904.*\n/g, "");
fs.writeFileSync(footerPath, footer);
let testimonialsPath = 'src/components/Testimonials.tsx';
let testimonials = fs.readFileSync(testimonialsPath, 'utf8');
testimonials = testimonials.replace(/.*https:\/\/images\.unsplash\.com\/photo-1592924357228-91a4daadcfea.*\n/g, "");
fs.writeFileSync(testimonialsPath, testimonials);
console.log("Replacements done");