simplify progress

This commit is contained in:
Pooya Parsa 2018-03-24 13:16:25 +04:30
parent 13bae199ab
commit 1204ea45d4

View File

@ -53,7 +53,7 @@ export default class ProgressPlugin extends webpack.ProgressPlugin {
const lines = []
_.sortBy(Object.keys(sharedState), s => s.name).forEach(name => {
_.sortBy(Object.keys(sharedState), s => s.name).reverse().forEach(name => {
const state = sharedState[name]
if (state.isRunning) {
@ -85,11 +85,10 @@ export default class ProgressPlugin extends webpack.ProgressPlugin {
_renderBar(progress, color) {
const w = progress * (BAR_LENGTH / 100)
const bg = chalk.white(BLOCK_CHAR)
// const fg = chalk.keyword(color)(BLOCK_CHAR)
const fg = chalk.keyword(color)(BLOCK_CHAR2)
const base = color === 'green' ? 120 : 50
const fg = i => chalk.hsl(i * 3 + base, 100, 50)(BLOCK_CHAR2)
return BAR_BEFORE + _.range(BAR_LENGTH).map(i => i < w ? fg(i) : bg).join('') + BAR_AFTER
return BAR_BEFORE +
_.range(BAR_LENGTH).map(i => i < w ? fg : bg).join('') +
BAR_AFTER
}
}