ccsini 0.1.17 → 0.1.19
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 +27 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -26950,7 +26950,7 @@ var {
|
|
|
26950
26950
|
} = import__.default;
|
|
26951
26951
|
|
|
26952
26952
|
// src/version.ts
|
|
26953
|
-
var VERSION = "0.1.
|
|
26953
|
+
var VERSION = "0.1.19";
|
|
26954
26954
|
|
|
26955
26955
|
// src/commands/init.ts
|
|
26956
26956
|
init_source();
|
|
@@ -28945,13 +28945,14 @@ function registerDoctorCommand(program2) {
|
|
|
28945
28945
|
|
|
28946
28946
|
// src/commands/self.ts
|
|
28947
28947
|
import { execSync } from "child_process";
|
|
28948
|
-
function
|
|
28948
|
+
function detectInstalledWith() {
|
|
28949
28949
|
try {
|
|
28950
|
-
execSync("
|
|
28951
|
-
|
|
28952
|
-
|
|
28953
|
-
|
|
28954
|
-
}
|
|
28950
|
+
const whichResult = execSync(process.platform === "win32" ? "where ccsini" : "which ccsini", { encoding: "utf-8" }).trim().split(`
|
|
28951
|
+
`)[0];
|
|
28952
|
+
if (whichResult.includes(".bun"))
|
|
28953
|
+
return "bun";
|
|
28954
|
+
} catch {}
|
|
28955
|
+
return "npm";
|
|
28955
28956
|
}
|
|
28956
28957
|
function getLatestVersion() {
|
|
28957
28958
|
try {
|
|
@@ -28976,6 +28977,13 @@ function registerSelfCommands(program2) {
|
|
|
28976
28977
|
console.log(`New version available: ${latest}`);
|
|
28977
28978
|
console.log(`Updating...
|
|
28978
28979
|
`);
|
|
28980
|
+
const installedWith = detectInstalledWith();
|
|
28981
|
+
if (installedWith === "bun") {
|
|
28982
|
+
try {
|
|
28983
|
+
console.log("Removing bun global install...");
|
|
28984
|
+
execSync("bun remove -g ccsini", { stdio: "inherit" });
|
|
28985
|
+
} catch {}
|
|
28986
|
+
}
|
|
28979
28987
|
const cmd = `npm install -g ccsini@${latest}`;
|
|
28980
28988
|
try {
|
|
28981
28989
|
execSync(cmd, { stdio: "inherit" });
|
|
@@ -28991,23 +28999,29 @@ Installed version: ${installed} (expected ${latest})`);
|
|
|
28991
28999
|
} catch {
|
|
28992
29000
|
console.error(`
|
|
28993
29001
|
Update failed. Try manually:`);
|
|
28994
|
-
console.error(`
|
|
29002
|
+
console.error(` ${cmd}`);
|
|
28995
29003
|
process.exit(1);
|
|
28996
29004
|
}
|
|
28997
29005
|
});
|
|
28998
29006
|
program2.command("uninstall").description("Uninstall ccsini from this machine").action(async () => {
|
|
28999
|
-
const pm = detectPackageManager();
|
|
29000
|
-
const cmd = pm === "bun" ? "bun remove -g ccsini" : "npm uninstall -g ccsini";
|
|
29001
29007
|
console.log(`Uninstalling ccsini...
|
|
29002
29008
|
`);
|
|
29009
|
+
let removed = false;
|
|
29003
29010
|
try {
|
|
29004
|
-
execSync(
|
|
29011
|
+
execSync("bun remove -g ccsini", { stdio: "inherit" });
|
|
29012
|
+
removed = true;
|
|
29013
|
+
} catch {}
|
|
29014
|
+
try {
|
|
29015
|
+
execSync("npm uninstall -g ccsini", { stdio: "inherit" });
|
|
29016
|
+
removed = true;
|
|
29017
|
+
} catch {}
|
|
29018
|
+
if (removed) {
|
|
29005
29019
|
console.log(`
|
|
29006
29020
|
ccsini has been uninstalled. Bye!`);
|
|
29007
|
-
}
|
|
29021
|
+
} else {
|
|
29008
29022
|
console.error(`
|
|
29009
29023
|
Uninstall failed. Try manually:`);
|
|
29010
|
-
console.error(
|
|
29024
|
+
console.error(" npm uninstall -g ccsini");
|
|
29011
29025
|
process.exit(1);
|
|
29012
29026
|
}
|
|
29013
29027
|
});
|