Nuxt/lib/builder/webpack/plugins/progress.js
2018-03-12 03:12:34 +03:30

19 lines
499 B
JavaScript

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,
clear: true
})
return new webpack.ProgressPlugin((percent, msg) => {
bar.update(percent, { msg })
})
}