Skip to content

Commit

Permalink
feat: consola integration
Browse files Browse the repository at this point in the history
  • Loading branch information
Pooya Parsa committed Mar 31, 2018
1 parent 048e278 commit d99f254
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 13 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
},
"dependencies": {
"chalk": "^2.3.2",
"consola": "^0.1.0",
"figures": "^2.0.0",
"loader-utils": "^1.1.0",
"lodash": "^4.17.5",
Expand Down
17 changes: 5 additions & 12 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import chalk from 'chalk';
import _ from 'lodash';
import logUpdate from 'log-update';
import env from 'std-env';
import consola from 'consola';
import prettyTime from 'pretty-time';
import Profile from './profile';
import {
BULLET,
TICK,
parseRequst,
formatRequest,
renderBar,
Expand Down Expand Up @@ -88,25 +88,18 @@ export default class WebpackBarPlugin extends webpack.ProgressPlugin {
// Started
this.state.start = process.hrtime();
if (this.options.minimal) {
this.options.stream.write(`Compiling ${this.options.name}\n`);
consola.info(`Compiling ${this.options.name}`);
}
} else if (wasRunning && !isRunning) {
// Finished
const time = process.hrtime(this.state.start);
if (this.options.minimal) {
this.options.stream.write(
`Compiled ${this.options.name} in ${prettyTime(time)}\n`
);
consola.success(`Compiled ${this.options.name} in ${prettyTime(time)}`);
} else {
this.logUpdate.clear();
if (this.options.compiledIn) {
this.options.stream.write(
`${[
TICK,
this.options.name,
'compiled in',
prettyTime(time, 'ms'),
].join(' ')}\n`
consola.success(
`${this.options.name} compiled in ${prettyTime(time, 'ms')}`
);
}
}
Expand Down
43 changes: 42 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1605,6 +1605,10 @@ cli-spinners@^0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-0.1.2.tgz#bb764d88e185fb9e1e6a2a1f19772318f605e31c"

cli-spinners@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-1.1.0.tgz#f1847b168844d917a671eb9d147e3df497c90d06"

cli-table2@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/cli-table2/-/cli-table2-0.2.0.tgz#2d1ef7f218a0e786e214540562d4bd177fe32d97"
Expand Down Expand Up @@ -1673,7 +1677,7 @@ clone-stats@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/clone-stats/-/clone-stats-1.0.0.tgz#b3782dff8bb5474e18b9b6bf0fdfe782f8777680"

clone@^1.0.0:
clone@^1.0.0, clone@^1.0.2:
version "1.0.4"
resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e"

Expand Down Expand Up @@ -1793,6 +1797,14 @@ configstore@^3.0.0:
write-file-atomic "^2.0.0"
xdg-basedir "^3.0.0"

consola@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/consola/-/consola-0.1.0.tgz#6b627c18dee52e0f61f5222552a250345ba2dedd"
dependencies:
figures "^2.0.0"
ora "^2.0.0"
std-env "^1.1.0"

console-browserify@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/console-browserify/-/console-browserify-1.1.0.tgz#f0241c45730a9fc6323b206dbf38edc741d0bb10"
Expand Down Expand Up @@ -2200,6 +2212,12 @@ default-require-extensions@^1.0.0:
dependencies:
strip-bom "^2.0.0"

defaults@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/defaults/-/defaults-1.0.3.tgz#c656051e9817d9ff08ed881477f3fe4019f3ef7d"
dependencies:
clone "^1.0.2"

define-properties@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.2.tgz#83a73f2fea569898fb737193c8f873caf6d45c94"
Expand Down Expand Up @@ -5307,6 +5325,17 @@ ora@^0.2.3:
cli-spinners "^0.1.2"
object-assign "^4.0.1"

ora@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ora/-/ora-2.0.0.tgz#8ec3a37fa7bffb54a3a0c188a1f6798e7e1827cd"
dependencies:
chalk "^2.3.1"
cli-cursor "^2.1.0"
cli-spinners "^1.1.0"
log-symbols "^2.2.0"
strip-ansi "^4.0.0"
wcwidth "^1.0.1"

os-browserify@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/os-browserify/-/os-browserify-0.3.0.tgz#854373c7f5c2315914fc9bfc6bd8238fdda1ec27"
Expand Down Expand Up @@ -6554,6 +6583,12 @@ std-env@^1.0.0:
dependencies:
is-ci "^1.1.0"

std-env@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/std-env/-/std-env-1.1.0.tgz#f89ded0c3facd5b53cd3cda288779ed88d3b87ad"
dependencies:
is-ci "^1.1.0"

stealthy-require@^1.1.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/stealthy-require/-/stealthy-require-1.1.1.tgz#35b09875b4ff49f26a777e509b3090a3226bf24b"
Expand Down Expand Up @@ -7192,6 +7227,12 @@ watchpack@^1.5.0:
graceful-fs "^4.1.2"
neo-async "^2.5.0"

wcwidth@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/wcwidth/-/wcwidth-1.0.1.tgz#f0b0dcf915bc5ff1528afadb2c0e17b532da2fe8"
dependencies:
defaults "^1.0.3"

webidl-conversions@^4.0.1, webidl-conversions@^4.0.2:
version "4.0.2"
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad"
Expand Down

0 comments on commit d99f254

Please sign in to comment.