Skip to content

Commit d99f254

Browse files
author
Pooya Parsa
committed
feat: consola integration
1 parent 048e278 commit d99f254

File tree

3 files changed

+48
-13
lines changed

3 files changed

+48
-13
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
},
4444
"dependencies": {
4545
"chalk": "^2.3.2",
46+
"consola": "^0.1.0",
4647
"figures": "^2.0.0",
4748
"loader-utils": "^1.1.0",
4849
"lodash": "^4.17.5",

src/index.js

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import chalk from 'chalk';
33
import _ from 'lodash';
44
import logUpdate from 'log-update';
55
import env from 'std-env';
6+
import consola from 'consola';
67
import prettyTime from 'pretty-time';
78
import Profile from './profile';
89
import {
910
BULLET,
10-
TICK,
1111
parseRequst,
1212
formatRequest,
1313
renderBar,
@@ -88,25 +88,18 @@ export default class WebpackBarPlugin extends webpack.ProgressPlugin {
8888
// Started
8989
this.state.start = process.hrtime();
9090
if (this.options.minimal) {
91-
this.options.stream.write(`Compiling ${this.options.name}\n`);
91+
consola.info(`Compiling ${this.options.name}`);
9292
}
9393
} else if (wasRunning && !isRunning) {
9494
// Finished
9595
const time = process.hrtime(this.state.start);
9696
if (this.options.minimal) {
97-
this.options.stream.write(
98-
`Compiled ${this.options.name} in ${prettyTime(time)}\n`
99-
);
97+
consola.success(`Compiled ${this.options.name} in ${prettyTime(time)}`);
10098
} else {
10199
this.logUpdate.clear();
102100
if (this.options.compiledIn) {
103-
this.options.stream.write(
104-
`${[
105-
TICK,
106-
this.options.name,
107-
'compiled in',
108-
prettyTime(time, 'ms'),
109-
].join(' ')}\n`
101+
consola.success(
102+
`${this.options.name} compiled in ${prettyTime(time, 'ms')}`
110103
);
111104
}
112105
}

yarn.lock

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1605,6 +1605,10 @@ cli-spinners@^0.1.2:
16051605
version "0.1.2"
16061606
resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-0.1.2.tgz#bb764d88e185fb9e1e6a2a1f19772318f605e31c"
16071607

1608+
cli-spinners@^1.1.0:
1609+
version "1.1.0"
1610+
resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-1.1.0.tgz#f1847b168844d917a671eb9d147e3df497c90d06"
1611+
16081612
cli-table2@^0.2.0:
16091613
version "0.2.0"
16101614
resolved "https://registry.yarnpkg.com/cli-table2/-/cli-table2-0.2.0.tgz#2d1ef7f218a0e786e214540562d4bd177fe32d97"
@@ -1673,7 +1677,7 @@ clone-stats@^1.0.0:
16731677
version "1.0.0"
16741678
resolved "https://registry.yarnpkg.com/clone-stats/-/clone-stats-1.0.0.tgz#b3782dff8bb5474e18b9b6bf0fdfe782f8777680"
16751679

1676-
clone@^1.0.0:
1680+
clone@^1.0.0, clone@^1.0.2:
16771681
version "1.0.4"
16781682
resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e"
16791683

@@ -1793,6 +1797,14 @@ configstore@^3.0.0:
17931797
write-file-atomic "^2.0.0"
17941798
xdg-basedir "^3.0.0"
17951799

1800+
consola@^0.1.0:
1801+
version "0.1.0"
1802+
resolved "https://registry.yarnpkg.com/consola/-/consola-0.1.0.tgz#6b627c18dee52e0f61f5222552a250345ba2dedd"
1803+
dependencies:
1804+
figures "^2.0.0"
1805+
ora "^2.0.0"
1806+
std-env "^1.1.0"
1807+
17961808
console-browserify@^1.1.0:
17971809
version "1.1.0"
17981810
resolved "https://registry.yarnpkg.com/console-browserify/-/console-browserify-1.1.0.tgz#f0241c45730a9fc6323b206dbf38edc741d0bb10"
@@ -2200,6 +2212,12 @@ default-require-extensions@^1.0.0:
22002212
dependencies:
22012213
strip-bom "^2.0.0"
22022214

2215+
defaults@^1.0.3:
2216+
version "1.0.3"
2217+
resolved "https://registry.yarnpkg.com/defaults/-/defaults-1.0.3.tgz#c656051e9817d9ff08ed881477f3fe4019f3ef7d"
2218+
dependencies:
2219+
clone "^1.0.2"
2220+
22032221
define-properties@^1.1.2:
22042222
version "1.1.2"
22052223
resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.2.tgz#83a73f2fea569898fb737193c8f873caf6d45c94"
@@ -5307,6 +5325,17 @@ ora@^0.2.3:
53075325
cli-spinners "^0.1.2"
53085326
object-assign "^4.0.1"
53095327

5328+
ora@^2.0.0:
5329+
version "2.0.0"
5330+
resolved "https://registry.yarnpkg.com/ora/-/ora-2.0.0.tgz#8ec3a37fa7bffb54a3a0c188a1f6798e7e1827cd"
5331+
dependencies:
5332+
chalk "^2.3.1"
5333+
cli-cursor "^2.1.0"
5334+
cli-spinners "^1.1.0"
5335+
log-symbols "^2.2.0"
5336+
strip-ansi "^4.0.0"
5337+
wcwidth "^1.0.1"
5338+
53105339
os-browserify@^0.3.0:
53115340
version "0.3.0"
53125341
resolved "https://registry.yarnpkg.com/os-browserify/-/os-browserify-0.3.0.tgz#854373c7f5c2315914fc9bfc6bd8238fdda1ec27"
@@ -6554,6 +6583,12 @@ std-env@^1.0.0:
65546583
dependencies:
65556584
is-ci "^1.1.0"
65566585

6586+
std-env@^1.1.0:
6587+
version "1.1.0"
6588+
resolved "https://registry.yarnpkg.com/std-env/-/std-env-1.1.0.tgz#f89ded0c3facd5b53cd3cda288779ed88d3b87ad"
6589+
dependencies:
6590+
is-ci "^1.1.0"
6591+
65576592
stealthy-require@^1.1.0:
65586593
version "1.1.1"
65596594
resolved "https://registry.yarnpkg.com/stealthy-require/-/stealthy-require-1.1.1.tgz#35b09875b4ff49f26a777e509b3090a3226bf24b"
@@ -7192,6 +7227,12 @@ watchpack@^1.5.0:
71927227
graceful-fs "^4.1.2"
71937228
neo-async "^2.5.0"
71947229

7230+
wcwidth@^1.0.1:
7231+
version "1.0.1"
7232+
resolved "https://registry.yarnpkg.com/wcwidth/-/wcwidth-1.0.1.tgz#f0b0dcf915bc5ff1528afadb2c0e17b532da2fe8"
7233+
dependencies:
7234+
defaults "^1.0.3"
7235+
71957236
webidl-conversions@^4.0.1, webidl-conversions@^4.0.2:
71967237
version "4.0.2"
71977238
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad"

0 commit comments

Comments
 (0)