mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-07-17 16:37:43 +00:00
- capacitor-platform: inject IS_ANDROID_WEB_VIEW_TOKEN instead of an inline window.SUPAndroid check - task.selectors: extract isCalendarIssueTask helper (was duplicated) - sync-import-filter: use isFullStateOpType helper for op-type checks - take-a-break: drop unreachable BREAK branch in reduce (guarded above) - plugin-api: remove unused header/menu/shortcut/side-panel tracking arrays - task-list / task-hover-controls: remove unused drop() arg and inputs - is-today: remove unused isYesterday - migrate-to-droid-log: collapse repeated import checks into one regex
58 lines
1.7 KiB
TypeScript
Executable file
58 lines
1.7 KiB
TypeScript
Executable file
#!/usr/bin/env ts-node
|
|
|
|
import * as fs from 'fs';
|
|
|
|
const filesToMigrate = [
|
|
'src/app/core/persistence/android-db-adapter.service.ts',
|
|
'src/app/features/android/android-interface.ts',
|
|
'src/app/features/android/store/android.effects.ts',
|
|
];
|
|
|
|
const CORE_LOG_IMPORT_RE = /from\s*['"][^'"]*core\/log['"]/;
|
|
|
|
const migrateFile = (filePath: string): void => {
|
|
console.log(`Processing ${filePath}...`);
|
|
|
|
let content = fs.readFileSync(filePath, 'utf8');
|
|
let modified = false;
|
|
|
|
// Replace Log.* method calls with DroidLog.*
|
|
const logPattern = /\bLog\.(log|err|error|info|warn|debug|verbose|critical)\b/g;
|
|
if (logPattern.test(content)) {
|
|
content = content.replace(logPattern, 'DroidLog.$1');
|
|
modified = true;
|
|
}
|
|
|
|
// Update imports
|
|
if (modified) {
|
|
// Check if file already imports from log
|
|
if (CORE_LOG_IMPORT_RE.test(content)) {
|
|
// Replace Log import with DroidLog
|
|
content = content.replace(
|
|
/import\s*{\s*([^}]*)\bLog\b([^}]*)\}\s*from\s*['"][^'"]*core\/log['"]/g,
|
|
(match, before, after) => {
|
|
const imports = (before + after)
|
|
.split(',')
|
|
.map((s) => s.trim())
|
|
.filter((s) => s && s !== 'Log');
|
|
imports.push('DroidLog');
|
|
return `import { ${imports.join(', ')} } from '${match.includes('"') ? match.split('"')[1] : match.split("'")[1]}'`;
|
|
},
|
|
);
|
|
} else {
|
|
console.log(`Warning: Could not find log import in ${filePath}`);
|
|
}
|
|
}
|
|
|
|
if (modified) {
|
|
fs.writeFileSync(filePath, content);
|
|
console.log(`✓ Migrated ${filePath}`);
|
|
} else {
|
|
console.log(`- No changes needed in ${filePath}`);
|
|
}
|
|
};
|
|
|
|
// Process all files
|
|
filesToMigrate.forEach(migrateFile);
|
|
|
|
console.log('\nMigration complete!');
|