This commit is contained in:
NotII
2025-05-17 17:52:25 +01:00
parent e338a5d0b2
commit f8e3173067
13 changed files with 6 additions and 476 deletions

View File

@@ -17,16 +17,13 @@ const DEPRECATED_PATTERNS = [
"from '@/lib/shippingHelper'",
"from '@/lib/storeHelper'",
"from '@/lib/stats-service'",
// Add other deprecated import patterns here
];
// Run grep to find deprecated imports
function findDeprecatedImports() {
console.log('Searching for deprecated imports...\n');
DEPRECATED_PATTERNS.forEach(pattern => {
try {
// Using grep to find the pattern in all TypeScript/JavaScript files
const result = execSync(`grep -r "${pattern}" --include="*.ts" --include="*.tsx" --include="*.js" --include="*.jsx" .`, { encoding: 'utf8' });
if (result) {
@@ -36,7 +33,6 @@ function findDeprecatedImports() {
suggestReplacement(pattern);
}
} catch (error) {
// grep returns non-zero exit code if no matches found
if (error.status !== 1) {
console.error(`Error searching for ${pattern}:`, error.message);
}
@@ -45,14 +41,12 @@ function findDeprecatedImports() {
}
function suggestReplacement(pattern) {
// Extract the import path
const match = pattern.match(/from '([^']+)'/);
if (!match) return;
const oldPath = match[1];
let replacement = '';
// Generate replacement suggestions based on deprecated path
switch (oldPath) {
case '@/lib/client-utils':
case '@/lib/client-service':
@@ -83,7 +77,4 @@ function suggestReplacement(pattern) {
}
// Run the search
findDeprecatedImports();
// Uncomment the following line to run the remove-old-files.js script
// node scripts/remove-old-files.js
findDeprecatedImports();