near-cli-rs 0.16.0 → 0.16.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/CHANGELOG.md CHANGED
@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.16.1](https://github.com/near/near-cli-rs/compare/v0.16.0...v0.16.1) - 2024-12-06
11
+
12
+ ### Added
13
+
14
+ - Added the ability to save payload for broadcast_tx_commit ([#413](https://github.com/near/near-cli-rs/pull/413))
15
+ - Get the final CLI command into the shell history with a small helper setup ([#415](https://github.com/near/near-cli-rs/pull/415))
16
+ - Trace configuration for loading wait indicators and --teach-me flag moved to library ([#417](https://github.com/near/near-cli-rs/pull/417))
17
+ - add to devtools workflow
18
+
10
19
  ## [0.16.0](https://github.com/near/near-cli-rs/compare/v0.15.1...v0.16.0) - 2024-11-18
11
20
 
12
21
  ### Other
package/README.md CHANGED
@@ -137,7 +137,7 @@ $ near
137
137
  [↑↓ to move, enter to select, type to filter]
138
138
  ```
139
139
 
140
- The CLI interactively guides you through some pretty complex topics, helping you make informed decisions along the way.
140
+ The CLI interactively guides you through some pretty complex topics, helping you make informed decisions along the way. Also, you can enable [shell history integration](docs/SHELL_HISTORY_INTEGRATION.md)
141
141
 
142
142
  ## [Read more in English](docs/README.en.md)
143
143
  - [Usage](docs/README.en.md#usage)
package/binary-install.js CHANGED
@@ -1,10 +1,11 @@
1
- const { existsSync, mkdirSync } = require("fs");
2
- const { join } = require("path");
1
+ const { createWriteStream, existsSync, mkdirSync, mkdtemp } = require("fs");
2
+ const { join, sep } = require("path");
3
3
  const { spawnSync } = require("child_process");
4
+ const { tmpdir } = require("os");
4
5
 
5
6
  const axios = require("axios");
6
- const tar = require("tar");
7
7
  const rimraf = require("rimraf");
8
+ const tmpDir = tmpdir();
8
9
 
9
10
  const error = (msg) => {
10
11
  console.error(msg);
@@ -12,7 +13,7 @@ const error = (msg) => {
12
13
  };
13
14
 
14
15
  class Package {
15
- constructor(name, url, binaries) {
16
+ constructor(name, url, filename, zipExt, binaries) {
16
17
  let errors = [];
17
18
  if (typeof url !== "string") {
18
19
  errors.push("url must be a string");
@@ -48,6 +49,8 @@ class Package {
48
49
  }
49
50
  this.url = url;
50
51
  this.name = name;
52
+ this.filename = filename;
53
+ this.zipExt = zipExt;
51
54
  this.installDirectory = join(__dirname, "node_modules", ".bin_real");
52
55
  this.binaries = binaries;
53
56
 
@@ -90,11 +93,59 @@ class Package {
90
93
  return axios({ ...fetchOptions, url: this.url, responseType: "stream" })
91
94
  .then((res) => {
92
95
  return new Promise((resolve, reject) => {
93
- const sink = res.data.pipe(
94
- tar.x({ strip: 1, C: this.installDirectory }),
95
- );
96
- sink.on("finish", () => resolve());
97
- sink.on("error", (err) => reject(err));
96
+ mkdtemp(`${tmpDir}${sep}`, (err, directory) => {
97
+ let tempFile = join(directory, this.filename);
98
+ const sink = res.data.pipe(createWriteStream(tempFile));
99
+ sink.on("error", (err) => reject(err));
100
+ sink.on("close", () => {
101
+ if (/\.tar\.*/.test(this.zipExt)) {
102
+ const result = spawnSync("tar", [
103
+ "xf",
104
+ tempFile,
105
+ // The tarballs are stored with a leading directory
106
+ // component; we strip one component in the
107
+ // shell installers too.
108
+ "--strip-components",
109
+ "1",
110
+ "-C",
111
+ this.installDirectory,
112
+ ]);
113
+ if (result.status == 0) {
114
+ resolve();
115
+ } else if (result.error) {
116
+ reject(result.error);
117
+ } else {
118
+ reject(
119
+ new Error(
120
+ `An error occurred untarring the artifact: stdout: ${result.stdout}; stderr: ${result.stderr}`,
121
+ ),
122
+ );
123
+ }
124
+ } else if (this.zipExt == ".zip") {
125
+ const result = spawnSync("unzip", [
126
+ "-q",
127
+ tempFile,
128
+ "-d",
129
+ this.installDirectory,
130
+ ]);
131
+ if (result.status == 0) {
132
+ resolve();
133
+ } else if (result.error) {
134
+ reject(result.error);
135
+ } else {
136
+ reject(
137
+ new Error(
138
+ `An error occurred unzipping the artifact: stdout: ${result.stdout}; stderr: ${result.stderr}`,
139
+ ),
140
+ );
141
+ }
142
+ } else {
143
+ reject(
144
+ new Error(`Unrecognized file extension: ${this.zipExt}`),
145
+ );
146
+ }
147
+ });
148
+ });
98
149
  });
99
150
  })
100
151
  .then(() => {
package/binary.js CHANGED
@@ -94,7 +94,9 @@ const getPlatform = () => {
94
94
  const getPackage = () => {
95
95
  const platform = getPlatform();
96
96
  const url = `${artifactDownloadUrl}/${platform.artifactName}`;
97
- let binary = new Package(name, url, platform.bins);
97
+ let filename = platform.artifactName;
98
+ let ext = platform.zipExt;
99
+ let binary = new Package(name, url, filename, ext, platform.bins);
98
100
 
99
101
  return binary;
100
102
  };
@@ -7,12 +7,11 @@
7
7
  "near": "run-near.js"
8
8
  },
9
9
  "dependencies": {
10
- "axios": "^1.7.4",
10
+ "axios": "^1.7.7",
11
11
  "axios-proxy-builder": "^0.1.2",
12
12
  "console.table": "^0.10.0",
13
13
  "detect-libc": "^2.0.3",
14
- "rimraf": "^5.0.8",
15
- "tar": "^7.4.3"
14
+ "rimraf": "^5.0.8"
16
15
  },
17
16
  "devDependencies": {
18
17
  "prettier": "^3.3.3"
@@ -24,7 +23,7 @@
24
23
  "hasInstallScript": true,
25
24
  "license": "MIT OR Apache-2.0",
26
25
  "name": "near-cli-rs",
27
- "version": "0.16.0"
26
+ "version": "0.16.1"
28
27
  },
29
28
  "node_modules/@isaacs/cliui": {
30
29
  "dependencies": {
@@ -43,18 +42,6 @@
43
42
  "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz",
44
43
  "version": "8.0.2"
45
44
  },
46
- "node_modules/@isaacs/fs-minipass": {
47
- "dependencies": {
48
- "minipass": "^7.0.4"
49
- },
50
- "engines": {
51
- "node": ">=18.0.0"
52
- },
53
- "integrity": "sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w==",
54
- "license": "ISC",
55
- "resolved": "https://registry.npmjs.org/@isaacs/fs-minipass/-/fs-minipass-4.0.1.tgz",
56
- "version": "4.0.1"
57
- },
58
45
  "node_modules/@pkgjs/parseargs": {
59
46
  "engines": {
60
47
  "node": ">=14"
@@ -101,9 +88,9 @@
101
88
  "form-data": "^4.0.0",
102
89
  "proxy-from-env": "^1.1.0"
103
90
  },
104
- "integrity": "sha512-DukmaFRnY6AzAALSH4J2M3k6PkaC+MfaAGdEERRWcC9q3/TWQwLpHR8ZRLKTdQ3aBDL64EdluRDjJqKw+BPZEw==",
105
- "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.4.tgz",
106
- "version": "1.7.4"
91
+ "integrity": "sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==",
92
+ "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.7.tgz",
93
+ "version": "1.7.7"
107
94
  },
108
95
  "node_modules/axios-proxy-builder": {
109
96
  "dependencies": {
@@ -129,15 +116,6 @@
129
116
  "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
130
117
  "version": "2.0.1"
131
118
  },
132
- "node_modules/chownr": {
133
- "engines": {
134
- "node": ">=18"
135
- },
136
- "integrity": "sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==",
137
- "license": "BlueOak-1.0.0",
138
- "resolved": "https://registry.npmjs.org/chownr/-/chownr-3.0.0.tgz",
139
- "version": "3.0.0"
140
- },
141
119
  "node_modules/clone": {
142
120
  "engines": {
143
121
  "node": ">=0.8"
@@ -414,34 +392,6 @@
414
392
  "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",
415
393
  "version": "7.1.2"
416
394
  },
417
- "node_modules/minizlib": {
418
- "dependencies": {
419
- "minipass": "^7.0.4",
420
- "rimraf": "^5.0.5"
421
- },
422
- "engines": {
423
- "node": ">= 18"
424
- },
425
- "integrity": "sha512-umcy022ILvb5/3Djuu8LWeqUa8D68JaBzlttKeMWen48SjabqS3iY5w/vzeMzMUNhLDifyhbOwKDSznB1vvrwg==",
426
- "license": "MIT",
427
- "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-3.0.1.tgz",
428
- "version": "3.0.1"
429
- },
430
- "node_modules/mkdirp": {
431
- "bin": {
432
- "mkdirp": "dist/cjs/src/bin.js"
433
- },
434
- "engines": {
435
- "node": ">=10"
436
- },
437
- "funding": {
438
- "url": "https://github.com/sponsors/isaacs"
439
- },
440
- "integrity": "sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg==",
441
- "license": "MIT",
442
- "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-3.0.1.tgz",
443
- "version": "3.0.1"
444
- },
445
395
  "node_modules/path-key": {
446
396
  "engines": {
447
397
  "node": ">=8"
@@ -634,22 +584,6 @@
634
584
  "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
635
585
  "version": "5.0.1"
636
586
  },
637
- "node_modules/tar": {
638
- "dependencies": {
639
- "@isaacs/fs-minipass": "^4.0.0",
640
- "chownr": "^3.0.0",
641
- "minipass": "^7.1.2",
642
- "minizlib": "^3.0.1",
643
- "mkdirp": "^3.0.1",
644
- "yallist": "^5.0.0"
645
- },
646
- "engines": {
647
- "node": ">=18"
648
- },
649
- "integrity": "sha512-5S7Va8hKfV7W5U6g3aYxXmlPoZVAwUMy9AOKyF2fVuZa2UD3qZjg578OrLRt8PcNN1PleVaL/5/yYATNL0ICUw==",
650
- "resolved": "https://registry.npmjs.org/tar/-/tar-7.4.3.tgz",
651
- "version": "7.4.3"
652
- },
653
587
  "node_modules/tunnel": {
654
588
  "engines": {
655
589
  "node": ">=0.6.11 <=0.7.0 || >=0.7.3"
@@ -774,17 +708,8 @@
774
708
  "license": "MIT",
775
709
  "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
776
710
  "version": "6.0.1"
777
- },
778
- "node_modules/yallist": {
779
- "engines": {
780
- "node": ">=18"
781
- },
782
- "integrity": "sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==",
783
- "license": "BlueOak-1.0.0",
784
- "resolved": "https://registry.npmjs.org/yallist/-/yallist-5.0.0.tgz",
785
- "version": "5.0.0"
786
711
  }
787
712
  },
788
713
  "requires": true,
789
- "version": "0.16.0"
714
+ "version": "0.16.1"
790
715
  }
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "artifactDownloadUrl": "https://github.com/near/near-cli-rs/releases/download/v0.16.0",
2
+ "artifactDownloadUrl": "https://github.com/near/near-cli-rs/releases/download/v0.16.1",
3
3
  "bin": {
4
4
  "near": "run-near.js"
5
5
  },
@@ -8,12 +8,11 @@
8
8
  "Near Inc <hello@nearprotocol.com>"
9
9
  ],
10
10
  "dependencies": {
11
- "axios": "^1.7.4",
11
+ "axios": "^1.7.7",
12
12
  "axios-proxy-builder": "^0.1.2",
13
13
  "console.table": "^0.10.0",
14
14
  "detect-libc": "^2.0.3",
15
- "rimraf": "^5.0.8",
16
- "tar": "^7.4.3"
15
+ "rimraf": "^5.0.8"
17
16
  },
18
17
  "description": "human-friendly console utility that helps to interact with NEAR Protocol from command line.",
19
18
  "devDependencies": {
@@ -88,7 +87,7 @@
88
87
  "zipExt": ".tar.gz"
89
88
  }
90
89
  },
91
- "version": "0.16.0",
90
+ "version": "0.16.1",
92
91
  "volta": {
93
92
  "node": "18.14.1",
94
93
  "npm": "9.5.0"