Nuxt/lib/builder/webpack/plugins/progress.js

18 lines
482 B
JavaScript
Raw Normal View History

2018-03-11 23:15:14 +00:00
const ProgressBar = require('node-progress-bars')
const webpack = require('webpack')
module.exports = function ProgressPlugin({ color, pcolor, title }) {
// https://github.com/bubkoo/ascii-progress
const bar = new ProgressBar({
schema: `${title}.${color} >.grey :filled.${pcolor}:blank.white :msg.grey`,
filled: '█',
blank: '█',
total: 100,
width: 25
})
return new webpack.ProgressPlugin((percent, msg) => {
bar.update(percent, { msg })
})
}