misc: improve progressbar consistency (#3143)

This commit is contained in:
Pooya Parsa 2018-03-29 01:21:31 +04:30
parent ec5bdd98e3
commit c42ef4c0af
4 changed files with 14 additions and 5 deletions

View File

@ -14,6 +14,7 @@ import webpackHotMiddleware from 'webpack-hot-middleware'
import Debug from 'debug' import Debug from 'debug'
import Glob from 'glob' import Glob from 'glob'
import upath from 'upath' import upath from 'upath'
import logUpdate from 'log-update'
import { r, wp, wChunk, createRoutes, parallel, sequence, relativeTo, waitFor, createSpinner } from '../common/utils' import { r, wp, wChunk, createRoutes, parallel, sequence, relativeTo, waitFor, createSpinner } from '../common/utils'
import Options from '../common/options' import Options from '../common/options'
@ -45,6 +46,9 @@ export default class Builder {
// Shared spinner // Shared spinner
this.spinner = createSpinner({ minimal: this.options.minimalCLI }) this.spinner = createSpinner({ minimal: this.options.minimalCLI })
this.spinner.enabled = !this.options.test this.spinner.enabled = !this.options.test
this.logUpdate = logUpdate.create(process.stdout, {
showCursor: true
})
// Helper to resolve build paths // Helper to resolve build paths
this.relativeToBuild = (...args) => this.relativeToBuild = (...args) =>

View File

@ -19,6 +19,7 @@ export default class WebpackBaseConfig {
this.isStatic = builder.isStatic this.isStatic = builder.isStatic
this.options = builder.options this.options = builder.options
this.spinner = builder.spinner this.spinner = builder.spinner
this.logUpdate = builder.logUpdate
} }
getBabelOptions() { getBabelOptions() {
@ -205,7 +206,8 @@ export default class WebpackBaseConfig {
plugins.push(new WebpackBar({ plugins.push(new WebpackBar({
profile: this.options.build.profile, profile: this.options.build.profile,
name: this.isServer ? 'server' : 'client', name: this.isServer ? 'server' : 'client',
color: this.isServer ? 'orange' : 'green' color: this.isServer ? 'orange' : 'green',
logUpdate: this.logUpdate
})) }))
} }

View File

@ -95,6 +95,7 @@
"is-ci": "^1.1.0", "is-ci": "^1.1.0",
"launch-editor-middleware": "^2.2.1", "launch-editor-middleware": "^2.2.1",
"lodash": "^4.17.5", "lodash": "^4.17.5",
"log-update": "^2.3.0",
"lru-cache": "^4.1.2", "lru-cache": "^4.1.2",
"memory-fs": "^0.4.1", "memory-fs": "^0.4.1",
"mini-css-extract-plugin": "^0.3.0", "mini-css-extract-plugin": "^0.3.0",
@ -129,7 +130,7 @@
"webpack-dev-middleware": "^3.1.0", "webpack-dev-middleware": "^3.1.0",
"webpack-hot-middleware": "^2.21.2", "webpack-hot-middleware": "^2.21.2",
"webpack-node-externals": "^1.6.0", "webpack-node-externals": "^1.6.0",
"webpackbar": "^1.1.4" "webpackbar": "^1.5.1"
}, },
"devDependencies": { "devDependencies": {
"babel-eslint": "^8.2.1", "babel-eslint": "^8.2.1",

View File

@ -7549,16 +7549,18 @@ webpack@^4.3.0:
watchpack "^1.5.0" watchpack "^1.5.0"
webpack-sources "^1.0.1" webpack-sources "^1.0.1"
webpackbar@^1.1.4: webpackbar@^1.5.1:
version "1.3.0" version "1.5.1"
resolved "https://registry.yarnpkg.com/webpackbar/-/webpackbar-1.3.0.tgz#cdcd6b60709ccd3167732261c2ae09529354539a" resolved "https://registry.yarnpkg.com/webpackbar/-/webpackbar-1.5.1.tgz#05fd64a168ac6cbef763ab074ababeaf9edb72fc"
dependencies: dependencies:
chalk "^2.3.2" chalk "^2.3.2"
figures "^2.0.0" figures "^2.0.0"
is-ci "^1.1.0" is-ci "^1.1.0"
loader-utils "^1.1.0"
lodash "^4.17.5" lodash "^4.17.5"
log-update "^2.3.0" log-update "^2.3.0"
pretty-time "^1.0.0" pretty-time "^1.0.0"
schema-utils "^0.4.5"
table "^4.0.3" table "^4.0.3"
whatwg-encoding@^1.0.1, whatwg-encoding@^1.0.3: whatwg-encoding@^1.0.1, whatwg-encoding@^1.0.3: