repomap-bin 2.3.1 → 2.4.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.
Files changed (5) hide show
  1. package/install.js +10 -0
  2. package/package.json +14 -24
  3. package/repomap +0 -0
  4. package/index.js +0 -47
  5. package/run.js +0 -61
package/install.js ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+ // Postinstall: ensure the binary is executable
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+ const bin = path.join(__dirname, 'repomap');
6
+ try {
7
+ fs.chmodSync(bin, 0o755);
8
+ } catch (e) {
9
+ // binary might not exist during dev; ignore
10
+ }
package/package.json CHANGED
@@ -1,34 +1,24 @@
1
1
  {
2
2
  "name": "repomap-bin",
3
- "version": "2.3.1",
4
- "description": "Standalone repomap binary \u2014 tree-sitter AST code intelligence CLI",
5
- "type": "module",
3
+ "version": "2.4.2",
4
+ "description": "Standalone repomap binary tree-sitter AST code intelligence CLI",
6
5
  "bin": {
7
- "repomap": "./run.js"
6
+ "repomap": "repomap"
8
7
  },
9
- "files": [
10
- "run.js",
11
- "index.js"
12
- ],
13
- "optionalDependencies": {
14
- "repomap-bin-linux-x64": "2.3.1",
15
- "repomap-bin-darwin-arm64": "2.3.1",
16
- "repomap-bin-windows-x64": "2.3.1"
17
- },
18
- "engines": {
19
- "node": ">=18"
8
+ "scripts": {
9
+ "postinstall": "node install.js"
20
10
  },
21
- "keywords": [
11
+ "files": [
22
12
  "repomap",
23
- "tree-sitter",
24
- "ast",
25
- "code-analysis",
26
- "cli"
13
+ "install.js"
27
14
  ],
15
+ "os": ["linux"],
16
+ "cpu": ["x64"],
17
+ "keywords": ["repomap", "tree-sitter", "ast", "code-analysis", "cli"],
18
+ "author": "gjczone",
19
+ "license": "MIT",
28
20
  "repository": {
29
21
  "type": "git",
30
- "url": "git+https://github.com/gjczone/repomap.git"
31
- },
32
- "homepage": "https://github.com/gjczone/repomap",
33
- "license": "MIT"
22
+ "url": "https://github.com/gjczone/repomap"
23
+ }
34
24
  }
package/repomap ADDED
Binary file
package/index.js DELETED
@@ -1,47 +0,0 @@
1
- import { existsSync } from "node:fs";
2
- import { createRequire } from "node:module";
3
- import { join, dirname } from "node:path";
4
- import { fileURLToPath } from "node:url";
5
-
6
- const __dirname = dirname(fileURLToPath(import.meta.url));
7
- const localRequire = createRequire(import.meta.url);
8
-
9
- function findBinary() {
10
- const platform = process.platform;
11
- const arch = process.arch;
12
- const binName = platform === "win32" ? "repomap.exe" : "repomap";
13
-
14
- // 1. Check repo dist/ directory (local development)
15
- const repoBin = join(__dirname, "..", "..", "dist", binName);
16
- if (existsSync(repoBin)) return repoBin;
17
-
18
- // 2. Resolve platform package via Node module resolution (handles hoisted, npx, yarn, pnpm)
19
- const platformPackages = {
20
- "linux-x64": { pkg: "repomap-bin-linux-x64", bin: "repomap" },
21
- "darwin-arm64": { pkg: "repomap-bin-darwin-arm64", bin: "repomap" },
22
- "win32-x64": { pkg: "repomap-bin-windows-x64", bin: "repomap.exe" },
23
- };
24
-
25
- const key = `${platform}-${arch}`;
26
- const info = platformPackages[key];
27
- if (info) {
28
- try {
29
- const pkgJson = localRequire.resolve(`${info.pkg}/package.json`);
30
- const candidate = join(dirname(pkgJson), info.bin);
31
- if (existsSync(candidate)) return candidate;
32
- } catch { /* not resolvable */ }
33
-
34
- // Non-hoisted: inside repomap-bin's own node_modules
35
- const nested = join(__dirname, "node_modules", info.pkg, info.bin);
36
- if (existsSync(nested)) return nested;
37
- }
38
-
39
- // 3. PATH fallback
40
- return binName;
41
- }
42
-
43
- export function getBinaryPath() {
44
- return findBinary();
45
- }
46
-
47
- export default { getBinaryPath };
package/run.js DELETED
@@ -1,61 +0,0 @@
1
- import { execFileSync } from "node:child_process";
2
- import { createRequire } from "node:module";
3
- import { existsSync } from "node:fs";
4
- import { join, dirname } from "node:path";
5
- import { fileURLToPath } from "node:url";
6
-
7
- const __dirname = dirname(fileURLToPath(import.meta.url));
8
- const localRequire = createRequire(import.meta.url);
9
-
10
- function findBinary() {
11
- const platform = process.platform;
12
- const arch = process.arch;
13
- const binName = platform === "win32" ? "repomap.exe" : "repomap";
14
-
15
- // 1. Check repo dist/ directory (local development)
16
- const repoBin = join(__dirname, "..", "..", "dist", binName);
17
- if (existsSync(repoBin)) return repoBin;
18
-
19
- // 2. Resolve platform package via Node module resolution (handles hoisted, npx, yarn, pnpm)
20
- const platformPackages = {
21
- "linux-x64": { pkg: "repomap-bin-linux-x64", bin: "repomap" },
22
- "darwin-arm64": { pkg: "repomap-bin-darwin-arm64", bin: "repomap" },
23
- "win32-x64": { pkg: "repomap-bin-windows-x64", bin: "repomap.exe" },
24
- };
25
-
26
- const key = `${platform}-${arch}`;
27
- const info = platformPackages[key];
28
- if (info) {
29
- try {
30
- const pkgJson = localRequire.resolve(`${info.pkg}/package.json`);
31
- const candidate = join(dirname(pkgJson), info.bin);
32
- if (existsSync(candidate)) return candidate;
33
- } catch { /* not resolvable */ }
34
-
35
- // Non-hoisted: inside repomap-bin's own node_modules
36
- const nested = join(__dirname, "node_modules", info.pkg, info.bin);
37
- if (existsSync(nested)) return nested;
38
- }
39
-
40
- // 3. PATH fallback
41
- return binName;
42
- }
43
-
44
- const binaryPath = findBinary();
45
-
46
- if (!binaryPath) {
47
- console.error(
48
- "repomap binary not found for this platform.\n" +
49
- "Try: npm install repomap-bin"
50
- );
51
- process.exit(1);
52
- }
53
-
54
- try {
55
- execFileSync(binaryPath, process.argv.slice(2), {
56
- stdio: "inherit",
57
- env: { ...process.env },
58
- });
59
- } catch (e) {
60
- process.exit(e.status ?? 1);
61
- }