pnpm-dash 0.1.1 → 0.1.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 +1 -1
- package/dist/constants.js +1 -0
- package/dist/ringbuf.js +34 -0
- package/dist/runner.js +3 -1
- package/dist/ui/dashboard.js +1 -1
- package/dist/ui/logview.js +3 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -4,7 +4,7 @@ export function parseCLI() {
|
|
|
4
4
|
program
|
|
5
5
|
.name('pnpm-dash')
|
|
6
6
|
.description('A TUI dashboard for pnpm workspaces - run scripts across packages with a split-pane interface')
|
|
7
|
-
.version('0.1.
|
|
7
|
+
.version('0.1.2')
|
|
8
8
|
.argument('<script>', 'Script name to run across workspace packages (e.g., dev, start)')
|
|
9
9
|
.option('-F, --filter <pattern...>', 'Filter packages by name pattern, supports * for wildcard and ! for exclusions')
|
|
10
10
|
.parse();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const MAX_LOG_LINES = 10000;
|
package/dist/ringbuf.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export class RingBuffer {
|
|
2
|
+
buffer;
|
|
3
|
+
head = 0;
|
|
4
|
+
size = 0;
|
|
5
|
+
cap;
|
|
6
|
+
constructor(capacity) {
|
|
7
|
+
this.cap = capacity;
|
|
8
|
+
this.buffer = new Array(capacity);
|
|
9
|
+
}
|
|
10
|
+
push(item) {
|
|
11
|
+
const index = (this.head + this.size) % this.cap;
|
|
12
|
+
if (this.size < this.cap) {
|
|
13
|
+
this.size++;
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
this.head = (this.head + 1) % this.cap;
|
|
17
|
+
}
|
|
18
|
+
this.buffer[index] = item;
|
|
19
|
+
}
|
|
20
|
+
clear() {
|
|
21
|
+
this.head = 0;
|
|
22
|
+
this.size = 0;
|
|
23
|
+
}
|
|
24
|
+
toArray() {
|
|
25
|
+
const result = new Array(this.size);
|
|
26
|
+
for (let i = 0; i < this.size; i++) {
|
|
27
|
+
result[i] = this.buffer[(this.head + i) % this.cap];
|
|
28
|
+
}
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
get length() {
|
|
32
|
+
return this.size;
|
|
33
|
+
}
|
|
34
|
+
}
|
package/dist/runner.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { execa } from 'execa';
|
|
2
2
|
import { EventEmitter } from 'node:events';
|
|
3
|
+
import { RingBuffer } from './ringbuf.js';
|
|
4
|
+
import { MAX_LOG_LINES } from './constants.js';
|
|
3
5
|
export class Runner extends EventEmitter {
|
|
4
6
|
states = new Map();
|
|
5
7
|
scriptName;
|
|
@@ -29,7 +31,7 @@ export class Runner extends EventEmitter {
|
|
|
29
31
|
package: pkg,
|
|
30
32
|
status: 'running',
|
|
31
33
|
subprocess: null,
|
|
32
|
-
logs:
|
|
34
|
+
logs: new RingBuffer(MAX_LOG_LINES),
|
|
33
35
|
};
|
|
34
36
|
this.states.set(pkg.name, state);
|
|
35
37
|
}
|
package/dist/ui/dashboard.js
CHANGED
package/dist/ui/logview.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import blessed from 'reblessed';
|
|
2
|
+
import { MAX_LOG_LINES } from '../constants.js';
|
|
2
3
|
export function createLogView(screen, autoScroll) {
|
|
3
4
|
const logView = blessed.log({
|
|
4
5
|
parent: screen,
|
|
@@ -22,6 +23,7 @@ export function createLogView(screen, autoScroll) {
|
|
|
22
23
|
scrollbar: {
|
|
23
24
|
ch: '│',
|
|
24
25
|
},
|
|
26
|
+
scrollback: MAX_LOG_LINES,
|
|
25
27
|
scrollOnInput: autoScroll,
|
|
26
28
|
});
|
|
27
29
|
return logView;
|
|
@@ -34,7 +36,7 @@ export function updateLogView(logView, state) {
|
|
|
34
36
|
return;
|
|
35
37
|
}
|
|
36
38
|
logView.setLabel(` Logs - ${state.package.name} `);
|
|
37
|
-
logView.setContent(state.logs.join('\n'));
|
|
39
|
+
logView.setContent(state.logs.toArray().join('\n'));
|
|
38
40
|
logView.setScroll(0);
|
|
39
41
|
}
|
|
40
42
|
export function appendLog(logView, currentPackage, packageName, line) {
|