@nibiruchain/nibiru 2.0.0

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 (3) hide show
  1. package/README.md +12 -0
  2. package/bin/nibiru.js +45 -0
  3. package/package.json +19 -0
package/README.md ADDED
@@ -0,0 +1,12 @@
1
+ # @nibiruchain/nibiru
2
+
3
+ Install Nibiru's command-line client:
4
+
5
+ ```bash
6
+ npm install -g @nibiruchain/nibiru
7
+ nibiru version
8
+ ```
9
+
10
+ The package supports Linux and macOS on x64 and arm64. It selects the native
11
+ binary package for the host platform. No install script downloads or copies a
12
+ binary.
package/bin/nibiru.js ADDED
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env node
2
+
3
+ "use strict";
4
+
5
+ const { spawn } = require("node:child_process");
6
+ const { dirname, join } = require("node:path");
7
+
8
+ const packages = {
9
+ "linux-x64": "@nibiruchain/nibiru-linux-x64",
10
+ "linux-arm64": "@nibiruchain/nibiru-linux-arm64",
11
+ "darwin-x64": "@nibiruchain/nibiru-darwin-x64",
12
+ "darwin-arm64": "@nibiruchain/nibiru-darwin-arm64",
13
+ };
14
+
15
+ const target = `${process.platform}-${process.arch}`;
16
+ const packageName = packages[target];
17
+
18
+ if (!packageName) {
19
+ console.error(`nibiru does not support ${target}. Supported targets: ${Object.keys(packages).join(", ")}.`);
20
+ process.exit(1);
21
+ }
22
+
23
+ let packageJson;
24
+ try {
25
+ packageJson = require.resolve(`${packageName}/package.json`);
26
+ } catch {
27
+ console.error(`nibiru's native package for ${target} is missing (${packageName}). Reinstall without --omit=optional.`);
28
+ process.exit(1);
29
+ }
30
+
31
+ const binary = join(dirname(packageJson), "bin", "nibid");
32
+ const child = spawn(binary, process.argv.slice(2), { stdio: "inherit" });
33
+
34
+ child.on("error", (error) => {
35
+ console.error(`failed to start ${binary}: ${error.message}`);
36
+ process.exit(1);
37
+ });
38
+
39
+ child.on("exit", (code, signal) => {
40
+ if (signal) {
41
+ process.kill(process.pid, signal);
42
+ return;
43
+ }
44
+ process.exit(code ?? 1);
45
+ });
package/package.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "@nibiruchain/nibiru",
3
+ "version": "2.0.0",
4
+ "description": "Nibiru command-line client",
5
+ "license": "Apache-2.0",
6
+ "bin": {
7
+ "nibiru": "bin/nibiru.js"
8
+ },
9
+ "files": [
10
+ "bin/nibiru.js",
11
+ "README.md"
12
+ ],
13
+ "optionalDependencies": {
14
+ "@nibiruchain/nibiru-linux-x64": "2.0.0",
15
+ "@nibiruchain/nibiru-linux-arm64": "2.0.0",
16
+ "@nibiruchain/nibiru-darwin-x64": "2.0.0",
17
+ "@nibiruchain/nibiru-darwin-arm64": "2.0.0"
18
+ }
19
+ }