forked from OpenWhispr/openwhispr
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcleanup.js
More file actions
42 lines (36 loc) · 1.37 KB
/
Copy pathcleanup.js
File metadata and controls
42 lines (36 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
const path = require("path");
const fs = require("fs");
const os = require("os");
// Clean build directories
console.log("🧹 Cleaning build directories...");
const dirsToClean = ["dist/", "src/dist/", "node_modules/.cache/"];
dirsToClean.forEach((dir) => {
if (fs.existsSync(dir)) {
fs.rmSync(dir, { recursive: true, force: true });
console.log(`✅ Cleaned: ${dir}`);
} else {
console.log(`ℹ️ Directory not found: ${dir}`);
}
});
// Clean development database
console.log("🗄️ Cleaning development database...");
try {
// Use the same logic as the database.js file to determine the user data path
const userDataPath =
process.platform === "darwin"
? path.join(os.homedir(), "Library", "Application Support", "open-whispr")
: process.platform === "win32"
? path.join(process.env.APPDATA || os.homedir(), "open-whispr")
: path.join(os.homedir(), ".config", "open-whispr");
const devDbPath = path.join(userDataPath, "transcriptions-dev.db");
// Clean development database
if (fs.existsSync(devDbPath)) {
fs.unlinkSync(devDbPath);
console.log(`✅ Development database cleaned: ${devDbPath}`);
} else {
console.log("ℹ️ No development database found to clean");
}
} catch (error) {
console.error("❌ Error cleaning database files:", error.message);
}
console.log("✨ Cleanup completed successfully!");