@datamitsu/datamitsu 0.0.0-unstable.20260412.633a430

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 +19 -0
  2. package/get-exe.js +53 -0
  3. package/package.json +63 -0
package/bin/index.js ADDED
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { spawn } from "node:child_process";
4
+
5
+ import { getExePath } from "../get-exe.js";
6
+
7
+ // Add --binary-command datamitsu to args if not already present
8
+ const args = process.argv.slice(2);
9
+ if (!args.includes("--binary-command")) {
10
+ args.unshift("--binary-command", "datamitsu");
11
+ }
12
+
13
+ const child = spawn(getExePath(), args, { stdio: "inherit" });
14
+
15
+ child.on("exit", (code) => {
16
+ if (code !== 0) {
17
+ process.exit(code);
18
+ }
19
+ });
package/get-exe.js ADDED
@@ -0,0 +1,53 @@
1
+ import { existsSync } from "node:fs";
2
+ import { createRequire } from "node:module";
3
+ import { join } from "node:path";
4
+
5
+ export function getExePath() {
6
+ const platform = getPlatform();
7
+ const arch = getArch();
8
+ const ext = platform === "win32" ? ".exe" : "";
9
+
10
+ const packageName = `@datamitsu/datamitsu-${platform}-${arch}`;
11
+ const exeName = `datamitsu${ext}`;
12
+
13
+ try {
14
+ // Try to resolve the platform-specific package using createRequire for ES modules
15
+ const require = createRequire(import.meta.url);
16
+ const packagePath = require.resolve(`${packageName}/package.json`);
17
+ const packageDir = join(packagePath, "..");
18
+ const exePath = join(packageDir, exeName);
19
+
20
+ if (existsSync(exePath)) {
21
+ return exePath;
22
+ }
23
+ } catch {
24
+ // Package not found
25
+ }
26
+
27
+ throw new Error(
28
+ `datamitsu binary not found for platform ${platform}-${arch}.\n` +
29
+ `Please make sure the package "${packageName}" is installed.\n` +
30
+ `If you're seeing this error, try reinstalling datamitsu: npm install @datamitsu/datamitsu`,
31
+ );
32
+ }
33
+
34
+ function getArch() {
35
+ const arch = process.arch;
36
+ // Normalize architecture names
37
+ if (arch === "x64") {
38
+ return "x64";
39
+ }
40
+ if (arch === "arm64" || arch === "aarch64") {
41
+ return "arm64";
42
+ }
43
+ return arch;
44
+ }
45
+
46
+ function getPlatform() {
47
+ const platform = process.platform;
48
+ // Keep win32 as-is to match package names
49
+ if (platform === "cygwin") {
50
+ return "win32";
51
+ }
52
+ return platform;
53
+ }
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@datamitsu/datamitsu",
3
+ "version": "0.0.0-unstable.20260412.633a430",
4
+ "description": "Configuration management and binary distribution tool. JavaScript-configurable tool orchestration written in Go.",
5
+ "keywords": [
6
+ "datamitsu",
7
+ "config",
8
+ "binary",
9
+ "tools",
10
+ "linter",
11
+ "lefthook",
12
+ "golangci-lint",
13
+ "hadolint",
14
+ "shellcheck"
15
+ ],
16
+ "homepage": "https://github.com/datamitsu/datamitsu#readme",
17
+ "bugs": {
18
+ "url": "https://github.com/datamitsu/datamitsu/issues"
19
+ },
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/datamitsu/datamitsu.git"
23
+ },
24
+ "license": "MIT",
25
+ "author": "Alexander Svinarev <shibanet0@gmail.com> (shibanet0.com)",
26
+ "type": "module",
27
+ "exports": {
28
+ ".": {
29
+ "types": "./lib/index.d.ts",
30
+ "default": "./lib/index.js"
31
+ },
32
+ "./get-exe.js": "./get-exe.js",
33
+ "./package.json": "./package.json"
34
+ },
35
+ "bin": {
36
+ "datamitsu": "bin/index.js",
37
+ "dm": "bin/index.js"
38
+ },
39
+ "files": [
40
+ "bin",
41
+ "lib",
42
+ "get-exe.js"
43
+ ],
44
+ "scripts": {
45
+ "test": "pnpm --filter @datamitsu/programmable-api-js test"
46
+ },
47
+ "dependencies": {
48
+ "tinyexec": "^1.0.4"
49
+ },
50
+ "devDependencies": {
51
+ "@shibanet0/datamitsu-config": "0.0.3-alpha-27"
52
+ },
53
+ "optionalDependencies": {
54
+ "@datamitsu/datamitsu-darwin-arm64": "0.0.0-unstable.20260412.633a430",
55
+ "@datamitsu/datamitsu-darwin-x64": "0.0.0-unstable.20260412.633a430",
56
+ "@datamitsu/datamitsu-freebsd-arm64": "0.0.0-unstable.20260412.633a430",
57
+ "@datamitsu/datamitsu-freebsd-x64": "0.0.0-unstable.20260412.633a430",
58
+ "@datamitsu/datamitsu-linux-arm64": "0.0.0-unstable.20260412.633a430",
59
+ "@datamitsu/datamitsu-linux-x64": "0.0.0-unstable.20260412.633a430",
60
+ "@datamitsu/datamitsu-win32-arm64": "0.0.0-unstable.20260412.633a430",
61
+ "@datamitsu/datamitsu-win32-x64": "0.0.0-unstable.20260412.633a430"
62
+ }
63
+ }