@brunoluizdesiqueira/bbuilder-cli 1.0.12 → 1.0.14
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/build/execute.js +1 -1
- package/dist/ui/output.js +32 -8
- package/package.json +1 -1
package/dist/build/execute.js
CHANGED
|
@@ -55,7 +55,7 @@ async function executeBuild(opts) {
|
|
|
55
55
|
await (0, output_1.withProgress)(3, totalStages, 'Sincronizando recurso final no projeto', () => {
|
|
56
56
|
fs.copyFileSync(resFile, path.win32.join(workspaceDir, `${projectName}.res`));
|
|
57
57
|
});
|
|
58
|
-
await (0, output_1.withProgress)(4, totalStages, `Compilando projeto Delphi (${opts.type})`, () => (0, compiler_1.runDcc64)(opts, projectName, workspaceDir));
|
|
58
|
+
await (0, output_1.withProgress)(4, totalStages, `Compilando projeto Delphi (${opts.type})`, () => (0, compiler_1.runDcc64)(opts, projectName, workspaceDir), { streamingOutput: true });
|
|
59
59
|
(0, output_1.printSuccess)(opts.type);
|
|
60
60
|
const { runAfter } = (0, compiler_1.buildCompilerFlags)(opts.type);
|
|
61
61
|
if (runAfter) {
|
package/dist/ui/output.js
CHANGED
|
@@ -142,30 +142,54 @@ function clearProgressLine() {
|
|
|
142
142
|
readline.clearLine(process.stdout, 0);
|
|
143
143
|
readline.cursorTo(process.stdout, 0);
|
|
144
144
|
}
|
|
145
|
-
async function withProgress(stage, total, label, task) {
|
|
145
|
+
async function withProgress(stage, total, label, task, options) {
|
|
146
146
|
const startTime = Date.now();
|
|
147
|
+
const streamingOutput = options?.streamingOutput ?? false;
|
|
147
148
|
if (!process.stdout.isTTY) {
|
|
148
149
|
step(`[${stage}/${total}] ${label}`);
|
|
149
150
|
const result = await task();
|
|
150
151
|
console.log(` ${chalk_1.default.green('OK')} ${chalk_1.default.white(label)} ${chalk_1.default.gray(`(${formatElapsed(startTime)})`)}`);
|
|
151
152
|
return result;
|
|
152
153
|
}
|
|
154
|
+
if (streamingOutput) {
|
|
155
|
+
step(`[${stage}/${total}] ${label}`);
|
|
156
|
+
try {
|
|
157
|
+
const result = await task();
|
|
158
|
+
console.log(` ${chalk_1.default.green('OK')} ${chalk_1.default.white(label)} ${chalk_1.default.gray(`(${formatElapsed(startTime)})`)}`);
|
|
159
|
+
return result;
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
console.log(` ${chalk_1.default.red('FAIL')} ${chalk_1.default.white(label)} ${chalk_1.default.gray(`(${formatElapsed(startTime)})`)}`);
|
|
163
|
+
throw error;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
153
166
|
let frameIndex = 0;
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
167
|
+
let rendered = false;
|
|
168
|
+
let timer;
|
|
169
|
+
const render = () => {
|
|
170
|
+
clearProgressLine();
|
|
157
171
|
drawProgressLine(renderProgressLine(stage, total, label, startTime, frameIndex));
|
|
172
|
+
rendered = true;
|
|
173
|
+
};
|
|
174
|
+
render();
|
|
175
|
+
timer = setInterval(() => {
|
|
176
|
+
frameIndex += 1;
|
|
177
|
+
render();
|
|
158
178
|
}, 120);
|
|
159
179
|
try {
|
|
160
180
|
const result = await task();
|
|
161
|
-
|
|
162
|
-
|
|
181
|
+
if (timer)
|
|
182
|
+
clearInterval(timer);
|
|
183
|
+
if (rendered)
|
|
184
|
+
clearProgressLine();
|
|
163
185
|
console.log(` ${chalk_1.default.green('OK')} ${chalk_1.default.white(label)} ${chalk_1.default.gray(`(${formatElapsed(startTime)})`)}`);
|
|
164
186
|
return result;
|
|
165
187
|
}
|
|
166
188
|
catch (error) {
|
|
167
|
-
|
|
168
|
-
|
|
189
|
+
if (timer)
|
|
190
|
+
clearInterval(timer);
|
|
191
|
+
if (rendered)
|
|
192
|
+
clearProgressLine();
|
|
169
193
|
console.log(` ${chalk_1.default.red('FAIL')} ${chalk_1.default.white(label)} ${chalk_1.default.gray(`(${formatElapsed(startTime)})`)}`);
|
|
170
194
|
throw error;
|
|
171
195
|
}
|