@kud/soap-cli 3.0.14 → 3.0.16
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/dist/index.js +29 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -196,9 +196,9 @@ var getComputerName = () => {
|
|
|
196
196
|
};
|
|
197
197
|
var getBundleIdentifier = async (appName) => {
|
|
198
198
|
try {
|
|
199
|
-
const bundleId = execSync(
|
|
200
|
-
|
|
201
|
-
).toString();
|
|
199
|
+
const bundleId = execSync(`osascript -e 'id of app "${appName}"'`, {
|
|
200
|
+
stdio: "pipe"
|
|
201
|
+
}).toString();
|
|
202
202
|
return bundleId.trimEnd();
|
|
203
203
|
} catch {
|
|
204
204
|
throw new Error(
|
|
@@ -247,7 +247,7 @@ var param = rawArgs.find((a) => !a.startsWith("-"));
|
|
|
247
247
|
var yes = rawArgs.includes("--yes") || rawArgs.includes("-y");
|
|
248
248
|
var yesDangerously = rawArgs.includes("--yes-dangerously");
|
|
249
249
|
if (firstArg === "--version" || firstArg === "-v") {
|
|
250
|
-
console.log("3.0.
|
|
250
|
+
console.log("3.0.16");
|
|
251
251
|
process.exit(0);
|
|
252
252
|
}
|
|
253
253
|
if (!firstArg || firstArg === "--help" || firstArg === "-h") {
|
|
@@ -312,17 +312,22 @@ try {
|
|
|
312
312
|
signale.warn(
|
|
313
313
|
`Could not determine app name for "${param}", falling back to brew uninstall.`
|
|
314
314
|
);
|
|
315
|
-
await $2`brew uninstall --zap ${param}`;
|
|
315
|
+
await $2({ quiet: true })`brew uninstall --zap ${param}`;
|
|
316
316
|
process.exit(0);
|
|
317
317
|
}
|
|
318
318
|
signale.error(`Could not determine app name for "${param}".`);
|
|
319
319
|
process.exit(1);
|
|
320
320
|
}
|
|
321
|
-
|
|
322
|
-
|
|
321
|
+
let bundleId = "";
|
|
322
|
+
try {
|
|
323
|
+
bundleId = await getBundleIdentifier(appName);
|
|
324
|
+
} catch {
|
|
325
|
+
signale.warn(`App "${appName}" is not installed \u2014 skipping file scan.`);
|
|
326
|
+
}
|
|
327
|
+
const scannedFiles = bundleId ? await spinner(
|
|
323
328
|
chalk.dim("Scanning for files\u2026"),
|
|
324
329
|
() => findAppFiles(appName, bundleId)
|
|
325
|
-
);
|
|
330
|
+
) : [];
|
|
326
331
|
const appFiles = [
|
|
327
332
|
.../* @__PURE__ */ new Set([
|
|
328
333
|
...isCask ? scannedFiles.slice(1) : scannedFiles,
|
|
@@ -421,7 +426,7 @@ Can you become an admin before we proceed?`,
|
|
|
421
426
|
}
|
|
422
427
|
console.log("");
|
|
423
428
|
signale.pending("Running Homebrew uninstall\u2026");
|
|
424
|
-
await $2`brew uninstall --zap ${param}`;
|
|
429
|
+
await $2({ quiet: true })`brew uninstall --zap ${param}`;
|
|
425
430
|
const brewPrefix = (await $2`brew --prefix`).stdout.trim();
|
|
426
431
|
const caskroomEntry = `${brewPrefix}/Caskroom/${param}`;
|
|
427
432
|
try {
|
|
@@ -436,7 +441,8 @@ Can you become an admin before we proceed?`,
|
|
|
436
441
|
console.log("");
|
|
437
442
|
signale.success("Done.");
|
|
438
443
|
} catch (error) {
|
|
439
|
-
const
|
|
444
|
+
const rawMessage = error instanceof Error ? error.message : "An unexpected error occurred.";
|
|
445
|
+
const message = rawMessage.split("\n").filter((l) => !/^\s+at /.test(l) && !/exit code:/.test(l)).join("\n").trim();
|
|
440
446
|
const isPermissionError = message.includes("sudoers") || message.includes("Permission denied");
|
|
441
447
|
const isCaskNotInstalled = message.includes("is not installed");
|
|
442
448
|
console.log("");
|
|
@@ -457,7 +463,7 @@ Force-run ${chalk.bold(`brew uninstall --zap --force ${param}`)}?`,
|
|
|
457
463
|
if (forceUninstall) {
|
|
458
464
|
console.log("");
|
|
459
465
|
signale.pending("Force-uninstalling cask\u2026");
|
|
460
|
-
await $2`brew uninstall --zap --force ${param}`;
|
|
466
|
+
await $2({ quiet: true })`brew uninstall --zap --force ${param}`;
|
|
461
467
|
signale.success("Force uninstall complete.");
|
|
462
468
|
}
|
|
463
469
|
} else if (isCask && isPermissionError) {
|
|
@@ -469,4 +475,16 @@ Force-run ${chalk.bold(`brew uninstall --zap --force ${param}`)}?`,
|
|
|
469
475
|
`Cask "${param}" is not registered in Homebrew \u2014 skipping brew uninstall.`
|
|
470
476
|
);
|
|
471
477
|
}
|
|
478
|
+
if (isCask) {
|
|
479
|
+
const brewPrefix = (await $2`brew --prefix`).stdout.trim();
|
|
480
|
+
const caskroomEntry = `${brewPrefix}/Caskroom/${param}`;
|
|
481
|
+
try {
|
|
482
|
+
await fs2.access(caskroomEntry);
|
|
483
|
+
await trash(caskroomEntry);
|
|
484
|
+
signale.success(
|
|
485
|
+
`Removed leftover Caskroom entry: ${chalk.dim(caskroomEntry)}`
|
|
486
|
+
);
|
|
487
|
+
} catch {
|
|
488
|
+
}
|
|
489
|
+
}
|
|
472
490
|
}
|