helixevo 0.2.1 → 0.2.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.
- package/dist/cli.js +46 -10
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -12306,28 +12306,31 @@ ${replay.slice(0, 800)}`
|
|
|
12306
12306
|
// src/commands/dashboard.ts
|
|
12307
12307
|
import { execSync as execSync2, spawn as spawn2 } from "node:child_process";
|
|
12308
12308
|
import { join as join14, dirname as dirname2 } from "node:path";
|
|
12309
|
-
import { existsSync as existsSync10 } from "node:fs";
|
|
12309
|
+
import { existsSync as existsSync10, cpSync as cpSync3, mkdirSync as mkdirSync4 } from "node:fs";
|
|
12310
12310
|
import { fileURLToPath } from "node:url";
|
|
12311
|
+
import { homedir as homedir3 } from "node:os";
|
|
12311
12312
|
var __filename = "/Users/tianchichen/Documents/GitHub/skillgraph/src/commands/dashboard.ts";
|
|
12313
|
+
var HELIX_DASHBOARD_DIR = join14(homedir3(), ".helix", "dashboard");
|
|
12312
12314
|
async function dashboardCommand() {
|
|
12313
|
-
const
|
|
12314
|
-
if (!
|
|
12315
|
+
const sourceDir = findDashboardSource();
|
|
12316
|
+
if (!sourceDir) {
|
|
12315
12317
|
console.error(` Dashboard not found.
|
|
12316
12318
|
`);
|
|
12317
|
-
console.error("
|
|
12318
|
-
console.error(" <npm-global>/helixevo/dashboard/");
|
|
12319
|
-
console.error("");
|
|
12320
|
-
console.error(" You can also clone and run it manually:");
|
|
12319
|
+
console.error(" You can install and run it manually:");
|
|
12321
12320
|
console.error(" git clone https://github.com/danielchen26/helixevo.git");
|
|
12322
12321
|
console.error(" cd helixevo/dashboard && npm install && npx next dev --port 3847");
|
|
12323
12322
|
process.exit(1);
|
|
12324
12323
|
}
|
|
12324
|
+
const dir = ensureWritableDashboard(sourceDir);
|
|
12325
12325
|
if (!existsSync10(join14(dir, "node_modules"))) {
|
|
12326
12326
|
console.log(" Installing dashboard dependencies...");
|
|
12327
12327
|
try {
|
|
12328
|
-
execSync2("npm ci --prefer-offline --no-audit --no-fund", { cwd: dir, stdio: "inherit" });
|
|
12329
|
-
} catch {
|
|
12330
12328
|
execSync2("npm install --no-audit --no-fund", { cwd: dir, stdio: "inherit" });
|
|
12329
|
+
} catch (err) {
|
|
12330
|
+
console.error(" Failed to install dashboard dependencies.");
|
|
12331
|
+
console.error(" Try running manually:");
|
|
12332
|
+
console.error(` cd ${dir} && npm install`);
|
|
12333
|
+
process.exit(1);
|
|
12331
12334
|
}
|
|
12332
12335
|
}
|
|
12333
12336
|
console.log(` \uD83C\uDF10 Starting Helix Dashboard at http://localhost:3847
|
|
@@ -12348,7 +12351,7 @@ async function dashboardCommand() {
|
|
|
12348
12351
|
process.exit(code ?? 0);
|
|
12349
12352
|
});
|
|
12350
12353
|
}
|
|
12351
|
-
function
|
|
12354
|
+
function findDashboardSource() {
|
|
12352
12355
|
const candidates = [];
|
|
12353
12356
|
try {
|
|
12354
12357
|
const thisFile = typeof __filename !== "undefined" ? __filename : fileURLToPath(import.meta.url);
|
|
@@ -12360,6 +12363,7 @@ function findDashboard() {
|
|
|
12360
12363
|
candidates.push(join14(globalPrefix, "lib", "node_modules", "helixevo", "dashboard"));
|
|
12361
12364
|
candidates.push(join14(globalPrefix, "node_modules", "helixevo", "dashboard"));
|
|
12362
12365
|
} catch {}
|
|
12366
|
+
candidates.push(HELIX_DASHBOARD_DIR);
|
|
12363
12367
|
const home = process.env.HOME ?? process.env.USERPROFILE ?? "";
|
|
12364
12368
|
candidates.push(join14(home, "Documents", "GitHub", "helixevo", "dashboard"));
|
|
12365
12369
|
candidates.push(join14(home, "Documents", "GitHub", "skillgraph", "dashboard"));
|
|
@@ -12371,6 +12375,38 @@ function findDashboard() {
|
|
|
12371
12375
|
}
|
|
12372
12376
|
return null;
|
|
12373
12377
|
}
|
|
12378
|
+
function ensureWritableDashboard(sourceDir) {
|
|
12379
|
+
try {
|
|
12380
|
+
const testFile = join14(sourceDir, ".write-test");
|
|
12381
|
+
__require("fs").writeFileSync(testFile, "");
|
|
12382
|
+
__require("fs").unlinkSync(testFile);
|
|
12383
|
+
return sourceDir;
|
|
12384
|
+
} catch {}
|
|
12385
|
+
const sourcePackage = join14(sourceDir, "package.json");
|
|
12386
|
+
const destPackage = join14(HELIX_DASHBOARD_DIR, "package.json");
|
|
12387
|
+
if (existsSync10(destPackage)) {
|
|
12388
|
+
const sourceMtime = __require("fs").statSync(sourcePackage).mtimeMs;
|
|
12389
|
+
const destMtime = __require("fs").statSync(destPackage).mtimeMs;
|
|
12390
|
+
if (sourceMtime <= destMtime) {
|
|
12391
|
+
return HELIX_DASHBOARD_DIR;
|
|
12392
|
+
}
|
|
12393
|
+
}
|
|
12394
|
+
console.log(" Setting up dashboard...");
|
|
12395
|
+
mkdirSync4(HELIX_DASHBOARD_DIR, { recursive: true });
|
|
12396
|
+
const items = __require("fs").readdirSync(sourceDir, { withFileTypes: true });
|
|
12397
|
+
for (const item of items) {
|
|
12398
|
+
if (item.name === "node_modules" || item.name === ".next")
|
|
12399
|
+
continue;
|
|
12400
|
+
const src = join14(sourceDir, item.name);
|
|
12401
|
+
const dest = join14(HELIX_DASHBOARD_DIR, item.name);
|
|
12402
|
+
cpSync3(src, dest, { recursive: true });
|
|
12403
|
+
}
|
|
12404
|
+
const oldModules = join14(HELIX_DASHBOARD_DIR, "node_modules");
|
|
12405
|
+
if (existsSync10(oldModules)) {
|
|
12406
|
+
__require("fs").rmSync(oldModules, { recursive: true });
|
|
12407
|
+
}
|
|
12408
|
+
return HELIX_DASHBOARD_DIR;
|
|
12409
|
+
}
|
|
12374
12410
|
|
|
12375
12411
|
// src/commands/watch.ts
|
|
12376
12412
|
import { join as join16 } from "node:path";
|
package/package.json
CHANGED