envio 0.0.6 → 0.0.7
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/lib/index.js +38 -0
- package/package.json +6 -6
package/lib/index.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
/**
|
|
6
|
+
* Returns the executable path for envio located inside node_modules
|
|
7
|
+
* The naming convention is envio-${os}-${arch}
|
|
8
|
+
* If the platform is `win32` or `cygwin`, executable will include a `.exe` extension
|
|
9
|
+
* @see https://nodejs.org/api/os.html#osarch
|
|
10
|
+
* @see https://nodejs.org/api/os.html#osplatform
|
|
11
|
+
* @example "x/xx/node_modules/envio-darwin-arm64"
|
|
12
|
+
*/
|
|
13
|
+
function getExePath() {
|
|
14
|
+
const arch = process.arch;
|
|
15
|
+
let os = process.platform;
|
|
16
|
+
let extension = '';
|
|
17
|
+
if (['win32', 'cygwin'].includes(process.platform)) {
|
|
18
|
+
os = 'windows';
|
|
19
|
+
extension = '.exe';
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
// Since the bin will be located inside `node_modules`, we can simply call require.resolve
|
|
23
|
+
return require.resolve(`envio-${os}-${arch}/bin/envio${extension}`);
|
|
24
|
+
}
|
|
25
|
+
catch (e) {
|
|
26
|
+
throw new Error(`Couldn't find envio binary inside node_modules for ${os}-${arch}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Runs `envio` with args using nodejs spawn
|
|
31
|
+
*/
|
|
32
|
+
function runEnvio() {
|
|
33
|
+
var _a;
|
|
34
|
+
const args = process.argv.slice(2);
|
|
35
|
+
const processResult = (0, child_process_1.spawnSync)(getExePath(), args, { stdio: "inherit" });
|
|
36
|
+
process.exit((_a = processResult.status) !== null && _a !== void 0 ? _a : 0);
|
|
37
|
+
}
|
|
38
|
+
runEnvio();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "envio",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "A ️latency and sync speed optimized, developer friendly blockchain data indexer.",
|
|
5
5
|
"bin": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
"typescript": "^4.9.4"
|
|
36
36
|
},
|
|
37
37
|
"optionalDependencies": {
|
|
38
|
-
"envio-linux-x64": "
|
|
39
|
-
"envio-linux-arm64": "
|
|
40
|
-
"envio-darwin-x64": "
|
|
41
|
-
"envio-darwin-arm64": "
|
|
42
|
-
"envio-win32-x64": "
|
|
38
|
+
"envio-linux-x64": "0.0.7",
|
|
39
|
+
"envio-linux-arm64": "0.0.7",
|
|
40
|
+
"envio-darwin-x64": "0.0.7",
|
|
41
|
+
"envio-darwin-arm64": "0.0.7",
|
|
42
|
+
"envio-win32-x64": "0.0.7"
|
|
43
43
|
},
|
|
44
44
|
"eslintConfig": {
|
|
45
45
|
"extends": [
|