From c42ef4c0af86d4e20a24e0128d2843f0a1cf87a7 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Thu, 29 Mar 2018 01:21:31 +0430 Subject: [PATCH] misc: improve progressbar consistency (#3143) --- lib/builder/builder.js | 4 ++++ lib/builder/webpack/base.js | 4 +++- package.json | 3 ++- yarn.lock | 8 +++++--- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/builder/builder.js b/lib/builder/builder.js index c0a327b039..3f877ee6f8 100644 --- a/lib/builder/builder.js +++ b/lib/builder/builder.js @@ -14,6 +14,7 @@ import webpackHotMiddleware from 'webpack-hot-middleware' import Debug from 'debug' import Glob from 'glob' import upath from 'upath' +import logUpdate from 'log-update' import { r, wp, wChunk, createRoutes, parallel, sequence, relativeTo, waitFor, createSpinner } from '../common/utils' import Options from '../common/options' @@ -45,6 +46,9 @@ export default class Builder { // Shared spinner this.spinner = createSpinner({ minimal: this.options.minimalCLI }) this.spinner.enabled = !this.options.test + this.logUpdate = logUpdate.create(process.stdout, { + showCursor: true + }) // Helper to resolve build paths this.relativeToBuild = (...args) => diff --git a/lib/builder/webpack/base.js b/lib/builder/webpack/base.js index 06953fddb8..21940fd181 100644 --- a/lib/builder/webpack/base.js +++ b/lib/builder/webpack/base.js @@ -19,6 +19,7 @@ export default class WebpackBaseConfig { this.isStatic = builder.isStatic this.options = builder.options this.spinner = builder.spinner + this.logUpdate = builder.logUpdate } getBabelOptions() { @@ -205,7 +206,8 @@ export default class WebpackBaseConfig { plugins.push(new WebpackBar({ profile: this.options.build.profile, name: this.isServer ? 'server' : 'client', - color: this.isServer ? 'orange' : 'green' + color: this.isServer ? 'orange' : 'green', + logUpdate: this.logUpdate })) } diff --git a/package.json b/package.json index 18af6256bf..d67f115235 100644 --- a/package.json +++ b/package.json @@ -95,6 +95,7 @@ "is-ci": "^1.1.0", "launch-editor-middleware": "^2.2.1", "lodash": "^4.17.5", + "log-update": "^2.3.0", "lru-cache": "^4.1.2", "memory-fs": "^0.4.1", "mini-css-extract-plugin": "^0.3.0", @@ -129,7 +130,7 @@ "webpack-dev-middleware": "^3.1.0", "webpack-hot-middleware": "^2.21.2", "webpack-node-externals": "^1.6.0", - "webpackbar": "^1.1.4" + "webpackbar": "^1.5.1" }, "devDependencies": { "babel-eslint": "^8.2.1", diff --git a/yarn.lock b/yarn.lock index 914e9b8bb4..55c2926f23 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7549,16 +7549,18 @@ webpack@^4.3.0: watchpack "^1.5.0" webpack-sources "^1.0.1" -webpackbar@^1.1.4: - version "1.3.0" - resolved "https://registry.yarnpkg.com/webpackbar/-/webpackbar-1.3.0.tgz#cdcd6b60709ccd3167732261c2ae09529354539a" +webpackbar@^1.5.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/webpackbar/-/webpackbar-1.5.1.tgz#05fd64a168ac6cbef763ab074ababeaf9edb72fc" dependencies: chalk "^2.3.2" figures "^2.0.0" is-ci "^1.1.0" + loader-utils "^1.1.0" lodash "^4.17.5" log-update "^2.3.0" pretty-time "^1.0.0" + schema-utils "^0.4.5" table "^4.0.3" whatwg-encoding@^1.0.1, whatwg-encoding@^1.0.3: