@sumdaelive/cli 0.1.2 → 0.1.3

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.
Files changed (2) hide show
  1. package/dist/main.js +16 -10
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -146,7 +146,7 @@ import { randomUUID } from "crypto";
146
146
  import { arch as osArch, hostname, networkInterfaces, release, userInfo } from "os";
147
147
 
148
148
  // src/version.ts
149
- var CLI_VERSION = "0.1.2";
149
+ var CLI_VERSION = "0.1.3";
150
150
 
151
151
  // src/system.ts
152
152
  function getDeviceId() {
@@ -2859,9 +2859,10 @@ import { useState as useState6 } from "react";
2859
2859
  // src/uninstall.ts
2860
2860
  import { spawn } from "child_process";
2861
2861
  import {
2862
- createWriteStream as createWriteStream2,
2862
+ closeSync,
2863
2863
  existsSync as existsSync2,
2864
2864
  mkdtempSync as mkdtempSync2,
2865
+ openSync,
2865
2866
  readFileSync as readFileSync5,
2866
2867
  realpathSync,
2867
2868
  rmSync as rmSync3,
@@ -3187,7 +3188,7 @@ async function removeUserData() {
3187
3188
  function errMsg(e) {
3188
3189
  return e instanceof Error ? e.message : String(e);
3189
3190
  }
3190
- function scheduleInstallRemoval(plan) {
3191
+ function scheduleInstallRemoval(plan, opts = {}) {
3191
3192
  if (plan.installBlockedReason) {
3192
3193
  return { step: "install", ok: false, error: plan.manualHint ?? plan.installBlockedReason };
3193
3194
  }
@@ -3198,18 +3199,23 @@ function scheduleInstallRemoval(plan) {
3198
3199
  error: plan.manualHint ?? `Supprimez manuellement : ${plan.installRoot}`
3199
3200
  };
3200
3201
  }
3202
+ const spawnFn = opts.spawnFn ?? spawn;
3201
3203
  try {
3202
3204
  const scriptDir = mkdtempSync2(join5(tmpdir2(), "sumdae-uninstall-"));
3203
3205
  const scriptPath = join5(scriptDir, "uninstall.sh");
3204
3206
  const logPath = join5(scriptDir, "uninstall.log");
3205
3207
  const text = renderUninstallScript({ ...plan, scriptDir }, process.pid);
3206
3208
  writeFileSync5(scriptPath, text, { mode: 448 });
3207
- const out = createWriteStream2(logPath);
3208
- const child = spawn("sh", [scriptPath], {
3209
- detached: true,
3210
- stdio: ["ignore", out, out]
3211
- });
3212
- child.unref();
3209
+ const logFd = openSync(logPath, "a");
3210
+ try {
3211
+ const child = spawnFn("sh", [scriptPath], {
3212
+ detached: true,
3213
+ stdio: ["ignore", logFd, logFd]
3214
+ });
3215
+ child.unref();
3216
+ } finally {
3217
+ closeSync(logFd);
3218
+ }
3213
3219
  return { step: "install", ok: true };
3214
3220
  } catch (e) {
3215
3221
  return {
@@ -5291,7 +5297,7 @@ function printPlan(plan) {
5291
5297
  console.log("D\xE9sinstallation de sumdae :");
5292
5298
  console.log(` canal : ${plan.channel}`);
5293
5299
  if (plan.channel === "npm") {
5294
- console.log(" install : npm uninstall -g @sumdae/cli");
5300
+ console.log(` install : ${plan.manualHint ?? "npm uninstall -g (global)"}`);
5295
5301
  } else if (plan.installBlockedReason) {
5296
5302
  console.log(` install : manuel \u2192 ${plan.manualHint ?? plan.installRoot}`);
5297
5303
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sumdaelive/cli",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "sumdae": "dist/cli.js"