@threadbase-sh/scanner 0.14.4 → 0.14.6
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 +12 -2
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +11 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3048,8 +3048,18 @@ var IndexQueue = class {
|
|
|
3048
3048
|
// src/scanner.ts
|
|
3049
3049
|
var BATCH_SIZE2 = 12;
|
|
3050
3050
|
var DEFAULT_CONFIG_PATH = "~/.config/threadbase-scanner";
|
|
3051
|
+
function isTestProcess() {
|
|
3052
|
+
return Boolean(process.env.VITEST) || Boolean(process.env.JEST_WORKER_ID) || process.env.NODE_ENV === "test";
|
|
3053
|
+
}
|
|
3051
3054
|
function defaultDbPath() {
|
|
3052
|
-
|
|
3055
|
+
const override = process.env.TB_SCANNER_DB;
|
|
3056
|
+
if (override) return override;
|
|
3057
|
+
if (isTestProcess()) {
|
|
3058
|
+
throw new Error(
|
|
3059
|
+
"TB_SCANNER_DB must be set under a test runner. Refusing to open the default index at ~/.config/threadbase-scanner/index.db, because test fixtures written there are indistinguishable from real conversations and corrupt every measurement of the index. Point it at a temp directory in your test setup, or pass persistent.dbPath explicitly."
|
|
3060
|
+
);
|
|
3061
|
+
}
|
|
3062
|
+
return join5(homedir2(), ".config", "threadbase-scanner", "index.db");
|
|
3053
3063
|
}
|
|
3054
3064
|
function capForMemory(doc, max) {
|
|
3055
3065
|
const combined = combineSearchContent(doc);
|