cskit-cli 1.0.30 → 1.0.31
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/package.json +1 -1
- package/src/commands/init.js +24 -31
package/package.json
CHANGED
package/src/commands/init.js
CHANGED
|
@@ -66,7 +66,7 @@ class Timeline {
|
|
|
66
66
|
this.steps = [];
|
|
67
67
|
this.currentStep = -1;
|
|
68
68
|
this.lastLineCount = 0;
|
|
69
|
-
this.
|
|
69
|
+
this.paused = false; // After prompt, stop full re-renders
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
addStep(name) {
|
|
@@ -101,38 +101,38 @@ class Timeline {
|
|
|
101
101
|
this.steps[stepIndex].children.push({ text, type });
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
// Call before any prompt -
|
|
104
|
+
// Call before any prompt - stops full re-renders
|
|
105
105
|
pause() {
|
|
106
|
-
this.
|
|
106
|
+
this.paused = true;
|
|
107
107
|
this.lastLineCount = 0;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
//
|
|
110
|
+
// Print separator after prompt
|
|
111
111
|
resume() {
|
|
112
112
|
console.log(chalk.dim('\n ─'.repeat(20) + '\n'));
|
|
113
|
-
this.renderFresh();
|
|
114
113
|
}
|
|
115
114
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
console.log('');
|
|
115
|
+
buildStatusLine(stepIndex) {
|
|
116
|
+
const step = this.steps[stepIndex];
|
|
117
|
+
const symbol = SYMBOLS[step.status];
|
|
118
|
+
const num = chalk.dim(`${stepIndex + 1}.`);
|
|
119
|
+
const name = step.status === 'active' ? chalk.cyan(step.name) : step.name;
|
|
120
|
+
const msg = step.message ? chalk.dim(` (${step.message})`) : '';
|
|
121
|
+
return ` ${symbol} ${num} ${name}${msg}`;
|
|
124
122
|
}
|
|
125
123
|
|
|
126
|
-
|
|
124
|
+
render() {
|
|
125
|
+
// After pause, only print current step status (no full timeline)
|
|
126
|
+
if (this.paused) {
|
|
127
|
+
console.log(this.buildStatusLine(this.currentStep));
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
|
|
127
131
|
const lines = [];
|
|
128
132
|
for (let i = 0; i < this.steps.length; i++) {
|
|
129
|
-
|
|
130
|
-
const symbol = SYMBOLS[step.status];
|
|
131
|
-
const num = chalk.dim(`${i + 1}.`);
|
|
132
|
-
const name = step.status === 'active' ? chalk.cyan(step.name) : step.name;
|
|
133
|
-
const msg = step.message ? chalk.dim(` (${step.message})`) : '';
|
|
134
|
-
lines.push(` ${symbol} ${num} ${name}${msg}`);
|
|
133
|
+
lines.push(this.buildStatusLine(i));
|
|
135
134
|
|
|
135
|
+
const step = this.steps[i];
|
|
136
136
|
// Children for non-pending steps
|
|
137
137
|
if (step.status !== 'pending') {
|
|
138
138
|
for (let j = 0; j < step.children.length; j++) {
|
|
@@ -149,31 +149,24 @@ class Timeline {
|
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
|
-
return lines;
|
|
153
|
-
}
|
|
154
152
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
// In-place update only if enabled and have previous output
|
|
159
|
-
if (this.inPlaceEnabled && this.lastLineCount > 0) {
|
|
153
|
+
// In-place update if have previous output
|
|
154
|
+
if (this.lastLineCount > 0) {
|
|
160
155
|
process.stdout.write(`\x1b[${this.lastLineCount}A`);
|
|
161
156
|
for (let i = 0; i < this.lastLineCount; i++) {
|
|
162
157
|
process.stdout.write('\x1b[2K\n');
|
|
163
158
|
}
|
|
164
159
|
process.stdout.write(`\x1b[${this.lastLineCount}A`);
|
|
165
|
-
} else
|
|
166
|
-
// First render
|
|
160
|
+
} else {
|
|
167
161
|
console.log('');
|
|
168
162
|
}
|
|
169
163
|
|
|
170
|
-
// If in-place disabled, just print below (no cursor movement)
|
|
171
164
|
for (const line of lines) {
|
|
172
165
|
console.log(line);
|
|
173
166
|
}
|
|
174
167
|
console.log('');
|
|
175
168
|
|
|
176
|
-
this.lastLineCount =
|
|
169
|
+
this.lastLineCount = lines.length + 1;
|
|
177
170
|
}
|
|
178
171
|
}
|
|
179
172
|
|