Refactor API files to provide mock implementations for analytics, auth, collections, ratings, scripts, and users, streamlining the codebase for frontend-only functionality. Remove legacy database schema and browser compatibility files to enhance clarity and maintainability.
This commit is contained in:
29
restore-apis.cjs
Normal file
29
restore-apis.cjs
Normal file
@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
console.log('🔄 Restoring real APIs...');
|
||||
|
||||
// Remove mock APIs
|
||||
if (fs.existsSync('src/lib/api')) {
|
||||
fs.rmSync('src/lib/api', { recursive: true });
|
||||
}
|
||||
if (fs.existsSync('src/lib/db')) {
|
||||
fs.rmSync('src/lib/db', { recursive: true });
|
||||
}
|
||||
|
||||
// Restore real APIs from backup
|
||||
if (fs.existsSync('temp_api_backup')) {
|
||||
if (fs.existsSync('temp_api_backup/api')) {
|
||||
fs.cpSync('temp_api_backup/api', 'src/lib/api', { recursive: true });
|
||||
}
|
||||
if (fs.existsSync('temp_api_backup/db')) {
|
||||
fs.cpSync('temp_api_backup/db', 'src/lib/db', { recursive: true });
|
||||
}
|
||||
|
||||
console.log('✅ Restored real APIs! You can now use the full database functionality');
|
||||
console.log('📝 To switch back to mocks for building, run: node switch-to-mocks.cjs');
|
||||
} else {
|
||||
console.log('❌ No backup found! Cannot restore real APIs');
|
||||
}
|
Reference in New Issue
Block a user