gauge
Advanced tools
Comparing version 2.7.4 to 3.0.0
@@ -0,1 +1,4 @@ | ||
### v3.0.0 | ||
* Drops support for Node v4, v6, v7 and v8 | ||
### v2.7.4 | ||
@@ -2,0 +5,0 @@ |
'use strict' | ||
var colorSupport = require('color-support') | ||
module.exports = isWin32() || isColorTerm() | ||
function isWin32 () { | ||
return process.platform === 'win32' | ||
} | ||
function isColorTerm () { | ||
var termHasColor = /^screen|^xterm|^vt100|color|ansi|cygwin|linux/i | ||
return !!process.env.COLORTERM || termHasColor.test(process.env.TERM) | ||
} | ||
module.exports = colorSupport().hasBasic |
@@ -191,3 +191,3 @@ 'use strict' | ||
this._status.subsection = subsection || '' | ||
this._status.spun ++ | ||
this._status.spun++ | ||
if (this._disabled) return | ||
@@ -194,0 +194,0 @@ if (!this._showing) return |
{ | ||
"name": "gauge", | ||
"version": "2.7.4", | ||
"version": "3.0.0", | ||
"description": "A terminal based horizontal guage", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "standard && tap test/*.js --coverage", | ||
"prepublish": "rm -f *~" | ||
"test": "standard && tap test/*.js --coverage" | ||
}, | ||
@@ -22,14 +21,14 @@ "repository": { | ||
"bugs": { | ||
"url": "https://github.com/iarna/gauge/issues" | ||
"url": "https://github.com/npm/gauge/issues" | ||
}, | ||
"homepage": "https://github.com/iarna/gauge", | ||
"homepage": "https://github.com/npm/gauge", | ||
"dependencies": { | ||
"aproba": "^1.0.3", | ||
"aproba": "^1.0.3 || ^2.0.0", | ||
"color-support": "^1.1.2", | ||
"console-control-strings": "^1.0.0", | ||
"has-unicode": "^2.0.0", | ||
"object-assign": "^4.1.0", | ||
"has-unicode": "^2.0.1", | ||
"signal-exit": "^3.0.0", | ||
"string-width": "^1.0.1", | ||
"strip-ansi": "^3.0.1", | ||
"wide-align": "^1.1.0" | ||
"string-width": "^1.0.1 || ^2.0.0", | ||
"strip-ansi": "^3.0.1 || ^4.0.0", | ||
"wide-align": "^1.1.2" | ||
}, | ||
@@ -39,4 +38,4 @@ "devDependencies": { | ||
"require-inject": "^1.4.0", | ||
"standard": "^7.1.2", | ||
"tap": "^5.7.2", | ||
"standard": "^11.0.1", | ||
"tap": "^12.0.1", | ||
"through2": "^2.0.0" | ||
@@ -64,3 +63,6 @@ }, | ||
"wide-truncate.js" | ||
] | ||
], | ||
"engines": { | ||
"node": ">=10" | ||
} | ||
} |
@@ -30,3 +30,3 @@ 'use strict' | ||
n = Math.floor(n / 2) | ||
/*eslint no-self-assign: 0*/ | ||
/* eslint no-self-assign: 0 */ | ||
string += string | ||
@@ -33,0 +33,0 @@ } while (n && stringWidth(result) < width) |
@@ -11,9 +11,12 @@ gauge | ||
gauge.show("test", 0.20) | ||
gauge.show("working…", 0) | ||
setTimeout(() => { gauge.pulse(); gauge.show("working…", 0.25) }, 500) | ||
setTimeout(() => { gauge.pulse(); gauge.show("working…", 0.50) }, 1000) | ||
setTimeout(() => { gauge.pulse(); gauge.show("working…", 0.75) }, 1500) | ||
setTimeout(() => { gauge.pulse(); gauge.show("working…", 0.99) }, 2000) | ||
setTimeout(() => gauge.hide(), 2300) | ||
``` | ||
gauge.pulse("this") | ||
See also the [demos](demo.js): | ||
gauge.hide() | ||
``` | ||
![](gauge-demo.gif) | ||
@@ -50,3 +53,3 @@ | ||
will detect terminal resizes and redraw to fit. We do this by watching for | ||
`resize` events on the tty. (To work around a bug in verisons of Node prior | ||
`resize` events on the tty. (To work around a bug in versions of Node prior | ||
to 2.5.0, we watch for them on stdout if the tty is stderr.) Resizes to | ||
@@ -56,3 +59,3 @@ larger window sizes will be clean, but shrinking the window will always | ||
**IMPORTANT:** If you prevously were passing in a non-tty stream but you still | ||
**IMPORTANT:** If you previously were passing in a non-tty stream but you still | ||
want output (for example, a stream wrapped by the `ansi` module) then you | ||
@@ -66,3 +69,3 @@ need to pass in the **tty** option below, as `gauge` needs access to | ||
* **updateInterval**: How often gauge updates should be drawn, in miliseconds. | ||
* **updateInterval**: How often gauge updates should be drawn, in milliseconds. | ||
* **fixedFramerate**: Defaults to false on node 0.8, true on everything | ||
@@ -83,3 +86,3 @@ else. When this is true a timer is created to trigger once every | ||
* A configuration object with any of `hasUnicode`, `hasColor` or | ||
`platform` keys, which if wlll be used to override our guesses when making | ||
`platform` keys, which if will be used to override our guesses when making | ||
a default theme selection. | ||
@@ -102,3 +105,3 @@ | ||
* **Plumbing**: The class to use to actually generate the gauge for | ||
printing. This defaults to `require('gauge/plumbing')` and ordinarly you | ||
printing. This defaults to `require('gauge/plumbing')` and ordinarily you | ||
shouldn't need to override this. | ||
@@ -171,3 +174,3 @@ * **cleanupOnExit**: Defaults to true. Ordinarily we register an exit | ||
* A configuration object with any of `hasUnicode`, `hasColor` or | ||
`platform` keys, which if wlll be used to override our guesses when making | ||
`platform` keys, which if will be used to override our guesses when making | ||
a default theme selection. | ||
@@ -204,3 +207,3 @@ | ||
// that brackets the progress bar with arrows | ||
var ourTheme = themes.newTheme(theme(hasUnicode: false, hasColor: true}), { | ||
var ourTheme = themes.newTheme(themes({hasUnicode: false, hasColor: true}), { | ||
preProgressbar: '→', | ||
@@ -218,3 +221,3 @@ postProgressbar: '←' | ||
var themes = require('gauge/themes') | ||
var mythemes = themes.newThemeset() // creates a new themeset based on the default themes | ||
var mythemes = themes.newThemeSet() // creates a new themeset based on the default themes | ||
``` | ||
@@ -323,3 +326,3 @@ | ||
#### themes.newThemeset() | ||
#### themes.newThemeSet() | ||
@@ -363,3 +366,3 @@ Copy the current themeset into a new one. This allows you to easily inherit | ||
* *length* – Provides a single value for both *minLength* and *maxLength*. If both | ||
*length* and *minLength or *maxLength* are specifed then the latter take precedence. | ||
*length* and *minLength or *maxLength* are specified then the latter take precedence. | ||
* *value* – A literal value to use for this template item. | ||
@@ -366,0 +369,0 @@ * *default* – A default value to use for this template item if a value |
'use strict' | ||
var align = require('wide-align') | ||
var validate = require('aproba') | ||
var objectAssign = require('object-assign') | ||
var wideTruncate = require('./wide-truncate') | ||
@@ -37,3 +36,3 @@ var error = require('./error') | ||
function generatePreAndPost (baseItem, parentValues) { | ||
var item = objectAssign({}, baseItem) | ||
var item = Object.assign({}, baseItem) | ||
var values = Object.create(parentValues) | ||
@@ -86,3 +85,2 @@ var template = [] | ||
var outputLength = 0 | ||
var remainingSpace = width | ||
@@ -93,3 +91,2 @@ var variableCount = output.length | ||
if (length > remainingSpace) length = remainingSpace | ||
outputLength += length | ||
remainingSpace -= length | ||
@@ -96,0 +93,0 @@ } |
@@ -73,2 +73,1 @@ 'use strict' | ||
} | ||
@@ -115,2 +115,1 @@ 'use strict' | ||
} | ||
'use strict' | ||
var consoleControl = require('console-control-strings') | ||
var color = require('console-control-strings').color | ||
var ThemeSet = require('./theme-set.js') | ||
@@ -20,8 +20,8 @@ | ||
progressbarTheme: { | ||
preComplete: consoleControl.color('inverse'), | ||
complete: ' ', | ||
postComplete: consoleControl.color('stopInverse'), | ||
preRemaining: consoleControl.color('brightBlack'), | ||
preComplete: color('bgBrightWhite', 'brightWhite'), | ||
complete: '#', | ||
postComplete: color('reset'), | ||
preRemaining: color('bgBrightBlack', 'brightBlack'), | ||
remaining: '.', | ||
postRemaining: consoleControl.color('reset') | ||
postRemaining: color('reset') | ||
} | ||
@@ -34,3 +34,3 @@ }) | ||
progressbarTheme: { | ||
complete: '░', | ||
complete: '#', | ||
remaining: '⠂' | ||
@@ -44,8 +44,8 @@ }, | ||
progressbarTheme: { | ||
preComplete: consoleControl.color('inverse'), | ||
complete: ' ', | ||
postComplete: consoleControl.color('stopInverse'), | ||
preRemaining: consoleControl.color('brightBlack'), | ||
remaining: '░', | ||
postRemaining: consoleControl.color('reset') | ||
preComplete: color('bgBrightWhite', 'brightWhite'), | ||
complete: '#', | ||
postComplete: color('reset'), | ||
preRemaining: color('bgBrightBlack', 'brightBlack'), | ||
remaining: '⠂', | ||
postRemaining: color('reset') | ||
} | ||
@@ -58,1 +58,3 @@ }) | ||
themes.setDefault({platform: 'darwin', hasUnicode: true, hasColor: true}, 'colorBrailleSpinner') | ||
themes.setDefault({platform: 'linux', hasUnicode: true}, 'brailleSpinner') | ||
themes.setDefault({platform: 'linux', hasUnicode: true, hasColor: true}, 'colorBrailleSpinner') |
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
48538
403
727
1
+ Addedcolor-support@^1.1.2
+ Addedansi-regex@3.0.1(transitive)
+ Addedaproba@2.0.0(transitive)
+ Addedcolor-support@1.1.3(transitive)
+ Addedis-fullwidth-code-point@2.0.0(transitive)
+ Addedstring-width@2.1.1(transitive)
+ Addedstrip-ansi@4.0.0(transitive)
- Removedobject-assign@^4.1.0
- Removedansi-regex@2.1.1(transitive)
- Removedaproba@1.2.0(transitive)
- Removedcode-point-at@1.1.0(transitive)
- Removedis-fullwidth-code-point@1.0.0(transitive)
- Removednumber-is-nan@1.0.1(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedstring-width@1.0.2(transitive)
- Removedstrip-ansi@3.0.1(transitive)
Updatedaproba@^1.0.3 || ^2.0.0
Updatedhas-unicode@^2.0.1
Updatedstrip-ansi@^3.0.1 || ^4.0.0
Updatedwide-align@^1.1.2