@jango-blockchained/hoox-cli 0.9.1 → 0.9.5
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 -2
- package/bin/hoox.js +47 -4
- package/dist/index.js +5439 -4749
- package/package.json +7 -4
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
> **Runtime requirement:** Bun ≥ 1.2. The bin shebang and bundle target are Bun-only; `npm install -g` will install the package but the CLI will not run under Node.js.
|
|
8
8
|
|
|
9
|
-
**v0.9.
|
|
9
|
+
**v0.9.3** — 28 top-level command groups, 800+ unit tests. Modern-minimal visual refresh, completion footer, did-you-mean suggestions, custom help, hop-level `perf fastpath` observability. **v0.9.0** had a banner version-lookup bug in global installs — fixed in 0.9.1.
|
|
10
10
|
|
|
11
11
|
## Features
|
|
12
12
|
|
|
@@ -44,9 +44,14 @@ bun add -g @jango-blockchained/hoox-cli
|
|
|
44
44
|
```bash
|
|
45
45
|
cd packages/cli
|
|
46
46
|
bun install
|
|
47
|
-
bun run build
|
|
47
|
+
bun run build # produces dist/index.js — required for `hoox` after global install
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
+
> `bin/hoox.js` resolves `dist/index.js` first and falls back to `src/index.ts`
|
|
51
|
+
> when `dist/` is missing, so contributors who skip the build step can still
|
|
52
|
+
> run the CLI via `bun bin/hoox.js …` or a `bun link`-based install. Production
|
|
53
|
+
> releases and the `prepublishOnly` script always build first.
|
|
54
|
+
|
|
50
55
|
## Quick Start
|
|
51
56
|
|
|
52
57
|
```bash
|
package/bin/hoox.js
CHANGED
|
@@ -2,10 +2,53 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Hoox CLI binary entry point.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Resolution order (first match wins):
|
|
6
|
+
* 1. `../dist/index.js` — bundled output from `bun run build`
|
|
7
|
+
* 2. `../src/index.ts` — dev mode (run from a fresh `bun install` without
|
|
8
|
+
* running the build first; Bun compiles TS on import)
|
|
9
|
+
* 3. Clear error message instructing the user to run `bun run build`
|
|
10
|
+
*
|
|
11
|
+
* The dev fallback lets contributors and CI jobs that haven't yet run
|
|
12
|
+
* `bun run build` still execute the CLI directly via `bun bin/hoox.js` or
|
|
13
|
+
* `hoox` after a `bun link`.
|
|
14
|
+
*
|
|
15
|
+
* `main` is exported from `src/index.ts` so we can call it explicitly —
|
|
16
|
+
* the `import.meta.main` guard inside that file would otherwise be false
|
|
17
|
+
* when the module is loaded as a side effect from here.
|
|
7
18
|
*/
|
|
8
19
|
|
|
9
|
-
import {
|
|
20
|
+
import { existsSync } from "node:fs";
|
|
21
|
+
import { fileURLToPath } from "node:url";
|
|
22
|
+
import { dirname, resolve } from "node:path";
|
|
23
|
+
|
|
24
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
25
|
+
const distEntry = resolve(here, "..", "dist", "index.js");
|
|
26
|
+
const srcEntry = resolve(here, "..", "src", "index.ts");
|
|
27
|
+
|
|
28
|
+
async function loadAndRun(entry) {
|
|
29
|
+
// Bun caches imports; the first import wins for the lifetime of the
|
|
30
|
+
// process. The dist build and the source file are the same module
|
|
31
|
+
// logically, so a second entry would be a no-op.
|
|
32
|
+
const mod = await import(entry);
|
|
33
|
+
if (typeof mod.main === "function") {
|
|
34
|
+
await mod.main();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
10
37
|
|
|
11
|
-
|
|
38
|
+
if (existsSync(distEntry)) {
|
|
39
|
+
// Production path — bundled and self-contained.
|
|
40
|
+
await loadAndRun(distEntry);
|
|
41
|
+
} else if (existsSync(srcEntry)) {
|
|
42
|
+
// Dev path — Bun transpiles on the fly. Useful for `bun link` and CI
|
|
43
|
+
// smoke tests that run before the build step.
|
|
44
|
+
await loadAndRun(srcEntry);
|
|
45
|
+
} else {
|
|
46
|
+
console.error(
|
|
47
|
+
`hoox: could not find an entry point. Looked for:\n` +
|
|
48
|
+
` - ${distEntry}\n` +
|
|
49
|
+
` - ${srcEntry}\n\n` +
|
|
50
|
+
`Run \`bun run build\` in packages/cli/ to produce the bundled dist/, ` +
|
|
51
|
+
`or install from source so src/index.ts is present.`
|
|
52
|
+
);
|
|
53
|
+
process.exit(1);
|
|
54
|
+
}
|