Files
TimeTracker/desktop/scripts/clean-cache.js
T
Dries Peeters 1419712a60 feat: Add mobile (Flutter) and desktop (Electron) applications
- Add Flutter mobile app with authentication, timer, projects, and time entries
- Add Electron desktop app with system tray integration and offline support
- Implement offline storage with sync queue for both platforms
- Add comprehensive build scripts for cross-platform builds
- Include documentation and README files for both apps
- Add test suites for mobile and desktop applications
2026-01-11 08:37:28 +01:00

49 lines
1.5 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env node
/**
* Clean electron-builder cache
* Helps resolve permission/symlink issues on Windows
*/
const { execSync } = require('child_process');
const os = require('os');
const path = require('path');
const fs = require('fs');
const platform = os.platform();
const cacheDir = path.join(os.homedir(),
platform === 'win32'
? 'AppData/Local/electron-builder/Cache'
: platform === 'darwin'
? 'Library/Caches/electron-builder'
: '.cache/electron-builder'
);
console.log(`\n🧹 Cleaning electron-builder cache...\n`);
console.log(`📁 Cache directory: ${cacheDir}\n`);
try {
if (fs.existsSync(cacheDir)) {
if (platform === 'win32') {
// Windows: use rmdir command
try {
execSync(`rmdir /s /q "${cacheDir}"`, { stdio: 'inherit' });
console.log('✅ Cache cleaned successfully!');
} catch (error) {
console.error('❌ Failed to clean cache. Try running as Administrator.');
console.error(' Or manually delete:', cacheDir);
process.exit(1);
}
} else {
// Unix: use rm command
execSync(`rm -rf "${cacheDir}"`, { stdio: 'inherit' });
console.log('✅ Cache cleaned successfully!');
}
} else {
console.log('️ Cache directory does not exist (already clean)');
}
} catch (error) {
console.error('❌ Error cleaning cache:', error.message);
console.error(' Try running as Administrator (Windows) or with sudo (Unix)');
process.exit(1);
}