@local-wallet-standard/node 0.2.22 → 0.2.25

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/lws +77 -0
  2. package/package.json +10 -6
package/bin/lws ADDED
@@ -0,0 +1,77 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { execFileSync } = require("child_process");
4
+ const { existsSync } = require("fs");
5
+ const { join } = require("path");
6
+ const { platform, arch } = process;
7
+
8
+ const PLATFORM_MAP = {
9
+ "darwin-arm64": {
10
+ pkg: "@local-wallet-standard/node-darwin-arm64",
11
+ bin: "lws",
12
+ },
13
+ "darwin-x64": {
14
+ pkg: "@local-wallet-standard/node-darwin-x64",
15
+ bin: "lws",
16
+ },
17
+ "linux-x64": {
18
+ pkg: "@local-wallet-standard/node-linux-x64-gnu",
19
+ bin: "lws",
20
+ },
21
+ "linux-arm64": {
22
+ pkg: "@local-wallet-standard/node-linux-arm64-gnu",
23
+ bin: "lws",
24
+ },
25
+ };
26
+
27
+ const key = `${platform}-${arch}`;
28
+ const entry = PLATFORM_MAP[key];
29
+
30
+ if (!entry) {
31
+ console.error(
32
+ `lws: unsupported platform ${platform}-${arch}. ` +
33
+ `Install the CLI manually: https://openwallet.sh`
34
+ );
35
+ process.exit(1);
36
+ }
37
+
38
+ // Try to find the binary in the platform-specific optional dependency
39
+ let binPath;
40
+
41
+ // 1. Check inside node_modules (normal npm install)
42
+ try {
43
+ const pkgDir = require.resolve(`${entry.pkg}/package.json`);
44
+ binPath = join(pkgDir, "..", entry.bin);
45
+ } catch {}
46
+
47
+ // 2. Check local npm/ directory (development / monorepo)
48
+ if (!binPath || !existsSync(binPath)) {
49
+ const localDir = join(
50
+ __dirname,
51
+ "..",
52
+ "npm",
53
+ entry.pkg.split("/").pop(),
54
+ entry.bin
55
+ );
56
+ if (existsSync(localDir)) {
57
+ binPath = localDir;
58
+ }
59
+ }
60
+
61
+ if (!binPath || !existsSync(binPath)) {
62
+ console.error(
63
+ `lws: CLI binary not found for ${platform}-${arch}.\n` +
64
+ `The platform package ${entry.pkg} may not be installed.\n` +
65
+ `Install the CLI manually: https://openwallet.sh`
66
+ );
67
+ process.exit(1);
68
+ }
69
+
70
+ try {
71
+ execFileSync(binPath, process.argv.slice(2), { stdio: "inherit" });
72
+ } catch (e) {
73
+ if (e.status !== undefined) {
74
+ process.exit(e.status);
75
+ }
76
+ throw e;
77
+ }
package/package.json CHANGED
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "name": "@local-wallet-standard/node",
3
- "version": "0.2.22",
3
+ "version": "0.2.25",
4
4
  "description": "Node.js native bindings for the Lightweight Wallet Signer",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
7
+ "bin": {
8
+ "lws": "bin/lws"
9
+ },
7
10
  "napi": {
8
11
  "name": "lws-node",
9
12
  "triples": {
@@ -28,14 +31,15 @@
28
31
  "@napi-rs/cli": "^2.18.0"
29
32
  },
30
33
  "optionalDependencies": {
31
- "@local-wallet-standard/node-linux-x64-gnu": "0.2.22",
32
- "@local-wallet-standard/node-linux-arm64-gnu": "0.2.22",
33
- "@local-wallet-standard/node-darwin-x64": "0.2.22",
34
- "@local-wallet-standard/node-darwin-arm64": "0.2.22"
34
+ "@local-wallet-standard/node-linux-x64-gnu": "0.2.25",
35
+ "@local-wallet-standard/node-linux-arm64-gnu": "0.2.25",
36
+ "@local-wallet-standard/node-darwin-x64": "0.2.25",
37
+ "@local-wallet-standard/node-darwin-arm64": "0.2.25"
35
38
  },
36
39
  "license": "MIT",
37
40
  "files": [
38
41
  "index.js",
39
- "index.d.ts"
42
+ "index.d.ts",
43
+ "bin/lws"
40
44
  ]
41
45
  }