Comparing version 2.0.4 to 3.0.0
36
log.js
@@ -9,2 +9,5 @@ 'use strict' | ||
var ansi = require('ansi') | ||
var setBlocking = require('set-blocking') | ||
setBlocking(true) | ||
log.cursor = ansi(process.stderr) | ||
@@ -18,2 +21,3 @@ log.stream = process.stderr | ||
this.cursor.enabled = true | ||
this.gauge.setTheme({hasColor: colorEnabled, hasUnicode: unicodeEnabled}) | ||
} | ||
@@ -23,2 +27,3 @@ log.disableColor = function () { | ||
this.cursor.enabled = false | ||
this.gauge.setTheme({hasColor: colorEnabled, hasUnicode: unicodeEnabled}) | ||
} | ||
@@ -29,3 +34,3 @@ | ||
log.gauge = new Gauge(log.cursor) | ||
log.gauge = new Gauge(log.cursor, {tty: log.stream}) | ||
log.tracker = new Progress.TrackerGroup() | ||
@@ -36,18 +41,20 @@ | ||
var gaugeTheme = undefined | ||
var unicodeEnabled = undefined | ||
log.enableUnicode = function () { | ||
gaugeTheme = Gauge.unicode | ||
log.gauge.setTheme(gaugeTheme) | ||
unicodeEnabled = true | ||
this.gauge.setTheme({hasColor: colorEnabled, hasUnicode: unicodeEnabled}) | ||
} | ||
log.disableUnicode = function () { | ||
gaugeTheme = Gauge.ascii | ||
log.gauge.setTheme(gaugeTheme) | ||
unicodeEnabled = false | ||
this.gauge.setTheme({hasColor: colorEnabled, hasUnicode: unicodeEnabled}) | ||
} | ||
var gaugeTemplate = undefined | ||
log.setGaugeThemeset = function (themes) { | ||
this.gauge.setThemeset(themes) | ||
} | ||
log.setGaugeTemplate = function (template) { | ||
gaugeTemplate = template | ||
log.gauge.setTemplate(gaugeTemplate) | ||
this.gauge.setTemplate(template) | ||
} | ||
@@ -103,5 +110,5 @@ | ||
log.clearProgress = function () { | ||
if (!this.progressEnabled) return | ||
this.gauge.hide() | ||
log.clearProgress = function (cb) { | ||
if (!this.progressEnabled) return cb && process.nextTick(cb) | ||
this.gauge.hide(cb) | ||
} | ||
@@ -211,6 +218,3 @@ | ||
this.cursor = ansi(this.stream, { enabled: colorEnabled }) | ||
var options = {} | ||
if (gaugeTheme != null) options.theme = gaugeTheme | ||
if (gaugeTemplate != null) options.template = gaugeTemplate | ||
this.gauge = new Gauge(options, this.cursor) | ||
this.gauge.setWriteTo(this.cursor, this.stream) | ||
} | ||
@@ -217,0 +221,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"description": "logger for npm", | ||
"version": "2.0.4", | ||
"version": "3.0.0", | ||
"repository": { | ||
@@ -21,3 +21,4 @@ "type": "git", | ||
"are-we-there-yet": "~1.1.2", | ||
"gauge": "~1.2.5" | ||
"gauge": "~2.5.0", | ||
"set-blocking": "~2.0.0" | ||
}, | ||
@@ -24,0 +25,0 @@ "devDependencies": { |
@@ -101,4 +101,10 @@ # npmlog | ||
Overrides the default gauge template. | ||
Set a template for outputting the progress bar. See the [gauge documentation] for details. | ||
[gauge documentation]: https://npmjs.com/package/gauge | ||
## log.setGaugeThemeset(themes) | ||
Select a themeset to pick themes from for the progress bar. See the [gauge documentation] for details. | ||
## log.pause() | ||
@@ -197,1 +203,10 @@ | ||
* `messageRaw` {Array} Arguments to `util.format()` | ||
# Blocking TTYs | ||
We use [`set-blocking`](https://npmjs.com/package/set-blocking) to set | ||
stderr and stdout blocking if they are tty's and have the setBlocking call. | ||
This is a work around for an issue in early versions of Node.js 6.x, which | ||
made stderr and stdout non-blocking on OSX. (They are always blocking | ||
Windows and were never blocking on Linux.) `npmlog` needs them to be blocking | ||
so that it can allow output to stdout and stderr to be interlaced. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
14205
218
211
0
4
+ Addedset-blocking@~2.0.0
+ Addedansi-regex@2.1.1(transitive)
+ Addedaproba@1.2.0(transitive)
+ Addedcode-point-at@1.1.0(transitive)
+ Addedconsole-control-strings@1.1.0(transitive)
+ Addedgauge@2.5.3(transitive)
+ Addedhas-color@0.1.7(transitive)
+ Addedis-fullwidth-code-point@1.0.0(transitive)
+ Addednumber-is-nan@1.0.1(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedset-blocking@2.0.0(transitive)
+ Addedsignal-exit@3.0.7(transitive)
+ Addedstring-width@1.0.2(transitive)
+ Addedstrip-ansi@3.0.1(transitive)
+ Addedwide-align@1.1.5(transitive)
- Removedgauge@1.2.7(transitive)
- Removedlodash.pad@4.5.1(transitive)
- Removedlodash.padend@4.6.1(transitive)
- Removedlodash.padstart@4.6.1(transitive)
Updatedgauge@~2.5.0