Skip to content

Commit

Permalink
feat: use warning emoji instead of plain text
Browse files Browse the repository at this point in the history
  • Loading branch information
develar committed Oct 29, 2016
1 parent 8d37b7e commit 772b297
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 12 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
"lodash.template": "^4.4.0",
"mime": "^1.3.4",
"minimatch": "^3.0.3",
"node-emoji": "^1.4.1",
"normalize-package-data": "^2.3.5",
"parse-color": "^1.0.0",
"plist": "^2.0.1",
Expand Down
5 changes: 4 additions & 1 deletion src/util/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import BluebirdPromise from "bluebird-lst-c"
import { eraseLines } from "ansi-escapes"
import * as cursor from "cli-cursor"
import prettyMs from "pretty-ms"
import { get as getEmoji } from "node-emoji"

interface Line {
// text must be \n terminated
Expand Down Expand Up @@ -35,11 +36,13 @@ class Logger {
private lines: Array<Line> = []
private logTime = process.env.LOG_TIME === "true"

private readonly isTTY = (<any>process.stdout).isTTY

constructor(private stream: WritableStream) {
}

warn(message: string): void {
this.log(yellow(`Warning: ${message}`))
this.log((this.isTTY ? (getEmoji("warning") + " ") : "Warning: ") + yellow(message))
}

log(message: string): void {
Expand Down
3 changes: 3 additions & 0 deletions typings/node-emoji.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare module "node-emoji" {
function get(name: string): string
}
28 changes: 17 additions & 11 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@develar/semantic-release@^6.3.21":
version "6.3.21"
resolved "https://registry.yarnpkg.com/@develar/semantic-release/-/semantic-release-6.3.21.tgz#600dcfc607ab7378546222748373b9c88fa05cb1"
version "6.3.23"
resolved "https://registry.yarnpkg.com/@develar/semantic-release/-/semantic-release-6.3.23.tgz#80c8ecd7369cf4a5c442d59d24bd614c051dd004"
dependencies:
"@semantic-release/commit-analyzer" "^2.0.0"
"@semantic-release/error" "^1.0.0"
Expand Down Expand Up @@ -2449,10 +2449,6 @@ jodid25519@^1.0.0:
dependencies:
jsbn "~0.1.0"

js-tokens@^1.0.1:
version "1.0.3"
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-1.0.3.tgz#14e56eb68c8f1a92c43d59f5014ec29dc20f2ae1"

js-tokens@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-2.0.0.tgz#79903f5563ee778cc1162e6dcf1a0027c97f9cb5"
Expand Down Expand Up @@ -2705,10 +2701,10 @@ longest@^1.0.1:
resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097"

loose-envify@^1.0.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.2.0.tgz#69a65aad3de542cf4ee0f4fe74e8e33c709ccb0f"
version "1.3.0"
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.0.tgz#6b26248c42f6d4fa4b0d8542f78edfcde35642a8"
dependencies:
js-tokens "^1.0.1"
js-tokens "^2.0.0"

loud-rejection@^1.0.0, loud-rejection@^1.6.0:
version "1.6.0"
Expand Down Expand Up @@ -2886,6 +2882,12 @@ ncp@~2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ncp/-/ncp-2.0.0.tgz#195a21d6c46e361d2fb1281ba38b91e9df7bdbb3"

node-emoji@^1.4.1:
version "1.4.1"
resolved "https://registry.yarnpkg.com/node-emoji/-/node-emoji-1.4.1.tgz#c9fa0cf91094335bcb967a6f42b2305c15af2ebc"
dependencies:
string.prototype.codepointat "^0.2.0"

node-pre-gyp@^0.6.29:
version "0.6.31"
resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.6.31.tgz#d8a00ddaa301a940615dbcc8caad4024d58f6017"
Expand Down Expand Up @@ -3775,6 +3777,10 @@ string-width@^1.0.1, string-width@^1.0.2:
is-fullwidth-code-point "^1.0.0"
strip-ansi "^3.0.0"

string.prototype.codepointat@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/string.prototype.codepointat/-/string.prototype.codepointat-0.2.0.tgz#6b26e9bd3afcaa7be3b4269b526de1b82000ac78"

stringifier@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/stringifier/-/stringifier-1.3.0.tgz#def18342f6933db0f2dbfc9aa02175b448c17959"
Expand Down Expand Up @@ -3987,8 +3993,8 @@ typedarray@~0.0.5:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"

typescript@^2.1.0-dev.20161028:
version "2.1.0-dev.20161028"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.1.0-dev.20161028.tgz#4b7b67c734254db040566f7289f7eda5e9565825"
version "2.1.0-dev.20161029"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.1.0-dev.20161029.tgz#889598d3b2a3b5c8d7e2ad6a8ba7f300eff27caa"

uc.micro@^1.0.1, uc.micro@^1.0.3:
version "1.0.3"
Expand Down

0 comments on commit 772b297

Please sign in to comment.