git-nav 0.0.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/README.md +8 -0
- package/bin/git-nav.js +54 -0
- package/package.json +36 -0
package/README.md
ADDED
package/bin/git-nav.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { spawn } from "node:child_process";
|
|
4
|
+
import { createRequire } from "node:module";
|
|
5
|
+
import { dirname, join } from "node:path";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
|
+
|
|
8
|
+
const require = createRequire(import.meta.url);
|
|
9
|
+
|
|
10
|
+
const binaryPaths = new Map([
|
|
11
|
+
["darwin-arm64", "Git Nav.app/Contents/MacOS/git-nav"],
|
|
12
|
+
["darwin-x64", "Git Nav.app/Contents/MacOS/git-nav"],
|
|
13
|
+
["linux-arm64", "git-nav"],
|
|
14
|
+
["linux-x64", "git-nav"],
|
|
15
|
+
["win32-arm64", "git-nav.exe"],
|
|
16
|
+
["win32-x64", "git-nav.exe"],
|
|
17
|
+
]);
|
|
18
|
+
|
|
19
|
+
const platformKey = `${process.platform}-${process.arch}`;
|
|
20
|
+
const binaryPath = binaryPaths.get(platformKey);
|
|
21
|
+
|
|
22
|
+
if (!binaryPath) {
|
|
23
|
+
console.error(`Unsupported platform: ${platformKey}`);
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const packageRoot = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
28
|
+
const { binaryScope } = require(join(packageRoot, "package.json"));
|
|
29
|
+
const platformPackage = `${binaryScope}/${platformKey}`;
|
|
30
|
+
|
|
31
|
+
let executable;
|
|
32
|
+
try {
|
|
33
|
+
executable = require.resolve(`${platformPackage}/${binaryPath}`);
|
|
34
|
+
} catch {
|
|
35
|
+
console.error(
|
|
36
|
+
`Missing executable for ${platformKey}. Install the optional dependency \"${platformPackage}\".`,
|
|
37
|
+
);
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const child = spawn(executable, process.argv.slice(2), { stdio: "inherit" });
|
|
42
|
+
|
|
43
|
+
child.on("error", (error) => {
|
|
44
|
+
console.error(error.message);
|
|
45
|
+
process.exit(1);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
child.on("exit", (code, signal) => {
|
|
49
|
+
if (signal) {
|
|
50
|
+
process.kill(process.pid, signal);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
process.exit(code ?? 1);
|
|
54
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "git-nav",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"bin": {
|
|
6
|
+
"git-nav": "./bin/git-nav.js"
|
|
7
|
+
},
|
|
8
|
+
"binaryScope": "@git-nav",
|
|
9
|
+
"files": [
|
|
10
|
+
"bin",
|
|
11
|
+
"README.md"
|
|
12
|
+
],
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=20"
|
|
18
|
+
},
|
|
19
|
+
"optionalDependencies": {
|
|
20
|
+
"@git-nav/darwin-arm64": "0.0.1",
|
|
21
|
+
"@git-nav/darwin-x64": "0.0.1",
|
|
22
|
+
"@git-nav/linux-arm64": "0.0.1",
|
|
23
|
+
"@git-nav/linux-x64": "0.0.1",
|
|
24
|
+
"@git-nav/win32-arm64": "0.0.1",
|
|
25
|
+
"@git-nav/win32-x64": "0.0.1"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build:package": "bun run --cwd ../../apps/desktop tauri build && bun scripts/package-platform.ts",
|
|
29
|
+
"format": "prettier --no-config --write \"**/*.{js,ts}\"",
|
|
30
|
+
"lint": "eslint bin",
|
|
31
|
+
"release": "bun scripts/publish.ts"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"eslint": "^10"
|
|
35
|
+
}
|
|
36
|
+
}
|