@wopr-network/defcon 1.0.0 → 1.0.1
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/src/execution/cli.js +17 -2
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createHash, timingSafeEqual } from "node:crypto";
|
|
3
|
-
import { writeFileSync } from "node:fs";
|
|
3
|
+
import { readdirSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { homedir } from "node:os";
|
|
5
5
|
import { join, resolve } from "node:path";
|
|
6
6
|
import { pathToFileURL } from "node:url";
|
|
@@ -55,7 +55,22 @@ export function validateWorkerToken(opts) {
|
|
|
55
55
|
"Set DEFCON_WORKER_TOKEN in your environment or use stdio transport for local-only access.");
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
|
|
58
|
+
// Resolve drizzle migrations folder. Works for both tsx (src/) and compiled (dist/src/) contexts.
|
|
59
|
+
const MIGRATIONS_FOLDER = (() => {
|
|
60
|
+
const candidates = ["../../drizzle", "../../../drizzle"].map((rel) => new URL(rel, import.meta.url).pathname);
|
|
61
|
+
const found = candidates.find((p) => {
|
|
62
|
+
try {
|
|
63
|
+
readdirSync(p);
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
if (!found)
|
|
71
|
+
throw new Error(`Cannot find drizzle migrations folder (tried: ${candidates.join(", ")})`);
|
|
72
|
+
return found;
|
|
73
|
+
})();
|
|
59
74
|
const REAPER_INTERVAL_DEFAULT = "30000"; // 30s
|
|
60
75
|
const CLAIM_TTL_DEFAULT = "300000"; // 5min
|
|
61
76
|
function openDb(dbPath) {
|