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