@skillsgate/tui 0.1.3 → 0.1.5

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/bin/skillsgate-tui +32 -6
  2. package/package.json +8 -1
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import { execFileSync } from "node:child_process";
3
3
  import { createRequire } from "node:module";
4
+ import { fileURLToPath } from "node:url";
5
+ import path from "node:path";
4
6
  import os from "node:os";
5
7
 
6
- const require = createRequire(import.meta.url);
7
-
8
8
  const platform = os.platform();
9
9
  const arch = os.arch();
10
10
 
@@ -20,10 +20,36 @@ if (!pkg) {
20
20
  process.exit(1);
21
21
  }
22
22
 
23
- try {
24
- const binPath = require.resolve(`@skillsgate/${pkg}/skillsgate-tui`);
25
- execFileSync(binPath, process.argv.slice(2), { stdio: "inherit" });
26
- } catch {
23
+ // Try multiple resolution strategies since global installs place optional
24
+ // deps as siblings rather than nested under this package's node_modules.
25
+ const binName = platform === "win32" ? "skillsgate-tui.exe" : "skillsgate-tui";
26
+ const require = createRequire(import.meta.url);
27
+ const thisDir = path.dirname(fileURLToPath(import.meta.url));
28
+
29
+ const candidates = [
30
+ // 1. Nested node_modules (local installs)
31
+ () => require.resolve(`@skillsgate/${pkg}/${binName}`),
32
+ // 2. Sibling in global node_modules (npm install -g)
33
+ // thisDir = .../node_modules/@skillsgate/tui/bin → go up 3 to node_modules
34
+ () => path.join(thisDir, "..", "..", "..", `@skillsgate/${pkg}`, binName),
35
+ ];
36
+
37
+ let binPath = null;
38
+ for (const resolve of candidates) {
39
+ try {
40
+ const p = resolve();
41
+ // Verify it exists by importing fs synchronously
42
+ require("fs").accessSync(p, require("fs").constants.X_OK);
43
+ binPath = p;
44
+ break;
45
+ } catch {
46
+ continue;
47
+ }
48
+ }
49
+
50
+ if (!binPath) {
27
51
  console.error("Platform binary not found. Try reinstalling: npm install -g @skillsgate/tui");
28
52
  process.exit(1);
29
53
  }
54
+
55
+ execFileSync(binPath, process.argv.slice(2), { stdio: "inherit" });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skillsgate/tui",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "skillsgate-tui": "bin/skillsgate-tui"
@@ -14,6 +14,13 @@
14
14
  "@opentui/react": "0.1.90",
15
15
  "gray-matter": "4.0.3"
16
16
  },
17
+ "optionalDependencies": {
18
+ "@skillsgate/tui-darwin-arm64": "0.1.5",
19
+ "@skillsgate/tui-darwin-x64": "0.1.5",
20
+ "@skillsgate/tui-linux-x64": "0.1.5",
21
+ "@skillsgate/tui-linux-arm64": "0.1.5",
22
+ "@skillsgate/tui-win32-x64": "0.1.5"
23
+ },
17
24
  "peerDependencies": {
18
25
  "react": "19.1.5"
19
26
  },