@datamitsu/datamitsu 0.0.1-alpha-1 → 0.0.1-alpha-2
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/bin/index.js +10 -4
- package/get-exe.js +39 -39
- package/package.json +9 -9
package/bin/index.js
CHANGED
|
@@ -3,10 +3,16 @@
|
|
|
3
3
|
const { spawn } = require("child_process");
|
|
4
4
|
const { getExePath } = require("../get-exe");
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// Add --binary-command datamitsu to args if not already present
|
|
7
|
+
const args = process.argv.slice(2);
|
|
8
|
+
if (!args.includes("--binary-command")) {
|
|
9
|
+
args.unshift("--binary-command", "datamitsu");
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const child = spawn(getExePath(), args, { stdio: "inherit" });
|
|
7
13
|
|
|
8
14
|
child.on("exit", (code) => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
15
|
+
if (code !== 0) {
|
|
16
|
+
process.exit(code);
|
|
17
|
+
}
|
|
12
18
|
});
|
package/get-exe.js
CHANGED
|
@@ -2,51 +2,51 @@ const { existsSync } = require("fs");
|
|
|
2
2
|
const { join } = require("path");
|
|
3
3
|
|
|
4
4
|
function getPlatform() {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
const platform = process.platform;
|
|
6
|
+
if (platform === "win32" || platform === "cygwin") {
|
|
7
|
+
return "windows";
|
|
8
|
+
}
|
|
9
|
+
return platform;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
function getArch() {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
const arch = process.arch;
|
|
14
|
+
// Normalize architecture names
|
|
15
|
+
if (arch === "x64") {
|
|
16
|
+
return "x64";
|
|
17
|
+
}
|
|
18
|
+
if (arch === "arm64" || arch === "aarch64") {
|
|
19
|
+
return "arm64";
|
|
20
|
+
}
|
|
21
|
+
return arch;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
function getExePath() {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
25
|
+
const platform = getPlatform();
|
|
26
|
+
const arch = getArch();
|
|
27
|
+
const ext = platform === "windows" ? ".exe" : "";
|
|
28
|
+
|
|
29
|
+
const packageName = `@datamitsu/datamitsu-${platform}-${arch}`;
|
|
30
|
+
const exeName = `datamitsu${ext}`;
|
|
31
|
+
|
|
32
|
+
try {
|
|
33
|
+
// Try to resolve the platform-specific package
|
|
34
|
+
const packagePath = require.resolve(`${packageName}/package.json`);
|
|
35
|
+
const packageDir = join(packagePath, "..");
|
|
36
|
+
const exePath = join(packageDir, exeName);
|
|
37
|
+
|
|
38
|
+
if (existsSync(exePath)) {
|
|
39
|
+
return exePath;
|
|
40
|
+
}
|
|
41
|
+
} catch (e) {
|
|
42
|
+
// Package not found
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
throw new Error(
|
|
46
|
+
`datamitsu binary not found for platform ${platform}-${arch}.\n` +
|
|
47
|
+
`Please make sure the package "${packageName}" is installed.\n` +
|
|
48
|
+
`If you're seeing this error, try reinstalling datamitsu: npm install @datamitsu/datamitsu`
|
|
49
|
+
);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
module.exports = { getExePath };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datamitsu/datamitsu",
|
|
3
|
-
"version": "0.0.1-alpha-
|
|
3
|
+
"version": "0.0.1-alpha-2",
|
|
4
4
|
"description": "Configuration management and binary distribution tool. JavaScript-configurable tool orchestration written in Go.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"datamitsu": "bin/index.js"
|
|
@@ -31,13 +31,13 @@
|
|
|
31
31
|
},
|
|
32
32
|
"homepage": "https://github.com/shibanet0/s0conf#readme",
|
|
33
33
|
"optionalDependencies": {
|
|
34
|
-
"@datamitsu/datamitsu-darwin-arm64": "0.0.1-alpha-
|
|
35
|
-
"@datamitsu/datamitsu-darwin-x64": "0.0.1-alpha-
|
|
36
|
-
"@datamitsu/datamitsu-linux-arm64": "0.0.1-alpha-
|
|
37
|
-
"@datamitsu/datamitsu-linux-x64": "0.0.1-alpha-
|
|
38
|
-
"@datamitsu/datamitsu-windows-arm64": "0.0.1-alpha-
|
|
39
|
-
"@datamitsu/datamitsu-windows-x64": "0.0.1-alpha-
|
|
40
|
-
"@datamitsu/datamitsu-freebsd-arm64": "0.0.1-alpha-
|
|
41
|
-
"@datamitsu/datamitsu-freebsd-x64": "0.0.1-alpha-
|
|
34
|
+
"@datamitsu/datamitsu-darwin-arm64": "0.0.1-alpha-2",
|
|
35
|
+
"@datamitsu/datamitsu-darwin-x64": "0.0.1-alpha-2",
|
|
36
|
+
"@datamitsu/datamitsu-linux-arm64": "0.0.1-alpha-2",
|
|
37
|
+
"@datamitsu/datamitsu-linux-x64": "0.0.1-alpha-2",
|
|
38
|
+
"@datamitsu/datamitsu-windows-arm64": "0.0.1-alpha-2",
|
|
39
|
+
"@datamitsu/datamitsu-windows-x64": "0.0.1-alpha-2",
|
|
40
|
+
"@datamitsu/datamitsu-freebsd-arm64": "0.0.1-alpha-2",
|
|
41
|
+
"@datamitsu/datamitsu-freebsd-x64": "0.0.1-alpha-2"
|
|
42
42
|
}
|
|
43
43
|
}
|