@kisuke/cli 1.1.44-dev.53.1 → 1.1.46-dev.55.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kisuke/cli",
3
- "version": "1.1.44-dev.53.1",
3
+ "version": "1.1.46-dev.55.1",
4
4
  "private": false,
5
5
  "description": "Kisuke CLI (dev) installer",
6
6
  "type": "module",
@@ -16,7 +16,8 @@
16
16
  "package.json"
17
17
  ],
18
18
  "scripts": {
19
- "postinstall": "node scripts/download.mjs"
19
+ "postinstall": "node scripts/download.mjs",
20
+ "preuninstall": "node scripts/preuninstall.mjs"
20
21
  },
21
22
  "engines": {
22
23
  "node": ">=18"
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Pre-uninstall hook — stops the Kisuke daemon and removes the
3
+ * platform service (Task Scheduler / launchd / systemd) before npm
4
+ * deletes the package files. Without this, Windows will fail to
5
+ * remove the bundled node.exe because the daemon process holds a
6
+ * lock on it.
7
+ */
8
+
9
+ import fs from 'node:fs';
10
+ import path from 'node:path';
11
+ import { spawnSync } from 'node:child_process';
12
+ import { fileURLToPath } from 'node:url';
13
+
14
+ import { getBaseVersion, getPlatformTag } from './platform.mjs';
15
+
16
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
17
+ const pkgRoot = path.resolve(__dirname, '..');
18
+ const pkgJson = JSON.parse(fs.readFileSync(path.join(pkgRoot, 'package.json'), 'utf8'));
19
+
20
+ const baseVersion = getBaseVersion(pkgJson.version);
21
+ const platformTag = getPlatformTag();
22
+ const bundleName = `kisuke-cli-${baseVersion}-${platformTag}`;
23
+ const bundleDir = path.join(pkgRoot, '.vendor', baseVersion, platformTag, bundleName);
24
+
25
+ const executable = process.platform === 'win32'
26
+ ? path.join(bundleDir, 'kisuke.cmd')
27
+ : path.join(bundleDir, 'kisuke');
28
+
29
+ if (fs.existsSync(executable)) {
30
+ spawnSync(executable, ['uninstall'], {
31
+ stdio: 'ignore',
32
+ shell: process.platform === 'win32',
33
+ timeout: 15_000,
34
+ });
35
+ }