@datamitsu/datamitsu 0.0.1-alpha-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.
Files changed (3) hide show
  1. package/bin/index.js +12 -0
  2. package/get-exe.js +52 -0
  3. package/package.json +43 -0
package/bin/index.js ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawn } = require("child_process");
4
+ const { getExePath } = require("../get-exe");
5
+
6
+ const child = spawn(getExePath(), process.argv.slice(2), { stdio: "inherit" });
7
+
8
+ child.on("exit", (code) => {
9
+ if (code !== 0) {
10
+ process.exit(code);
11
+ }
12
+ });
package/get-exe.js ADDED
@@ -0,0 +1,52 @@
1
+ const { existsSync } = require("fs");
2
+ const { join } = require("path");
3
+
4
+ function getPlatform() {
5
+ const platform = process.platform;
6
+ if (platform === "win32" || platform === "cygwin") {
7
+ return "windows";
8
+ }
9
+ return platform;
10
+ }
11
+
12
+ function getArch() {
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
+ }
23
+
24
+ function getExePath() {
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
+ }
51
+
52
+ module.exports = { getExePath };
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@datamitsu/datamitsu",
3
+ "version": "0.0.1-alpha-1",
4
+ "description": "Configuration management and binary distribution tool. JavaScript-configurable tool orchestration written in Go.",
5
+ "bin": {
6
+ "datamitsu": "bin/index.js"
7
+ },
8
+ "files": [
9
+ "bin",
10
+ "get-exe.js"
11
+ ],
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/shibanet0/s0conf.git"
15
+ },
16
+ "keywords": [
17
+ "datamitsu",
18
+ "config",
19
+ "binary",
20
+ "tools",
21
+ "linter",
22
+ "lefthook",
23
+ "golangci-lint",
24
+ "hadolint",
25
+ "shellcheck"
26
+ ],
27
+ "author": "Alexander Svinarev <shibanet0@gmail.com> (shibanet0.com)",
28
+ "license": "MIT",
29
+ "bugs": {
30
+ "url": "https://github.com/shibanet0/s0conf/issues"
31
+ },
32
+ "homepage": "https://github.com/shibanet0/s0conf#readme",
33
+ "optionalDependencies": {
34
+ "@datamitsu/datamitsu-darwin-arm64": "0.0.1-alpha-1",
35
+ "@datamitsu/datamitsu-darwin-x64": "0.0.1-alpha-1",
36
+ "@datamitsu/datamitsu-linux-arm64": "0.0.1-alpha-1",
37
+ "@datamitsu/datamitsu-linux-x64": "0.0.1-alpha-1",
38
+ "@datamitsu/datamitsu-windows-arm64": "0.0.1-alpha-1",
39
+ "@datamitsu/datamitsu-windows-x64": "0.0.1-alpha-1",
40
+ "@datamitsu/datamitsu-freebsd-arm64": "0.0.1-alpha-1",
41
+ "@datamitsu/datamitsu-freebsd-x64": "0.0.1-alpha-1"
42
+ }
43
+ }