weave-cash-cli 0.1.4

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/README.md ADDED
@@ -0,0 +1,20 @@
1
+ # weave-cash-cli
2
+
3
+ NPM distribution package for the Weave Cash CLI binary (`weave`).
4
+
5
+ This package ships prebuilt binaries for:
6
+
7
+ - macOS (`arm64`, `x64`)
8
+ - Linux (`arm64`, `x64`)
9
+
10
+ Install:
11
+
12
+ ```bash
13
+ npm i -g weave-cash-cli
14
+ ```
15
+
16
+ Then run:
17
+
18
+ ```bash
19
+ weave --help
20
+ ```
package/bin/weave.js ADDED
@@ -0,0 +1,72 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('node:fs');
4
+ const path = require('node:path');
5
+ const { spawnSync } = require('node:child_process');
6
+
7
+ const BINARY_NAME = 'weave';
8
+
9
+ const PLATFORM_MAP = {
10
+ darwin: 'darwin',
11
+ linux: 'linux',
12
+ };
13
+
14
+ const ARCH_MAP = {
15
+ x64: 'amd64',
16
+ arm64: 'arm64',
17
+ };
18
+
19
+ function main() {
20
+ const platform = PLATFORM_MAP[process.platform];
21
+ const arch = ARCH_MAP[process.arch];
22
+
23
+ if (!platform || !arch) {
24
+ fail(
25
+ `Unsupported platform/arch: ${process.platform}/${process.arch}. ` +
26
+ 'Supported: darwin/linux + x64/arm64.'
27
+ );
28
+ }
29
+
30
+ const binaryPath = path.join(
31
+ __dirname,
32
+ '..',
33
+ 'vendor',
34
+ `${platform}-${arch}`,
35
+ BINARY_NAME
36
+ );
37
+
38
+ ensureReadable(binaryPath);
39
+
40
+ const result = spawnSync(binaryPath, process.argv.slice(2), {
41
+ stdio: 'inherit',
42
+ env: process.env,
43
+ });
44
+
45
+ if (result.error) {
46
+ fail(`Failed to run bundled binary: ${result.error.message}`);
47
+ }
48
+
49
+ if (typeof result.status === 'number') {
50
+ process.exit(result.status);
51
+ }
52
+
53
+ process.exit(1);
54
+ }
55
+
56
+ function ensureReadable(binaryPath) {
57
+ try {
58
+ fs.accessSync(binaryPath, fs.constants.R_OK | fs.constants.X_OK);
59
+ } catch {
60
+ fail(
61
+ `Bundled binary not found or not executable at ${binaryPath}. ` +
62
+ 'Try reinstalling weave-cash-cli.'
63
+ );
64
+ }
65
+ }
66
+
67
+ function fail(message) {
68
+ console.error(`[weave-cash-cli] ${message}`);
69
+ process.exit(1);
70
+ }
71
+
72
+ main();
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "weave-cash-cli",
3
+ "version": "0.1.4",
4
+ "description": "Weave Cash CLI binary wrapper.",
5
+ "license": "AGPL-3.0-or-later",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/AryanJ-NYC/weave-cash.git"
9
+ },
10
+ "bugs": {
11
+ "url": "https://github.com/AryanJ-NYC/weave-cash/issues"
12
+ },
13
+ "homepage": "https://www.weavecash.com",
14
+ "bin": {
15
+ "weave": "bin/weave.js"
16
+ },
17
+ "files": [
18
+ "bin/",
19
+ "vendor/",
20
+ "README.md"
21
+ ],
22
+ "os": [
23
+ "darwin",
24
+ "linux"
25
+ ],
26
+ "cpu": [
27
+ "x64",
28
+ "arm64"
29
+ ],
30
+ "engines": {
31
+ "node": ">=18"
32
+ },
33
+ "keywords": [
34
+ "weave",
35
+ "weave-cash",
36
+ "cli",
37
+ "crypto",
38
+ "invoices"
39
+ ]
40
+ }
Binary file
Binary file
Binary file
Binary file