celq 0.1.1-alpha.6 → 0.1.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/lib/index.js +37 -0
- package/package.json +7 -7
package/lib/index.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
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 which is located inside `node_modules`
|
|
7
|
+
* The naming convention is @ivaniscoding/celq-${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
|
+
*/
|
|
12
|
+
function getExePath() {
|
|
13
|
+
const arch = process.arch;
|
|
14
|
+
let os = process.platform;
|
|
15
|
+
let extension = "";
|
|
16
|
+
if (["win32", "cygwin"].includes(process.platform)) {
|
|
17
|
+
os = "windows";
|
|
18
|
+
extension = ".exe";
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
// Since the binary will be located inside `node_modules`, we can simply call `require.resolve`
|
|
22
|
+
return require.resolve(`@ivaniscoding/celq-${os}-${arch}/bin/celq${extension}`);
|
|
23
|
+
}
|
|
24
|
+
catch (e) {
|
|
25
|
+
throw new Error(`Couldn't find application binary inside node_modules for ${os}-${arch}`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Runs the application with args using nodejs spawn
|
|
30
|
+
*/
|
|
31
|
+
function run() {
|
|
32
|
+
var _a;
|
|
33
|
+
const args = process.argv.slice(2);
|
|
34
|
+
const processResult = (0, child_process_1.spawnSync)(getExePath(), args, { stdio: "inherit" });
|
|
35
|
+
process.exit((_a = processResult.status) !== null && _a !== void 0 ? _a : 0);
|
|
36
|
+
}
|
|
37
|
+
run();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "celq",
|
|
3
|
-
"version": "0.1.1
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"bin": "lib/index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"typecheck": "tsc --noEmit",
|
|
@@ -26,12 +26,12 @@
|
|
|
26
26
|
"typescript": "^5.9.3"
|
|
27
27
|
},
|
|
28
28
|
"optionalDependencies": {
|
|
29
|
-
"@ivaniscoding/celq-darwin-arm64": "0.1.1
|
|
30
|
-
"@ivaniscoding/celq-darwin-x64": "0.1.1
|
|
31
|
-
"@ivaniscoding/celq-linux-arm64": "0.1.1
|
|
32
|
-
"@ivaniscoding/celq-linux-x64": "0.1.1
|
|
33
|
-
"@ivaniscoding/celq-windows-arm64": "0.1.1
|
|
34
|
-
"@ivaniscoding/celq-windows-x64": "0.1.1
|
|
29
|
+
"@ivaniscoding/celq-darwin-arm64": "0.1.1",
|
|
30
|
+
"@ivaniscoding/celq-darwin-x64": "0.1.1",
|
|
31
|
+
"@ivaniscoding/celq-linux-arm64": "0.1.1",
|
|
32
|
+
"@ivaniscoding/celq-linux-x64": "0.1.1",
|
|
33
|
+
"@ivaniscoding/celq-windows-arm64": "0.1.1",
|
|
34
|
+
"@ivaniscoding/celq-windows-x64": "0.1.1"
|
|
35
35
|
},
|
|
36
36
|
"eslintConfig": {
|
|
37
37
|
"extends": [
|