weewoo
This commit is contained in:
80
scripts/cleanup-codebase.js
Normal file
80
scripts/cleanup-codebase.js
Normal file
@@ -0,0 +1,80 @@
|
||||
/**
|
||||
* Main script to clean up the codebase by finding deprecated imports and files
|
||||
* Run with: node scripts/cleanup-codebase.js
|
||||
*/
|
||||
|
||||
const { execSync } = require('child_process');
|
||||
const path = require('path');
|
||||
|
||||
// Print a separator for readability
|
||||
function printSeparator() {
|
||||
console.log('\n' + '='.repeat(80) + '\n');
|
||||
}
|
||||
|
||||
// Run a script and print its output
|
||||
function runScript(scriptPath) {
|
||||
try {
|
||||
console.log(`Running ${path.basename(scriptPath)}...\n`);
|
||||
const output = execSync(`node ${scriptPath}`, { encoding: 'utf8' });
|
||||
console.log(output);
|
||||
} catch (error) {
|
||||
console.error(`Error running ${scriptPath}:`, error.message);
|
||||
console.error(error.stdout);
|
||||
}
|
||||
}
|
||||
|
||||
// Main function to run all cleanup scripts
|
||||
function main() {
|
||||
console.log(`
|
||||
✨ Ember Market Frontend Cleanup Utility ✨
|
||||
|
||||
This script will help you clean up your codebase by:
|
||||
1. Finding deprecated imports that should be updated
|
||||
2. Identifying files that can be safely removed
|
||||
3. Organizing the lib folder into a proper structure
|
||||
|
||||
`);
|
||||
|
||||
// First, find deprecated imports
|
||||
printSeparator();
|
||||
console.log('STEP 1: FINDING DEPRECATED IMPORTS');
|
||||
printSeparator();
|
||||
runScript(path.join(__dirname, 'find-deprecated-imports.js'));
|
||||
|
||||
// Then, identify files that can be removed
|
||||
printSeparator();
|
||||
console.log('STEP 2: IDENTIFYING DEPRECATED FILES');
|
||||
printSeparator();
|
||||
runScript(path.join(__dirname, 'cleanup-deprecated-files.js'));
|
||||
|
||||
// Finally, organize the lib folder
|
||||
printSeparator();
|
||||
console.log('STEP 3: ORGANIZING LIB FOLDER');
|
||||
printSeparator();
|
||||
runScript(path.join(__dirname, 'organize-lib-folder.js'));
|
||||
|
||||
// Final instructions
|
||||
printSeparator();
|
||||
console.log(`
|
||||
NEXT STEPS:
|
||||
|
||||
1. Review the lib directory to ensure files are properly organized
|
||||
2. Verify that existing code still imports everything correctly
|
||||
3. Run tests to ensure everything still works correctly
|
||||
|
||||
The new structure is:
|
||||
- lib/api.ts - Main API entry point that exports all API functions
|
||||
- lib/utils/ - Contains utility functions organized by purpose
|
||||
- lib/types/ - Contains TypeScript type definitions
|
||||
- lib/services/ - Contains service implementations
|
||||
|
||||
For ongoing maintenance:
|
||||
- Always import from @/lib/api for API functionality
|
||||
- Use @/lib/utils for utility functions
|
||||
- Add new types to the appropriate types file
|
||||
- Add new services to the services directory
|
||||
`);
|
||||
}
|
||||
|
||||
// Run the main function
|
||||
main();
|
||||
Reference in New Issue
Block a user