import { spawn } from 'child_process'; import path from 'path'; import { fileURLToPath } from 'url'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); /** * Script to update category icons in the database * This runs the seed-supabase.ts script with a focus on updating emoji icons to Lucide React icons */ async function main() { console.log('Starting category icon update...'); // Run the seed-supabase.ts script const seedScript = path.join(__dirname, 'seed-supabase.ts'); const child = spawn('npx', ['ts-node', '--esm', seedScript], { stdio: 'inherit', shell: true }); return new Promise((resolve, reject) => { child.on('close', (code) => { if (code === 0) { console.log('Category icon update completed successfully'); resolve(null); } else { console.error(`Category icon update failed with code ${code}`); reject(new Error(`Process exited with code ${code}`)); } }); child.on('error', (err) => { console.error('Error running seed script:', err); reject(err); }); }); } main() .then(() => process.exit(0)) .catch((error) => { console.error('Unhandled error:', error); process.exit(1); });