github-search-cli 0.9.0 → 9.1.0
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 +7 -1
- package/bin/ghfind.js +2 -12
- package/dist/chunk-TUMYR2IC.js +57 -0
- package/dist/cli.js +3761 -0
- package/dist/config-DFL44OVL.js +14 -0
- package/package.json +3 -1
- package/scripts/postinstall.js +2 -2
- package/vendor/bun.exe +0 -0
package/README.md
CHANGED
|
@@ -203,7 +203,13 @@ npm run build # build dist/
|
|
|
203
203
|
|
|
204
204
|
---
|
|
205
205
|
|
|
206
|
-
|
|
206
|
+
### v9.1.0
|
|
207
|
+
|
|
208
|
+
- Bundle `vendor/` and `dist/` in npm package for offline install support
|
|
209
|
+
- Remove dead Strategy 3 fallback in `bin/ghfind.js` (Node cannot import `.ts`)
|
|
210
|
+
- Fix postinstall to exit with code 1 on Bun download failure
|
|
211
|
+
- Update bundled Bun version from 1.3.12 to 1.3.14
|
|
212
|
+
|
|
207
213
|
|
|
208
214
|
### v0.8.2
|
|
209
215
|
|
package/bin/ghfind.js
CHANGED
|
@@ -10,9 +10,8 @@
|
|
|
10
10
|
import { existsSync } from "fs";
|
|
11
11
|
import { spawnSync } from "child_process";
|
|
12
12
|
import { join, dirname } from "path";
|
|
13
|
-
import { fileURLToPath } from "url";
|
|
13
|
+
import { fileURLToPath, pathToFileURL } from "url";
|
|
14
14
|
import { platform } from "os";
|
|
15
|
-
|
|
16
15
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
17
16
|
const PKG_DIR = join(__dirname, "..");
|
|
18
17
|
|
|
@@ -37,16 +36,7 @@ if (existsSync(BUN_BIN) && existsSync(srcCli)) {
|
|
|
37
36
|
// Strategy 2: Use bundled dist/cli.js with Node (non-interactive only on Node 23+)
|
|
38
37
|
if (existsSync(distCli)) {
|
|
39
38
|
try {
|
|
40
|
-
await import(distCli);
|
|
41
|
-
} catch (err) {
|
|
42
|
-
console.error("Failed to start ghfind. Node.js >= 20 or Bun required.");
|
|
43
|
-
console.error(err instanceof Error ? err.message : String(err));
|
|
44
|
-
process.exit(1);
|
|
45
|
-
}
|
|
46
|
-
} else {
|
|
47
|
-
// Strategy 3: Fallback to system Bun/Node running source
|
|
48
|
-
try {
|
|
49
|
-
await import("../src/cli.ts");
|
|
39
|
+
await import(pathToFileURL(distCli).href);
|
|
50
40
|
} catch (err) {
|
|
51
41
|
console.error("Failed to start ghfind. Node.js >= 20 or Bun required.");
|
|
52
42
|
console.error(err instanceof Error ? err.message : String(err));
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// src/config.ts
|
|
2
|
+
import { homedir } from "os";
|
|
3
|
+
import { join } from "path";
|
|
4
|
+
import { mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
5
|
+
function stateDir() {
|
|
6
|
+
const xdg = process.env.XDG_STATE_HOME;
|
|
7
|
+
const base = xdg ? join(xdg, "ghfind") : join(homedir(), ".local", "share", "ghfind");
|
|
8
|
+
return base;
|
|
9
|
+
}
|
|
10
|
+
function cacheDir() {
|
|
11
|
+
const xdg = process.env.XDG_CACHE_HOME;
|
|
12
|
+
const base = xdg ? join(xdg, "ghfind") : join(homedir(), ".cache", "ghfind");
|
|
13
|
+
return base;
|
|
14
|
+
}
|
|
15
|
+
var DEFAULTS = {
|
|
16
|
+
defaultSort: "best-match",
|
|
17
|
+
defaultLimit: 50,
|
|
18
|
+
theme: "premium-dark",
|
|
19
|
+
// New default: premium dark with sharp edges
|
|
20
|
+
cacheTtlSeconds: 300,
|
|
21
|
+
defaultTab: "search"
|
|
22
|
+
};
|
|
23
|
+
function configPath() {
|
|
24
|
+
const envPath = process.env.GHFIND_CONFIG;
|
|
25
|
+
if (envPath) return envPath;
|
|
26
|
+
const xdg = process.env.XDG_CONFIG_HOME;
|
|
27
|
+
const base = xdg ? join(xdg, "ghfind") : join(homedir(), ".config", "ghfind");
|
|
28
|
+
return join(base, "config.json");
|
|
29
|
+
}
|
|
30
|
+
function loadConfig() {
|
|
31
|
+
const path = configPath();
|
|
32
|
+
try {
|
|
33
|
+
const raw = readFileSync(path, "utf-8");
|
|
34
|
+
const parsed = JSON.parse(raw);
|
|
35
|
+
return mergeWithEnv({ ...DEFAULTS, ...parsed });
|
|
36
|
+
} catch {
|
|
37
|
+
return mergeWithEnv({ ...DEFAULTS });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function saveConfig(config) {
|
|
41
|
+
const path = configPath();
|
|
42
|
+
const dir = path.slice(0, Math.max(path.lastIndexOf("/"), path.lastIndexOf("\\")));
|
|
43
|
+
mkdirSync(dir, { recursive: true });
|
|
44
|
+
writeFileSync(path, JSON.stringify(config, null, 2));
|
|
45
|
+
}
|
|
46
|
+
function mergeWithEnv(config) {
|
|
47
|
+
if (process.env.GITHUB_TOKEN) config.githubToken = process.env.GITHUB_TOKEN;
|
|
48
|
+
return config;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export {
|
|
52
|
+
stateDir,
|
|
53
|
+
cacheDir,
|
|
54
|
+
configPath,
|
|
55
|
+
loadConfig,
|
|
56
|
+
saveConfig
|
|
57
|
+
};
|