Comparing version 2.0.0 to 2.1.0
@@ -0,1 +1,23 @@ | ||
### v2.1.0 | ||
* Got rid of ░ in the default platform, noUnicode, hasColor theme. Thanks | ||
to @yongtw123 for pointing out this had snuck in. | ||
* Fiddled with the demo output to make it easier to see the spinner spin. Also | ||
added prints before each platforms test output. | ||
* I forgot to include `signal-exit` in our deps. <.< Thank you @KenanY for | ||
finding this. Then I was lazy and made a new commit instead of using his | ||
PR. Again, thank you for your patience @KenenY. | ||
* Drastically speed up travis testing. | ||
* Add a small javascript demo (demo.js) for showing off the various themes | ||
(and testing them on diff platforms). | ||
* Change: The subsection separator from ⁄ and / (different chars) to >. | ||
* Fix crasher: A show or pulse without a label would cause the template renderer | ||
to complain about a missing value. | ||
* New feature: Add the ability to disable the clean-up-on-exit behavior. | ||
Not something I expect to be widely desirable, but important if you have | ||
multiple distinct gauge instances in your app. | ||
* Use our own color support detection. | ||
The `has-color` module proved too magic for my needs, making assumptions | ||
as to which stream we write to and reading command line arguments. | ||
### v2.0.0 | ||
@@ -2,0 +24,0 @@ |
var Gauge = require('./') | ||
var theme = require('./themes.js') | ||
var gt = new Gauge(process.stdout, {updateInterval: 50, fixedFramerate: true, tty: process.stdout}) | ||
var gt = new Gauge(process.stderr, { | ||
updateInterval: 50, | ||
fixedFramerate: true, | ||
theme: theme({hasUnicode: false, hasColor: false}) | ||
}) | ||
var progress = 0 | ||
var pulse = setInterval(function () { | ||
gt.pulse('interval') | ||
gt.pulse('this is a thing that happened') | ||
}, 55) | ||
var prog = setInterval(function () { | ||
progress += 0.001 | ||
for (var ii=0; ii<1000; ++ii) { | ||
gt.show('pro--gress 1rogress 2rogress 3rogress 4rogress 5rogress 6rogress 7rogres!', progress) | ||
} | ||
gt.show('completing…', progress) | ||
if (progress >= 1) { | ||
@@ -19,3 +23,3 @@ clearInterval(prog) | ||
} | ||
}, 1) | ||
}, 10) | ||
gt.show({section:'xxx', subsection: ''}) |
12
index.js
@@ -5,3 +5,3 @@ 'use strict' | ||
var hasUnicode = require('has-unicode') | ||
var hasColor = require('has-color') | ||
var hasColor = require('./has-color.js') | ||
var onExit = require('signal-exit') | ||
@@ -23,3 +23,5 @@ var themes = require('./themes') | ||
this.status = { | ||
spun: 0 | ||
spun: 0, | ||
section: '', | ||
subsection: '' | ||
} | ||
@@ -54,3 +56,5 @@ this._showing = false | ||
onExit(callWith(this, this.disable)) | ||
if (options.cleanupOnExit == null || options.cealnupOnExit) { | ||
onExit(callWith(this, this.disable)) | ||
} | ||
@@ -122,3 +126,3 @@ if (options.enabled || options.enabled == null) { | ||
if (!this._showing) return | ||
this.status.subsection = subsection | ||
this.status.subsection = subsection || '' | ||
this.status.spun ++ | ||
@@ -125,0 +129,0 @@ this._needsRedraw = true |
{ | ||
"name": "gauge", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "A terminal based horizontal guage", | ||
@@ -29,2 +29,3 @@ "main": "index.js", | ||
"object-assign": "^4.0.1", | ||
"signal-exit": "^2.1.2", | ||
"string-width": "^1.0.1", | ||
@@ -31,0 +32,0 @@ "strip-ansi": "^3.0.0", |
@@ -69,4 +69,5 @@ gauge | ||
and everyone almost always gets color. Unicode is detected with | ||
[has-unicode] and color is detected with [has-color]. Theme selection is | ||
done by the internal [themes] module, which you can use directly. | ||
[has-unicode] and color is detected by checking platform and TERM env var. | ||
Theme selection is done by the internal [themes] module, which you can use | ||
directly. | ||
* **template**: Describes what you want your gauge to look like. The | ||
@@ -87,5 +88,8 @@ default is what npm uses. Detailed [documentation] is later in this | ||
shouldn't need to override this. | ||
* **cleanupOnExit**: Defaults to true. Ordinarily we register an exit | ||
handler to make sure your cursor is turned back on and the progress bar | ||
erased when your process exits, even if you Ctrl-C out or otherwise exit | ||
unexpectedly. You can disable this and it won't register the exit handler. | ||
[has-unicode]: https://www.npmjs.com/package/has-unicode | ||
[has-color]: https://www.npmjs.com/package/has-color | ||
[themes]: #themes | ||
@@ -92,0 +96,0 @@ [documentation]: #templates |
@@ -87,3 +87,3 @@ 'use strict' | ||
function checkBasicShow (args) { | ||
t.isDeeply(args, [{ spun: 0, section: 'NAME', completed: 0.1 }], 'check basic show') | ||
t.isDeeply(args, [{ spun: 0, section: 'NAME', subsection: '', completed: 0.1 }], 'check basic show') | ||
@@ -96,3 +96,3 @@ gauge.show('S') | ||
t.isDeeply(args, [ | ||
{ spun: 1, section: 'S', subsection: undefined, completed: 0.1 } | ||
{ spun: 1, section: 'S', subsection: '', completed: 0.1 } | ||
], 'check pulse') | ||
@@ -132,2 +132,3 @@ | ||
section: 'NAME', | ||
subsection: '', | ||
completed: 0.1, | ||
@@ -150,2 +151,3 @@ spun: 0 | ||
section: 'NAME', | ||
subsection: '', | ||
completed: 0.5, | ||
@@ -152,0 +154,0 @@ spun: 0 |
@@ -43,6 +43,6 @@ 'use strict' | ||
complete: '#', | ||
remaining: '-' | ||
remaining: '.' | ||
}, | ||
activityIndicatorTheme: '-\\|/', | ||
preSubsection: '/' | ||
preSubsection: '>' | ||
}) | ||
@@ -56,3 +56,3 @@ | ||
preRemaining: consoleStrings.color('brightBlack'), | ||
remaining: '░', | ||
remaining: '.', | ||
postRemaining: consoleStrings.color('reset') | ||
@@ -68,10 +68,9 @@ } | ||
themes.darwin.hasUnicode.noColor = newTheme({ | ||
preProgressbar: '«', | ||
postProgressbar: '»', | ||
preSubsection: '⁄', | ||
preProgressbar: '⸨', | ||
postProgressbar: '⸩', | ||
progressbarTheme: { | ||
complete: '░', | ||
remaining: '-' | ||
remaining: '⠂' | ||
}, | ||
activityIndicatorTheme: '◷◶◵◴' | ||
activityIndicatorTheme: '⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏' | ||
}) | ||
@@ -78,0 +77,0 @@ |
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
628719
53
1306
295
0
8
+ Addedsignal-exit@^2.1.2
+ Addedsignal-exit@2.1.2(transitive)