grepmax 0.2.4 → 0.2.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.
|
@@ -42,9 +42,15 @@ function createProgressTracker() {
|
|
|
42
42
|
*/
|
|
43
43
|
function createIndexingSpinner(root, label = "Indexing files...", options = {}) {
|
|
44
44
|
const { verbose = false } = options;
|
|
45
|
-
const
|
|
45
|
+
const isTTY = process.stderr.isTTY;
|
|
46
|
+
const spinner = (0, ora_1.default)({ text: label, isSilent: !isTTY }).start();
|
|
46
47
|
const tracker = createProgressTracker();
|
|
47
48
|
const seenFiles = new Set();
|
|
49
|
+
// Non-TTY: emit periodic log lines instead of spinner updates
|
|
50
|
+
let lastLogTime = Date.now();
|
|
51
|
+
let lastLogCount = 0;
|
|
52
|
+
const LOG_INTERVAL_MS = 10000;
|
|
53
|
+
const LOG_INTERVAL_FILES = 100;
|
|
48
54
|
return {
|
|
49
55
|
spinner,
|
|
50
56
|
onProgress(info) {
|
|
@@ -56,6 +62,9 @@ function createIndexingSpinner(root, label = "Indexing files...", options = {})
|
|
|
56
62
|
info.filePath.startsWith("Processing") ||
|
|
57
63
|
info.filePath.startsWith("Checking for changes"))) {
|
|
58
64
|
spinner.text = info.filePath;
|
|
65
|
+
if (!isTTY) {
|
|
66
|
+
process.stderr.write(`[index] ${info.filePath}\n`);
|
|
67
|
+
}
|
|
59
68
|
if (process.env.GMAX_DEBUG_INDEX === "1") {
|
|
60
69
|
console.log(`[progress] ${info.filePath}`);
|
|
61
70
|
}
|
|
@@ -80,6 +89,17 @@ function createIndexingSpinner(root, label = "Indexing files...", options = {})
|
|
|
80
89
|
? `(${info.processed}/${info.total})`
|
|
81
90
|
: `(${info.processed} files)`;
|
|
82
91
|
spinner.text = `Indexing files ${progressSuffix}${fileSuffix}`;
|
|
92
|
+
// Non-TTY: periodic log lines
|
|
93
|
+
if (!isTTY) {
|
|
94
|
+
const now = Date.now();
|
|
95
|
+
const filesDelta = info.processed - lastLogCount;
|
|
96
|
+
if (filesDelta >= LOG_INTERVAL_FILES ||
|
|
97
|
+
now - lastLogTime >= LOG_INTERVAL_MS) {
|
|
98
|
+
process.stderr.write(`[index] ${info.processed} files (${info.indexed} indexed) ${rel}\n`);
|
|
99
|
+
lastLogTime = now;
|
|
100
|
+
lastLogCount = info.processed;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
83
103
|
},
|
|
84
104
|
};
|
|
85
105
|
}
|
package/package.json
CHANGED