@obsfx/trekker-dashboard 1.7.0 → 1.9.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 CHANGED
@@ -8,7 +8,7 @@ A kanban board dashboard for [Trekker](https://github.com/obsfx/trekker) issue t
8
8
  bun install -g @obsfx/trekker-dashboard
9
9
  ```
10
10
 
11
- Or with npm:
11
+ Or with npm (still requires Bun runtime to run):
12
12
 
13
13
  ```bash
14
14
  npm install -g @obsfx/trekker-dashboard
@@ -32,8 +32,26 @@ trekker-dashboard --help # Show help
32
32
 
33
33
  ## Requirements
34
34
 
35
+ - **Bun runtime** (required) - The dashboard uses Bun's native SQLite driver
35
36
  - A project initialized with Trekker (`trekker init`)
36
- - Bun runtime (for best performance) or Node.js 18+
37
+
38
+ ### Installing Bun
39
+
40
+ ```bash
41
+ # macOS/Linux
42
+ curl -fsSL https://bun.sh/install | bash
43
+
44
+ # Homebrew
45
+ brew install oven-sh/bun/bun
46
+
47
+ # Windows (scoop)
48
+ scoop install bun
49
+
50
+ # npm (any platform)
51
+ npm install -g bun
52
+ ```
53
+
54
+ See [bun.sh/docs/installation](https://bun.sh/docs/installation) for more options.
37
55
 
38
56
  ## Features
39
57
 
@@ -1,57 +1,98 @@
1
- #!/usr/bin/env bun
1
+ #!/usr/bin/env node
2
2
  import { Command } from "commander";
3
3
  import { resolve, dirname } from "path";
4
4
  import { existsSync, readFileSync } from "fs";
5
5
  import { fileURLToPath } from "url";
6
+ import { execSync, spawn } from "child_process";
6
7
 
7
8
  const __filename = fileURLToPath(import.meta.url);
8
9
  const __dirname = dirname(__filename);
9
10
 
10
- const pkg = JSON.parse(readFileSync(resolve(__dirname, "..", "package.json"), "utf-8"));
11
-
12
- const program = new Command();
13
-
14
- program
15
- .name("trekker-dashboard")
16
- .description("Kanban board dashboard for Trekker issue tracker")
17
- .version(pkg.version)
18
- .option("-p, --port <port>", "Port to run on", "3000")
19
- .action(async (options) => {
20
- const cwd = process.cwd();
21
- const trekkerDir = resolve(cwd, ".trekker");
22
- const dbPath = resolve(trekkerDir, "trekker.db");
23
-
24
- // Check if .trekker directory exists
25
- if (!existsSync(trekkerDir)) {
26
- console.error("Error: No .trekker directory found in current directory.");
27
- console.error("Run 'trekker init' first to initialize the issue tracker.");
28
- process.exit(1);
29
- }
30
-
31
- // Check if database exists
32
- if (!existsSync(dbPath)) {
33
- console.error("Error: No trekker.db found in .trekker directory.");
34
- console.error("Run 'trekker init' first to initialize the issue tracker.");
35
- process.exit(1);
36
- }
37
-
38
- // Set environment variables
39
- process.env.TREKKER_DB_PATH = dbPath;
40
- process.env.PORT = options.port;
41
-
42
- console.log(`Starting Trekker Dashboard on http://localhost:${options.port}`);
43
- console.log(`Using database: ${dbPath}`);
44
- console.log("Press Ctrl+C to stop\n");
45
-
46
- // Import and start the server
47
- const serverPath = resolve(__dirname, "..", "dist", "server", "index.js");
48
- if (!existsSync(serverPath)) {
49
- console.error("Error: Server bundle not found at", serverPath);
50
- console.error("The package may not have been built correctly.");
51
- process.exit(1);
52
- }
53
-
54
- await import(serverPath);
11
+ // Check if bun is installed
12
+ function checkBunInstalled() {
13
+ try {
14
+ execSync("bun --version", { stdio: "ignore" });
15
+ return true;
16
+ } catch {
17
+ return false;
18
+ }
19
+ }
20
+
21
+ // Show installation instructions and exit
22
+ function showBunInstallGuide() {
23
+ console.error("Error: Bun runtime is required but not installed.\n");
24
+ console.error("Trekker Dashboard requires Bun for its SQLite driver.\n");
25
+ console.error("Install Bun:");
26
+ console.error(" curl -fsSL https://bun.sh/install | bash\n");
27
+ console.error("Or via package managers:");
28
+ console.error(" brew install oven-sh/bun/bun # macOS/Linux");
29
+ console.error(" scoop install bun # Windows");
30
+ console.error(" npm install -g bun # npm\n");
31
+ console.error("Learn more: https://bun.sh/docs/installation");
32
+ process.exit(1);
33
+ }
34
+
35
+ // If not running under bun, check and re-execute with bun
36
+ if (typeof Bun === "undefined") {
37
+ if (!checkBunInstalled()) {
38
+ showBunInstallGuide();
39
+ }
40
+ // Re-execute this script with bun
41
+ const child = spawn("bun", [__filename, ...process.argv.slice(2)], {
42
+ stdio: "inherit",
43
+ });
44
+ child.on("close", (code) => process.exit(code ?? 0));
45
+ child.on("error", () => {
46
+ showBunInstallGuide();
55
47
  });
48
+ } else {
49
+ // Running under bun, proceed with the CLI
50
+ const pkg = JSON.parse(readFileSync(resolve(__dirname, "..", "package.json"), "utf-8"));
51
+
52
+ const program = new Command();
53
+
54
+ program
55
+ .name("trekker-dashboard")
56
+ .description("Kanban board dashboard for Trekker issue tracker")
57
+ .version(pkg.version)
58
+ .option("-p, --port <port>", "Port to run on", "3000")
59
+ .action(async (options) => {
60
+ const cwd = process.cwd();
61
+ const trekkerDir = resolve(cwd, ".trekker");
62
+ const dbPath = resolve(trekkerDir, "trekker.db");
63
+
64
+ // Check if .trekker directory exists
65
+ if (!existsSync(trekkerDir)) {
66
+ console.error("Error: No .trekker directory found in current directory.");
67
+ console.error("Run 'trekker init' first to initialize the issue tracker.");
68
+ process.exit(1);
69
+ }
70
+
71
+ // Check if database exists
72
+ if (!existsSync(dbPath)) {
73
+ console.error("Error: No trekker.db found in .trekker directory.");
74
+ console.error("Run 'trekker init' first to initialize the issue tracker.");
75
+ process.exit(1);
76
+ }
77
+
78
+ // Set environment variables
79
+ process.env.TREKKER_DB_PATH = dbPath;
80
+ process.env.PORT = options.port;
81
+
82
+ console.log(`Starting Trekker Dashboard on http://localhost:${options.port}`);
83
+ console.log(`Using database: ${dbPath}`);
84
+ console.log("Press Ctrl+C to stop\n");
85
+
86
+ // Import and start the server
87
+ const serverPath = resolve(__dirname, "..", "dist", "server", "index.js");
88
+ if (!existsSync(serverPath)) {
89
+ console.error("Error: Server bundle not found at", serverPath);
90
+ console.error("The package may not have been built correctly.");
91
+ process.exit(1);
92
+ }
93
+
94
+ await import(serverPath);
95
+ });
56
96
 
57
- program.parse();
97
+ program.parse();
98
+ }