Skip to content

Commit

Permalink
#116 cleaner log
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Jan 15, 2023
1 parent 12629ba commit 54e2ea6
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/mvnw.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ module.exports = function(args, tgt) {
start();
result.on('close', (code) => {
if (code !== 0) {
throw new Error('The command "' + cmd + '" exited with #' + code + ' code');
throw new Error(`The command "${cmd}" exited with #${code} code`);
}
stop();
resolve(args);
});
} else {
result.on('close', (code) => {
if (code !== 0) {
throw new Error('The command "' + cmd + '" exited with #' + code + ' code');
throw new Error(`The command "${cmd}" exited with #${code} code`);
}
resolve(args);
});
Expand All @@ -104,7 +104,7 @@ function start() {
const check = function() {
if (running) {
print();
setTimeout(check, 200);
setTimeout(check, 1000);
}
};
check();
Expand Down Expand Up @@ -144,8 +144,16 @@ function print() {
}
return curr;
}
let elapsed;
if (duration < 1000) {
elapsed = `${duration}ms`;
} else if (duration < 60 * 1000) {
elapsed = `${Math.ceil(duration / 1000)}s`;
} else {
elapsed = `${Math.ceil(duration / 3600000)}min`;
}
process.stdout.write(
`\x1b[33m[${phase}] ${duration} ms. Total number of compiled files ${count(target, 0)}\x1b[0m`
`\x1b[33m[${phase}] ${elapsed}; ${count(target, 0)} files generated...\x1b[0m`
);
}

0 comments on commit 54e2ea6

Please sign in to comment.