squeaky-clean 0.1.7 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +25 -23
- package/dist/cleaners/BaseCleaner.d.ts +0 -57
- package/dist/cleaners/BaseCleaner.d.ts.map +0 -1
- package/dist/cleaners/BaseCleaner.js +0 -299
- package/dist/cleaners/BaseCleaner.js.map +0 -1
- package/dist/cleaners/CleanerRegistry.d.ts +0 -65
- package/dist/cleaners/CleanerRegistry.d.ts.map +0 -1
- package/dist/cleaners/CleanerRegistry.js +0 -112
- package/dist/cleaners/CleanerRegistry.js.map +0 -1
- package/dist/cleaners/androidstudio.d.ts +0 -16
- package/dist/cleaners/androidstudio.d.ts.map +0 -1
- package/dist/cleaners/androidstudio.js +0 -375
- package/dist/cleaners/androidstudio.js.map +0 -1
- package/dist/cleaners/brew.d.ts +0 -4
- package/dist/cleaners/brew.d.ts.map +0 -1
- package/dist/cleaners/brew.js +0 -197
- package/dist/cleaners/brew.js.map +0 -1
- package/dist/cleaners/brewEnhanced.d.ts +0 -18
- package/dist/cleaners/brewEnhanced.d.ts.map +0 -1
- package/dist/cleaners/brewEnhanced.js +0 -255
- package/dist/cleaners/brewEnhanced.js.map +0 -1
- package/dist/cleaners/bun.d.ts +0 -14
- package/dist/cleaners/bun.d.ts.map +0 -1
- package/dist/cleaners/bun.js +0 -207
- package/dist/cleaners/bun.js.map +0 -1
- package/dist/cleaners/cargo.d.ts +0 -15
- package/dist/cleaners/cargo.d.ts.map +0 -1
- package/dist/cleaners/cargo.js +0 -193
- package/dist/cleaners/cargo.js.map +0 -1
- package/dist/cleaners/chrome.d.ts +0 -14
- package/dist/cleaners/chrome.d.ts.map +0 -1
- package/dist/cleaners/chrome.js +0 -250
- package/dist/cleaners/chrome.js.map +0 -1
- package/dist/cleaners/cocoapods.d.ts +0 -16
- package/dist/cleaners/cocoapods.d.ts.map +0 -1
- package/dist/cleaners/cocoapods.js +0 -180
- package/dist/cleaners/cocoapods.js.map +0 -1
- package/dist/cleaners/docker.d.ts +0 -35
- package/dist/cleaners/docker.d.ts.map +0 -1
- package/dist/cleaners/docker.js +0 -285
- package/dist/cleaners/docker.js.map +0 -1
- package/dist/cleaners/firefox.d.ts +0 -15
- package/dist/cleaners/firefox.d.ts.map +0 -1
- package/dist/cleaners/firefox.js +0 -281
- package/dist/cleaners/firefox.js.map +0 -1
- package/dist/cleaners/flutter.d.ts +0 -18
- package/dist/cleaners/flutter.d.ts.map +0 -1
- package/dist/cleaners/flutter.js +0 -354
- package/dist/cleaners/flutter.js.map +0 -1
- package/dist/cleaners/goBuild.d.ts +0 -18
- package/dist/cleaners/goBuild.d.ts.map +0 -1
- package/dist/cleaners/goBuild.js +0 -196
- package/dist/cleaners/goBuild.js.map +0 -1
- package/dist/cleaners/gradle.d.ts +0 -14
- package/dist/cleaners/gradle.d.ts.map +0 -1
- package/dist/cleaners/gradle.js +0 -336
- package/dist/cleaners/gradle.js.map +0 -1
- package/dist/cleaners/index.d.ts +0 -51
- package/dist/cleaners/index.d.ts.map +0 -1
- package/dist/cleaners/index.js +0 -247
- package/dist/cleaners/index.js.map +0 -1
- package/dist/cleaners/jetbrains.d.ts +0 -18
- package/dist/cleaners/jetbrains.d.ts.map +0 -1
- package/dist/cleaners/jetbrains.js +0 -441
- package/dist/cleaners/jetbrains.js.map +0 -1
- package/dist/cleaners/maven.d.ts +0 -15
- package/dist/cleaners/maven.d.ts.map +0 -1
- package/dist/cleaners/maven.js +0 -182
- package/dist/cleaners/maven.js.map +0 -1
- package/dist/cleaners/nix.d.ts +0 -4
- package/dist/cleaners/nix.d.ts.map +0 -1
- package/dist/cleaners/nix.js +0 -227
- package/dist/cleaners/nix.js.map +0 -1
- package/dist/cleaners/nodeGyp.d.ts +0 -14
- package/dist/cleaners/nodeGyp.d.ts.map +0 -1
- package/dist/cleaners/nodeGyp.js +0 -157
- package/dist/cleaners/nodeGyp.js.map +0 -1
- package/dist/cleaners/npm.d.ts +0 -14
- package/dist/cleaners/npm.d.ts.map +0 -1
- package/dist/cleaners/npm.js +0 -198
- package/dist/cleaners/npm.js.map +0 -1
- package/dist/cleaners/npmEnhanced.d.ts +0 -19
- package/dist/cleaners/npmEnhanced.d.ts.map +0 -1
- package/dist/cleaners/npmEnhanced.js +0 -336
- package/dist/cleaners/npmEnhanced.js.map +0 -1
- package/dist/cleaners/nuget.d.ts +0 -16
- package/dist/cleaners/nuget.d.ts.map +0 -1
- package/dist/cleaners/nuget.js +0 -197
- package/dist/cleaners/nuget.js.map +0 -1
- package/dist/cleaners/nx.d.ts +0 -18
- package/dist/cleaners/nx.d.ts.map +0 -1
- package/dist/cleaners/nx.js +0 -308
- package/dist/cleaners/nx.js.map +0 -1
- package/dist/cleaners/pip.d.ts +0 -19
- package/dist/cleaners/pip.d.ts.map +0 -1
- package/dist/cleaners/pip.js +0 -334
- package/dist/cleaners/pip.js.map +0 -1
- package/dist/cleaners/pipenv.d.ts +0 -16
- package/dist/cleaners/pipenv.d.ts.map +0 -1
- package/dist/cleaners/pipenv.js +0 -184
- package/dist/cleaners/pipenv.js.map +0 -1
- package/dist/cleaners/pnpm.d.ts +0 -14
- package/dist/cleaners/pnpm.d.ts.map +0 -1
- package/dist/cleaners/pnpm.js +0 -209
- package/dist/cleaners/pnpm.js.map +0 -1
- package/dist/cleaners/poetry.d.ts +0 -16
- package/dist/cleaners/poetry.d.ts.map +0 -1
- package/dist/cleaners/poetry.js +0 -184
- package/dist/cleaners/poetry.js.map +0 -1
- package/dist/cleaners/swiftpm.d.ts +0 -16
- package/dist/cleaners/swiftpm.d.ts.map +0 -1
- package/dist/cleaners/swiftpm.js +0 -179
- package/dist/cleaners/swiftpm.js.map +0 -1
- package/dist/cleaners/turbo.d.ts +0 -18
- package/dist/cleaners/turbo.d.ts.map +0 -1
- package/dist/cleaners/turbo.js +0 -325
- package/dist/cleaners/turbo.js.map +0 -1
- package/dist/cleaners/vite.d.ts +0 -17
- package/dist/cleaners/vite.d.ts.map +0 -1
- package/dist/cleaners/vite.js +0 -274
- package/dist/cleaners/vite.js.map +0 -1
- package/dist/cleaners/vscode.d.ts +0 -14
- package/dist/cleaners/vscode.d.ts.map +0 -1
- package/dist/cleaners/vscode.js +0 -354
- package/dist/cleaners/vscode.js.map +0 -1
- package/dist/cleaners/webpack.d.ts +0 -17
- package/dist/cleaners/webpack.d.ts.map +0 -1
- package/dist/cleaners/webpack.js +0 -263
- package/dist/cleaners/webpack.js.map +0 -1
- package/dist/cleaners/xcode.d.ts +0 -14
- package/dist/cleaners/xcode.d.ts.map +0 -1
- package/dist/cleaners/xcode.js +0 -348
- package/dist/cleaners/xcode.js.map +0 -1
- package/dist/cleaners/yarn.d.ts +0 -16
- package/dist/cleaners/yarn.d.ts.map +0 -1
- package/dist/cleaners/yarn.js +0 -266
- package/dist/cleaners/yarn.js.map +0 -1
- package/dist/cli.d.ts +0 -3
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -346
- package/dist/cli.js.map +0 -1
- package/dist/commands/auto.d.ts +0 -8
- package/dist/commands/auto.d.ts.map +0 -1
- package/dist/commands/auto.js +0 -224
- package/dist/commands/auto.js.map +0 -1
- package/dist/commands/categories.d.ts +0 -8
- package/dist/commands/categories.d.ts.map +0 -1
- package/dist/commands/categories.js +0 -133
- package/dist/commands/categories.js.map +0 -1
- package/dist/commands/clean.d.ts +0 -3
- package/dist/commands/clean.d.ts.map +0 -1
- package/dist/commands/clean.js +0 -149
- package/dist/commands/clean.js.map +0 -1
- package/dist/commands/config.d.ts +0 -14
- package/dist/commands/config.d.ts.map +0 -1
- package/dist/commands/config.js +0 -445
- package/dist/commands/config.js.map +0 -1
- package/dist/commands/configDoctor.d.ts +0 -26
- package/dist/commands/configDoctor.d.ts.map +0 -1
- package/dist/commands/configDoctor.js +0 -60
- package/dist/commands/configDoctor.js.map +0 -1
- package/dist/commands/doctor.d.ts +0 -2
- package/dist/commands/doctor.d.ts.map +0 -1
- package/dist/commands/doctor.js +0 -141
- package/dist/commands/doctor.js.map +0 -1
- package/dist/commands/emojis.d.ts +0 -2
- package/dist/commands/emojis.d.ts.map +0 -1
- package/dist/commands/emojis.js +0 -28
- package/dist/commands/emojis.js.map +0 -1
- package/dist/commands/interactive.d.ts +0 -3
- package/dist/commands/interactive.d.ts.map +0 -1
- package/dist/commands/interactive.js +0 -284
- package/dist/commands/interactive.js.map +0 -1
- package/dist/commands/interactiveEnhanced.d.ts +0 -4
- package/dist/commands/interactiveEnhanced.d.ts.map +0 -1
- package/dist/commands/interactiveEnhanced.js +0 -460
- package/dist/commands/interactiveEnhanced.js.map +0 -1
- package/dist/commands/list.d.ts +0 -2
- package/dist/commands/list.d.ts.map +0 -1
- package/dist/commands/list.js +0 -68
- package/dist/commands/list.js.map +0 -1
- package/dist/commands/sizes.d.ts +0 -2
- package/dist/commands/sizes.d.ts.map +0 -1
- package/dist/commands/sizes.js +0 -87
- package/dist/commands/sizes.js.map +0 -1
- package/dist/config/index.d.ts +0 -31
- package/dist/config/index.d.ts.map +0 -1
- package/dist/config/index.js +0 -241
- package/dist/config/index.js.map +0 -1
- package/dist/config/loadConfig.d.ts +0 -7
- package/dist/config/loadConfig.d.ts.map +0 -1
- package/dist/config/loadConfig.js +0 -103
- package/dist/config/loadConfig.js.map +0 -1
- package/dist/config/migrateConfig.d.ts +0 -56
- package/dist/config/migrateConfig.d.ts.map +0 -1
- package/dist/config/migrateConfig.js +0 -102
- package/dist/config/migrateConfig.js.map +0 -1
- package/dist/plugins/discovery.d.ts +0 -6
- package/dist/plugins/discovery.d.ts.map +0 -1
- package/dist/plugins/discovery.js +0 -64
- package/dist/plugins/discovery.js.map +0 -1
- package/dist/profiles/index.d.ts +0 -61
- package/dist/profiles/index.d.ts.map +0 -1
- package/dist/profiles/index.js +0 -361
- package/dist/profiles/index.js.map +0 -1
- package/dist/types/index.d.ts +0 -161
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -3
- package/dist/types/index.js.map +0 -1
- package/dist/utils/cli.d.ts +0 -44
- package/dist/utils/cli.d.ts.map +0 -1
- package/dist/utils/cli.js +0 -410
- package/dist/utils/cli.js.map +0 -1
- package/dist/utils/fs.d.ts +0 -15
- package/dist/utils/fs.d.ts.map +0 -1
- package/dist/utils/fs.js +0 -218
- package/dist/utils/fs.js.map +0 -1
package/dist/cleaners/firefox.js
DELETED
|
@@ -1,281 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
const fs_1 = require("fs");
|
|
37
|
-
const path = __importStar(require("path"));
|
|
38
|
-
const os = __importStar(require("os"));
|
|
39
|
-
const fs_2 = require("../utils/fs");
|
|
40
|
-
const cli_1 = require("../utils/cli");
|
|
41
|
-
const minimatch_1 = require("minimatch");
|
|
42
|
-
class FirefoxCleaner {
|
|
43
|
-
constructor() {
|
|
44
|
-
this.name = "firefox";
|
|
45
|
-
this.type = "browser";
|
|
46
|
-
this.description = "Firefox cache, temporary files, and developer profile data";
|
|
47
|
-
}
|
|
48
|
-
async findFirefoxInstallation() {
|
|
49
|
-
const platform = os.platform();
|
|
50
|
-
if (platform === "darwin") {
|
|
51
|
-
// macOS
|
|
52
|
-
const macPaths = [
|
|
53
|
-
"/Applications/Firefox.app",
|
|
54
|
-
"/Applications/Firefox Developer Edition.app",
|
|
55
|
-
];
|
|
56
|
-
for (const firefoxPath of macPaths) {
|
|
57
|
-
if (await (0, fs_2.pathExists)(firefoxPath)) {
|
|
58
|
-
return firefoxPath;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
else if (platform === "win32") {
|
|
63
|
-
// Windows
|
|
64
|
-
const windowsPaths = [
|
|
65
|
-
"C:\\Program Files\\Mozilla Firefox\\firefox.exe",
|
|
66
|
-
"C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe",
|
|
67
|
-
path.join(os.homedir(), "AppData", "Local", "Mozilla Firefox", "firefox.exe"),
|
|
68
|
-
];
|
|
69
|
-
for (const firefoxPath of windowsPaths) {
|
|
70
|
-
if (await (0, fs_2.pathExists)(firefoxPath)) {
|
|
71
|
-
return firefoxPath;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
// Linux
|
|
77
|
-
const linuxPaths = [
|
|
78
|
-
"/usr/bin/firefox",
|
|
79
|
-
"/usr/local/bin/firefox",
|
|
80
|
-
"/snap/bin/firefox",
|
|
81
|
-
"/opt/firefox/firefox",
|
|
82
|
-
];
|
|
83
|
-
for (const firefoxPath of linuxPaths) {
|
|
84
|
-
if (await (0, fs_2.pathExists)(firefoxPath)) {
|
|
85
|
-
return firefoxPath;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return null;
|
|
90
|
-
}
|
|
91
|
-
async getFirefoxCachePaths() {
|
|
92
|
-
const paths = [];
|
|
93
|
-
const homeDir = os.homedir();
|
|
94
|
-
const platform = os.platform();
|
|
95
|
-
// Platform-specific Firefox cache paths
|
|
96
|
-
if (platform === "darwin") {
|
|
97
|
-
// macOS Firefox paths
|
|
98
|
-
const macBasePaths = [
|
|
99
|
-
path.join(homeDir, "Library", "Caches", "Firefox"),
|
|
100
|
-
path.join(homeDir, "Library", "Application Support", "Firefox"),
|
|
101
|
-
];
|
|
102
|
-
for (const basePath of macBasePaths) {
|
|
103
|
-
if (await (0, fs_2.pathExists)(basePath)) {
|
|
104
|
-
// Look for profile directories
|
|
105
|
-
const profilePaths = await this.findFirefoxProfileCaches(basePath);
|
|
106
|
-
paths.push(...profilePaths);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
else if (platform === "win32") {
|
|
111
|
-
// Windows Firefox paths
|
|
112
|
-
const windowsBasePaths = [
|
|
113
|
-
path.join(homeDir, "AppData", "Local", "Mozilla", "Firefox"),
|
|
114
|
-
path.join(homeDir, "AppData", "Roaming", "Mozilla", "Firefox"),
|
|
115
|
-
];
|
|
116
|
-
for (const basePath of windowsBasePaths) {
|
|
117
|
-
if (await (0, fs_2.pathExists)(basePath)) {
|
|
118
|
-
const profilePaths = await this.findFirefoxProfileCaches(basePath);
|
|
119
|
-
paths.push(...profilePaths);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
// Linux Firefox paths
|
|
125
|
-
const linuxBasePaths = [
|
|
126
|
-
path.join(homeDir, ".cache", "mozilla", "firefox"),
|
|
127
|
-
path.join(homeDir, ".mozilla", "firefox"),
|
|
128
|
-
];
|
|
129
|
-
for (const basePath of linuxBasePaths) {
|
|
130
|
-
if (await (0, fs_2.pathExists)(basePath)) {
|
|
131
|
-
const profilePaths = await this.findFirefoxProfileCaches(basePath);
|
|
132
|
-
paths.push(...profilePaths);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
return [...new Set(paths)]; // Remove duplicates
|
|
137
|
-
}
|
|
138
|
-
async findFirefoxProfileCaches(basePath) {
|
|
139
|
-
const cachePaths = [];
|
|
140
|
-
try {
|
|
141
|
-
const entries = await fs_1.promises.readdir(basePath, { withFileTypes: true });
|
|
142
|
-
for (const entry of entries) {
|
|
143
|
-
if (entry.isDirectory()) {
|
|
144
|
-
const profilePath = path.join(basePath, entry.name);
|
|
145
|
-
// Common Firefox cache subdirectories
|
|
146
|
-
const cacheSubdirs = [
|
|
147
|
-
"cache2",
|
|
148
|
-
"OfflineCache",
|
|
149
|
-
"startupCache",
|
|
150
|
-
"thumbnails",
|
|
151
|
-
"safebrowsing",
|
|
152
|
-
"shader-cache",
|
|
153
|
-
"crashes",
|
|
154
|
-
"minidumps",
|
|
155
|
-
"saved-telemetry-pings",
|
|
156
|
-
"datareporting",
|
|
157
|
-
];
|
|
158
|
-
for (const subdir of cacheSubdirs) {
|
|
159
|
-
const subdirPath = path.join(profilePath, subdir);
|
|
160
|
-
if (await (0, fs_2.pathExists)(subdirPath)) {
|
|
161
|
-
cachePaths.push(subdirPath);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
// Also check for specific profile directories (they usually have random names)
|
|
165
|
-
if (entry.name.includes(".") && entry.name !== "Profiles") {
|
|
166
|
-
const profileCachePath = path.join(profilePath, "cache");
|
|
167
|
-
if (await (0, fs_2.pathExists)(profileCachePath)) {
|
|
168
|
-
cachePaths.push(profileCachePath);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
catch (error) {
|
|
175
|
-
(0, cli_1.printVerbose)(`Error reading Firefox profile directory ${basePath}: ${error}`);
|
|
176
|
-
}
|
|
177
|
-
return cachePaths;
|
|
178
|
-
}
|
|
179
|
-
async isAvailable() {
|
|
180
|
-
// Check if Firefox is installed
|
|
181
|
-
const firefoxInstallation = await this.findFirefoxInstallation();
|
|
182
|
-
if (firefoxInstallation) {
|
|
183
|
-
(0, cli_1.printVerbose)(`Found Firefox at ${firefoxInstallation}`);
|
|
184
|
-
return true;
|
|
185
|
-
}
|
|
186
|
-
// Check if Firefox cache directories exist
|
|
187
|
-
const cachePaths = await this.getFirefoxCachePaths();
|
|
188
|
-
if (cachePaths.length > 0) {
|
|
189
|
-
(0, cli_1.printVerbose)(`Found ${cachePaths.length} Firefox cache directories`);
|
|
190
|
-
return true;
|
|
191
|
-
}
|
|
192
|
-
return false;
|
|
193
|
-
}
|
|
194
|
-
async getCacheInfo() {
|
|
195
|
-
const isInstalled = await this.isAvailable();
|
|
196
|
-
if (!isInstalled) {
|
|
197
|
-
return {
|
|
198
|
-
name: this.name,
|
|
199
|
-
type: this.type,
|
|
200
|
-
description: this.description,
|
|
201
|
-
paths: [],
|
|
202
|
-
isInstalled: false,
|
|
203
|
-
size: 0,
|
|
204
|
-
};
|
|
205
|
-
}
|
|
206
|
-
const cachePaths = await this.getFirefoxCachePaths();
|
|
207
|
-
let totalSize = 0;
|
|
208
|
-
const validPaths = [];
|
|
209
|
-
for (const cachePath of cachePaths) {
|
|
210
|
-
try {
|
|
211
|
-
const size = await (0, fs_2.getDirectorySize)(cachePath, true); // Use estimated size for large dirs
|
|
212
|
-
totalSize += size;
|
|
213
|
-
validPaths.push(cachePath);
|
|
214
|
-
(0, cli_1.printVerbose)(`${cli_1.symbols.folder} ${cachePath}: ${(size / (1024 * 1024)).toFixed(1)} MB`);
|
|
215
|
-
}
|
|
216
|
-
catch (error) {
|
|
217
|
-
(0, cli_1.printVerbose)(`Error calculating size for ${cachePath}: ${error}`);
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
return {
|
|
221
|
-
name: this.name,
|
|
222
|
-
type: this.type,
|
|
223
|
-
description: this.description,
|
|
224
|
-
paths: validPaths,
|
|
225
|
-
isInstalled: true,
|
|
226
|
-
size: totalSize,
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
async clear(dryRun = false, _criteria, cacheInfo, protectedPaths = []) {
|
|
230
|
-
const info = cacheInfo || (await this.getCacheInfo());
|
|
231
|
-
if (!info.isInstalled) {
|
|
232
|
-
return {
|
|
233
|
-
name: this.name,
|
|
234
|
-
success: false,
|
|
235
|
-
error: "Firefox is not available",
|
|
236
|
-
clearedPaths: [],
|
|
237
|
-
sizeBefore: 0,
|
|
238
|
-
sizeAfter: 0,
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
|
-
const sizeBefore = info.size || 0;
|
|
242
|
-
const clearedPaths = [];
|
|
243
|
-
let errors = [];
|
|
244
|
-
// Warning: Firefox should be closed before clearing cache
|
|
245
|
-
(0, cli_1.printVerbose)(`${cli_1.symbols.warning} Note: Firefox should be closed before clearing cache for best results`);
|
|
246
|
-
for (const cachePath of info.paths) {
|
|
247
|
-
// Check if the path is protected
|
|
248
|
-
const isProtected = protectedPaths.some((protectedPattern) => (0, minimatch_1.minimatch)(cachePath, protectedPattern, { dot: true }));
|
|
249
|
-
if (isProtected) {
|
|
250
|
-
(0, cli_1.printVerbose)(`Skipping protected path: ${cachePath}`);
|
|
251
|
-
continue; // Skip this path
|
|
252
|
-
}
|
|
253
|
-
try {
|
|
254
|
-
if (dryRun) {
|
|
255
|
-
(0, cli_1.printVerbose)(`${cli_1.symbols.soap} Would clear: ${cachePath}`);
|
|
256
|
-
clearedPaths.push(cachePath);
|
|
257
|
-
}
|
|
258
|
-
else {
|
|
259
|
-
(0, cli_1.printVerbose)(`${cli_1.symbols.soap} Clearing: ${cachePath}`);
|
|
260
|
-
await (0, fs_2.safeRmrf)(cachePath);
|
|
261
|
-
clearedPaths.push(cachePath);
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
catch (error) {
|
|
265
|
-
const errorMsg = `Failed to clear ${cachePath}: ${error}`;
|
|
266
|
-
errors.push(errorMsg);
|
|
267
|
-
(0, cli_1.printVerbose)(errorMsg);
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
return {
|
|
271
|
-
name: this.name,
|
|
272
|
-
success: errors.length === 0,
|
|
273
|
-
sizeBefore,
|
|
274
|
-
sizeAfter: 0, // Set to 0 as we don't want to rescan
|
|
275
|
-
error: errors.length > 0 ? errors.join("; ") : undefined,
|
|
276
|
-
clearedPaths,
|
|
277
|
-
};
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
exports.default = new FirefoxCleaner();
|
|
281
|
-
//# sourceMappingURL=firefox.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"firefox.js","sourceRoot":"","sources":["../../src/cleaners/firefox.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,2BAAoC;AACpC,2CAA6B;AAC7B,uCAAyB;AACzB,oCAAqE;AACrE,sCAAqD;AACrD,yCAAsC;AAEtC,MAAM,cAAc;IAApB;QACE,SAAI,GAAG,SAAS,CAAC;QACjB,SAAI,GAAG,SAAkB,CAAC;QAC1B,gBAAW,GAAG,4DAA4D,CAAC;IAsR7E,CAAC;IApRS,KAAK,CAAC,uBAAuB;QACnC,MAAM,QAAQ,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;QAE/B,IAAI,QAAQ,KAAK,QAAQ,EAAE,CAAC;YAC1B,QAAQ;YACR,MAAM,QAAQ,GAAG;gBACf,2BAA2B;gBAC3B,6CAA6C;aAC9C,CAAC;YA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B,SAAS,KAAK,KAAK,EAAE,CAAC;gBAC1D,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACtB,IAAA,kBAAY,EAAC,QAAQ,CAAC,CAAC;YACzB,CAAC;QACH,CAAC;QAED,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC;YAC5B,UAAU;YACV,SAAS,EAAE,CAAC,EAAE,sCAAsC;YACpD,KAAK,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS;YACxD,YAAY;SACb,CAAC;IACJ,CAAC;CACF;AAED,kBAAe,IAAI,cAAc,EAAE,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { CleanerModule, CacheInfo, ClearResult, CacheSelectionCriteria } from "../types";
|
|
2
|
-
declare class FlutterCleaner implements CleanerModule {
|
|
3
|
-
name: string;
|
|
4
|
-
type: "build-tool";
|
|
5
|
-
description: string;
|
|
6
|
-
private getFlutterVersion;
|
|
7
|
-
private getFlutterCachePaths;
|
|
8
|
-
private getFlutterSdkCachePath;
|
|
9
|
-
private findFlutterProjectBuildDirs;
|
|
10
|
-
private findFlutterProjectsRecursively;
|
|
11
|
-
isAvailable(): Promise<boolean>;
|
|
12
|
-
getCacheInfo(): Promise<CacheInfo>;
|
|
13
|
-
clear(dryRun?: boolean, _criteria?: CacheSelectionCriteria, cacheInfo?: CacheInfo, protectedPaths?: string[]): Promise<ClearResult>;
|
|
14
|
-
private runFlutterCleanInProjects;
|
|
15
|
-
}
|
|
16
|
-
declare const _default: FlutterCleaner;
|
|
17
|
-
export default _default;
|
|
18
|
-
//# sourceMappingURL=flutter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"flutter.d.ts","sourceRoot":"","sources":["../../src/cleaners/flutter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,SAAS,EACT,WAAW,EACX,sBAAsB,EACvB,MAAM,UAAU,CAAC;AASlB,cAAM,cAAe,YAAW,aAAa;IAC3C,IAAI,SAAa;IACjB,IAAI,EAAG,YAAY,CAAU;IAC7B,WAAW,SAAgE;YAE7D,iBAAiB;YASjB,oBAAoB;YAqCpB,sBAAsB;YA+BtB,2BAA2B;YA+B3B,8BAA8B;IAmFtC,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAmB/B,YAAY,IAAI,OAAO,CAAC,SAAS,CAAC;IAyClC,KAAK,CACT,MAAM,UAAQ,EACd,SAAS,CAAC,EAAE,sBAAsB,EAClC,SAAS,CAAC,EAAE,SAAS,EACrB,cAAc,GAAE,MAAM,EAAO,GAC5B,OAAO,CAAC,WAAW,CAAC;YA8ET,yBAAyB;CA6BxC;;AAED,wBAAoC"}
|
package/dist/cleaners/flutter.js
DELETED
|
@@ -1,354 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
const fs_1 = require("fs");
|
|
40
|
-
const path = __importStar(require("path"));
|
|
41
|
-
const os = __importStar(require("os"));
|
|
42
|
-
const fs_2 = require("../utils/fs");
|
|
43
|
-
const execa_1 = __importDefault(require("execa"));
|
|
44
|
-
const cli_1 = require("../utils/cli");
|
|
45
|
-
const minimatch_1 = require("minimatch");
|
|
46
|
-
class FlutterCleaner {
|
|
47
|
-
constructor() {
|
|
48
|
-
this.name = "flutter";
|
|
49
|
-
this.type = "build-tool";
|
|
50
|
-
this.description = "Flutter SDK caches, pub cache, and project build artifacts";
|
|
51
|
-
}
|
|
52
|
-
async getFlutterVersion() {
|
|
53
|
-
try {
|
|
54
|
-
const result = await (0, execa_1.default)("flutter", ["--version"]);
|
|
55
|
-
return result.stdout.split("\n")[0].trim();
|
|
56
|
-
}
|
|
57
|
-
catch {
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
async getFlutterCachePaths() {
|
|
62
|
-
const paths = [];
|
|
63
|
-
const homeDir = os.homedir();
|
|
64
|
-
// Pub cache directory (Dart/Flutter packages)
|
|
65
|
-
const pubCachePaths = [
|
|
66
|
-
path.join(homeDir, ".pub-cache"),
|
|
67
|
-
path.join(homeDir, "AppData", "Local", "Pub", "Cache"), // Windows
|
|
68
|
-
];
|
|
69
|
-
for (const pubCachePath of pubCachePaths) {
|
|
70
|
-
if (await (0, fs_2.pathExists)(pubCachePath)) {
|
|
71
|
-
paths.push(pubCachePath);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
// Flutter SDK cache (if Flutter is installed)
|
|
75
|
-
try {
|
|
76
|
-
const flutterCache = await this.getFlutterSdkCachePath();
|
|
77
|
-
if (flutterCache) {
|
|
78
|
-
paths.push(flutterCache);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
catch (error) {
|
|
82
|
-
(0, cli_1.printVerbose)(`Could not locate Flutter SDK cache: ${error}`);
|
|
83
|
-
}
|
|
84
|
-
// Flutter project build artifacts
|
|
85
|
-
try {
|
|
86
|
-
const projectBuildDirs = await this.findFlutterProjectBuildDirs();
|
|
87
|
-
paths.push(...projectBuildDirs);
|
|
88
|
-
}
|
|
89
|
-
catch (error) {
|
|
90
|
-
(0, cli_1.printVerbose)(`Error finding Flutter project build dirs: ${error}`);
|
|
91
|
-
}
|
|
92
|
-
return [...new Set(paths)]; // Remove duplicates
|
|
93
|
-
}
|
|
94
|
-
async getFlutterSdkCachePath() {
|
|
95
|
-
try {
|
|
96
|
-
// Try to get Flutter SDK path
|
|
97
|
-
const result = await (0, execa_1.default)("flutter", ["--version", "--machine"]);
|
|
98
|
-
const versionInfo = JSON.parse(result.stdout);
|
|
99
|
-
if (versionInfo.flutterRoot) {
|
|
100
|
-
const cacheDir = path.join(versionInfo.flutterRoot, "bin", "cache");
|
|
101
|
-
if (await (0, fs_2.pathExists)(cacheDir)) {
|
|
102
|
-
return cacheDir;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
catch {
|
|
107
|
-
// Fallback to common locations
|
|
108
|
-
const commonSdkPaths = [
|
|
109
|
-
path.join(os.homedir(), "flutter", "bin", "cache"),
|
|
110
|
-
path.join(os.homedir(), "development", "flutter", "bin", "cache"),
|
|
111
|
-
path.join("/opt", "flutter", "bin", "cache"), // Linux
|
|
112
|
-
path.join("C:", "flutter", "bin", "cache"), // Windows
|
|
113
|
-
];
|
|
114
|
-
for (const sdkPath of commonSdkPaths) {
|
|
115
|
-
if (await (0, fs_2.pathExists)(sdkPath)) {
|
|
116
|
-
return sdkPath;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
return null;
|
|
121
|
-
}
|
|
122
|
-
async findFlutterProjectBuildDirs() {
|
|
123
|
-
const buildDirs = [];
|
|
124
|
-
const homeDir = os.homedir();
|
|
125
|
-
// Common project directories
|
|
126
|
-
const searchDirs = [
|
|
127
|
-
path.join(homeDir, "FlutterProjects"),
|
|
128
|
-
path.join(homeDir, "Projects"),
|
|
129
|
-
path.join(homeDir, "Development"),
|
|
130
|
-
path.join(homeDir, "dev"),
|
|
131
|
-
path.join(homeDir, "Documents"),
|
|
132
|
-
process.cwd(),
|
|
133
|
-
];
|
|
134
|
-
for (const searchDir of searchDirs) {
|
|
135
|
-
if (await (0, fs_2.pathExists)(searchDir)) {
|
|
136
|
-
try {
|
|
137
|
-
const projects = await this.findFlutterProjectsRecursively(searchDir, 3);
|
|
138
|
-
buildDirs.push(...projects);
|
|
139
|
-
}
|
|
140
|
-
catch (error) {
|
|
141
|
-
(0, cli_1.printVerbose)(`Error searching ${searchDir}: ${error}`);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
return buildDirs;
|
|
146
|
-
}
|
|
147
|
-
async findFlutterProjectsRecursively(dir, maxDepth) {
|
|
148
|
-
if (maxDepth <= 0)
|
|
149
|
-
return [];
|
|
150
|
-
const buildDirs = [];
|
|
151
|
-
try {
|
|
152
|
-
const entries = await fs_1.promises.readdir(dir, { withFileTypes: true });
|
|
153
|
-
for (const entry of entries) {
|
|
154
|
-
if (entry.isDirectory() &&
|
|
155
|
-
!entry.name.startsWith(".") &&
|
|
156
|
-
entry.name !== "build") {
|
|
157
|
-
const fullPath = path.join(dir, entry.name);
|
|
158
|
-
// Check if this is a Flutter project
|
|
159
|
-
const pubspecFile = path.join(fullPath, "pubspec.yaml");
|
|
160
|
-
const flutterDir = path.join(fullPath, ".flutter-plugins-dependencies");
|
|
161
|
-
if (await (0, fs_2.pathExists)(pubspecFile)) {
|
|
162
|
-
// Check if pubspec.yaml contains flutter dependency
|
|
163
|
-
try {
|
|
164
|
-
const pubspecContent = await fs_1.promises.readFile(pubspecFile, "utf-8");
|
|
165
|
-
if (pubspecContent.includes("flutter:") ||
|
|
166
|
-
pubspecContent.includes("flutter_")) {
|
|
167
|
-
// This is a Flutter project, add build directories
|
|
168
|
-
const buildLocations = [
|
|
169
|
-
path.join(fullPath, "build"),
|
|
170
|
-
path.join(fullPath, ".dart_tool"),
|
|
171
|
-
path.join(fullPath, "android", "build"),
|
|
172
|
-
path.join(fullPath, "ios", "build"),
|
|
173
|
-
path.join(fullPath, "windows", "build"),
|
|
174
|
-
path.join(fullPath, "linux", "build"),
|
|
175
|
-
path.join(fullPath, "macos", "build"),
|
|
176
|
-
path.join(fullPath, "web", "build"),
|
|
177
|
-
];
|
|
178
|
-
for (const buildDir of buildLocations) {
|
|
179
|
-
if (await (0, fs_2.pathExists)(buildDir)) {
|
|
180
|
-
buildDirs.push(buildDir);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
catch {
|
|
186
|
-
// If we can't read pubspec.yaml, still check for Flutter indicators
|
|
187
|
-
if (await (0, fs_2.pathExists)(flutterDir)) {
|
|
188
|
-
const buildDir = path.join(fullPath, "build");
|
|
189
|
-
const dartTool = path.join(fullPath, ".dart_tool");
|
|
190
|
-
if (await (0, fs_2.pathExists)(buildDir)) {
|
|
191
|
-
buildDirs.push(buildDir);
|
|
192
|
-
}
|
|
193
|
-
if (await (0, fs_2.pathExists)(dartTool)) {
|
|
194
|
-
buildDirs.push(dartTool);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
// Recursively search subdirectories
|
|
200
|
-
const subBuildDirs = await this.findFlutterProjectsRecursively(fullPath, maxDepth - 1);
|
|
201
|
-
buildDirs.push(...subBuildDirs);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
catch {
|
|
206
|
-
// Ignore permission errors
|
|
207
|
-
}
|
|
208
|
-
return buildDirs;
|
|
209
|
-
}
|
|
210
|
-
async isAvailable() {
|
|
211
|
-
// Check if Flutter is installed
|
|
212
|
-
const version = await this.getFlutterVersion();
|
|
213
|
-
if (version) {
|
|
214
|
-
(0, cli_1.printVerbose)(`Found Flutter: ${version}`);
|
|
215
|
-
return true;
|
|
216
|
-
}
|
|
217
|
-
// Check if pub-cache exists (Dart projects)
|
|
218
|
-
const homeDir = os.homedir();
|
|
219
|
-
const pubCachePath = path.join(homeDir, ".pub-cache");
|
|
220
|
-
if (await (0, fs_2.pathExists)(pubCachePath)) {
|
|
221
|
-
(0, cli_1.printVerbose)(`Found Pub cache at ${pubCachePath}`);
|
|
222
|
-
return true;
|
|
223
|
-
}
|
|
224
|
-
return false;
|
|
225
|
-
}
|
|
226
|
-
async getCacheInfo() {
|
|
227
|
-
const isInstalled = await this.isAvailable();
|
|
228
|
-
if (!isInstalled) {
|
|
229
|
-
return {
|
|
230
|
-
name: this.name,
|
|
231
|
-
type: this.type,
|
|
232
|
-
description: this.description,
|
|
233
|
-
paths: [],
|
|
234
|
-
isInstalled: false,
|
|
235
|
-
size: 0,
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
const cachePaths = await this.getFlutterCachePaths();
|
|
239
|
-
let totalSize = 0;
|
|
240
|
-
const validPaths = [];
|
|
241
|
-
for (const cachePath of cachePaths) {
|
|
242
|
-
try {
|
|
243
|
-
const size = await (0, fs_2.getDirectorySize)(cachePath, true); // Use estimated size for large dirs
|
|
244
|
-
totalSize += size;
|
|
245
|
-
validPaths.push(cachePath);
|
|
246
|
-
(0, cli_1.printVerbose)(`${cli_1.symbols.folder} ${cachePath}: ${(size / (1024 * 1024)).toFixed(1)} MB`);
|
|
247
|
-
}
|
|
248
|
-
catch (error) {
|
|
249
|
-
(0, cli_1.printVerbose)(`Error calculating size for ${cachePath}: ${error}`);
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
return {
|
|
253
|
-
name: this.name,
|
|
254
|
-
type: this.type,
|
|
255
|
-
description: this.description,
|
|
256
|
-
paths: validPaths,
|
|
257
|
-
isInstalled: true,
|
|
258
|
-
size: totalSize,
|
|
259
|
-
};
|
|
260
|
-
}
|
|
261
|
-
async clear(dryRun = false, _criteria, cacheInfo, protectedPaths = []) {
|
|
262
|
-
const info = cacheInfo || (await this.getCacheInfo());
|
|
263
|
-
if (!info.isInstalled) {
|
|
264
|
-
return {
|
|
265
|
-
name: this.name,
|
|
266
|
-
success: false,
|
|
267
|
-
error: "Flutter is not available",
|
|
268
|
-
clearedPaths: [],
|
|
269
|
-
sizeBefore: 0,
|
|
270
|
-
sizeAfter: 0,
|
|
271
|
-
};
|
|
272
|
-
}
|
|
273
|
-
const sizeBefore = info.size || 0;
|
|
274
|
-
const clearedPaths = [];
|
|
275
|
-
let errors = [];
|
|
276
|
-
// Try flutter clean command in projects first
|
|
277
|
-
if (!dryRun && (await this.getFlutterVersion())) {
|
|
278
|
-
await this.runFlutterCleanInProjects();
|
|
279
|
-
}
|
|
280
|
-
for (const cachePath of info.paths) {
|
|
281
|
-
// Check if the path is protected
|
|
282
|
-
const isProtected = protectedPaths.some((protectedPattern) => (0, minimatch_1.minimatch)(cachePath, protectedPattern, { dot: true }));
|
|
283
|
-
if (isProtected) {
|
|
284
|
-
(0, cli_1.printVerbose)(`Skipping protected path: ${cachePath}`);
|
|
285
|
-
continue; // Skip this path
|
|
286
|
-
}
|
|
287
|
-
try {
|
|
288
|
-
if (dryRun) {
|
|
289
|
-
(0, cli_1.printVerbose)(`${cli_1.symbols.soap} Would clear: ${cachePath}`);
|
|
290
|
-
clearedPaths.push(cachePath);
|
|
291
|
-
}
|
|
292
|
-
else {
|
|
293
|
-
(0, cli_1.printVerbose)(`${cli_1.symbols.soap} Clearing: ${cachePath}`);
|
|
294
|
-
// Be selective about what we clear in the pub-cache
|
|
295
|
-
if (cachePath.includes(".pub-cache")) {
|
|
296
|
-
// Only clear specific subdirectories in pub-cache, not the entire cache
|
|
297
|
-
const selectiveDirs = ["hosted", "_temp", "log"];
|
|
298
|
-
for (const subdir of selectiveDirs) {
|
|
299
|
-
const subdirPath = path.join(cachePath, subdir);
|
|
300
|
-
if (await (0, fs_2.pathExists)(subdirPath)) {
|
|
301
|
-
await (0, fs_2.safeRmrf)(subdirPath);
|
|
302
|
-
(0, cli_1.printVerbose)(`${cli_1.symbols.soap} Cleared pub-cache subdirectory: ${subdir}`);
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
else {
|
|
307
|
-
// For other cache directories, clear everything
|
|
308
|
-
await (0, fs_2.safeRmrf)(cachePath);
|
|
309
|
-
}
|
|
310
|
-
clearedPaths.push(cachePath);
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
catch (error) {
|
|
314
|
-
const errorMsg = `Failed to clear ${cachePath}: ${error}`;
|
|
315
|
-
errors.push(errorMsg);
|
|
316
|
-
(0, cli_1.printVerbose)(errorMsg);
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
return {
|
|
320
|
-
name: this.name,
|
|
321
|
-
success: errors.length === 0,
|
|
322
|
-
sizeBefore,
|
|
323
|
-
sizeAfter: 0, // Set to 0 as we don't want to rescan
|
|
324
|
-
error: errors.length > 0 ? errors.join("; ") : undefined,
|
|
325
|
-
clearedPaths,
|
|
326
|
-
};
|
|
327
|
-
}
|
|
328
|
-
async runFlutterCleanInProjects() {
|
|
329
|
-
const projectDirs = await this.findFlutterProjectBuildDirs();
|
|
330
|
-
// Get unique project root directories (parent of build dirs)
|
|
331
|
-
const projectRoots = new Set();
|
|
332
|
-
for (const buildDir of projectDirs) {
|
|
333
|
-
if (buildDir.endsWith("/build") || buildDir.endsWith("\\build")) {
|
|
334
|
-
projectRoots.add(path.dirname(buildDir));
|
|
335
|
-
}
|
|
336
|
-
else if (buildDir.endsWith("/.dart_tool") ||
|
|
337
|
-
buildDir.endsWith("\\.dart_tool")) {
|
|
338
|
-
projectRoots.add(path.dirname(buildDir));
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
// Run flutter clean in each project
|
|
342
|
-
for (const projectRoot of projectRoots) {
|
|
343
|
-
try {
|
|
344
|
-
await (0, execa_1.default)("flutter", ["clean"], { cwd: projectRoot });
|
|
345
|
-
(0, cli_1.printVerbose)(`${cli_1.symbols.soap} Executed 'flutter clean' in ${projectRoot}`);
|
|
346
|
-
}
|
|
347
|
-
catch (error) {
|
|
348
|
-
(0, cli_1.printVerbose)(`Note: flutter clean failed in ${projectRoot}: ${error}`);
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
exports.default = new FlutterCleaner();
|
|
354
|
-
//# sourceMappingURL=flutter.js.map
|