Giter Club home page Giter Club logo

gauge's Issues

Temporary files on npm release

Hi Rebecca,

I was surprised to find that the latest npm release (2.6.0) contains temporary files :

-rw-rw-r-- 1 glorieux glorieux  395 Jun 16 03:59 base-theme.js
-rw-rw-r-- 1 glorieux glorieux 5.4K Jun 16 10:55 CHANGELOG.md
-rw-rw-r-- 1 glorieux glorieux 5.0K Jun 16 06:18 CHANGELOG.md~
-rw-rw-r-- 1 glorieux glorieux  616 Jun 16 03:59 error.js
-rw-rw-r-- 1 glorieux glorieux  292 Jun 16 03:59 has-color.js
-rw-rw-r-- 1 glorieux glorieux 6.7K Jun 16 10:52 index.js
-rw-rw-r-- 1 glorieux glorieux  751 Jan 25  2015 LICENSE
-rw-rw-r-- 1 glorieux glorieux 3.0K Jul  6 10:33 package.json
-rw-rw-r-- 1 glorieux glorieux 1.2K Jun 16 03:59 plumbing.js
-rw-rw-r-- 1 glorieux glorieux   89 Jun 16 03:59 process.js
-rw-rw-r-- 1 glorieux glorieux  998 Jun 16 03:59 progress-bar.js
-rw-rw-r-- 1 glorieux glorieux  15K Jun 16 10:53 README.md
-rw-rw-r-- 1 glorieux glorieux  15K Jun 16 06:12 README.md~
-rw-rw-r-- 1 glorieux glorieux 5.7K Jun 16 10:51 render-template.js
-rw-rw-r-- 1 glorieux glorieux  139 Jun 16 03:59 set-immediate.js
-rw-rw-r-- 1 glorieux glorieux   93 Jun 16 03:59 set-interval.js
-rw-rw-r-- 1 glorieux glorieux  105 Jun 16 03:59 spin.js
-rw-rw-r-- 1 glorieux glorieux 1.9K Jun 16 03:59 template-item.js
-rw-rw-r-- 1 glorieux glorieux 3.7K Jun 16 03:59 theme-set.js
-rw-rw-r-- 1 glorieux glorieux 1.6K Jun 16 03:59 themes.js
-rw-rw-r-- 1 glorieux glorieux  828 Jun 16 03:59 wide-truncate.js

Looks like leftovers from the release 😉

Reporting a vulnerability

Hello!

I hope you are doing well!

We are a security research team. Our tool automatically detected a vulnerability in this repository. We want to disclose it responsibly. GitHub has a feature called Private vulnerability reporting, which enables security research to privately disclose a vulnerability. Unfortunately, it is not enabled for this repository.

Can you enable it, so that we can report it?

Thanks in advance!

PS: you can read about how to enable private vulnerability reporting here: https://docs.github.com/en/code-security/security-advisories/repository-security-advisories/configuring-private-vulnerability-reporting-for-a-repository

Disable if running in CI

Using CI and CONTINUOUS_INTEGRATION env vars. Some, such as Travis CI, simulate a TTY causing process.stdout.isTTY to return true.

gauge erasing last line of output in npm

The issue in npm/npm#9682 appears to be something to do with gauge AFAICT. The output of the npm command is correct, it just doesn't appear in the terminal because the line is erased. :(

I had a poke around but I'm unclear what the exact issue is.

Removing the this.cursor.horizontalAbsolute(0).eraseLine() line from gauge's .hide stops the last line from being erased (though output is understandably broken due to lingering gauges).

ProgressBar.prototype.hide = function() {
  if (!isTTY()) return
  if (this.disabled) return
  this.cursor.show()
  if (this.showing) this.cursor.up(1)
  this.cursor.horizontalAbsolute(0).eraseLine() // remove this and the last line is not erased
  this.showing = false
}

Source

Perhaps it needs to do something like this? NFI though.
https://github.com/TooTallNate/ansi.js/blob/master/examples/progress/index.js#L38-L45

[BUG] Cannot find module 'object-assign'

What / Why

UNCAUGHT EXCEPTION - keeping process alive: Error: Cannot find module 'object-assign'
Require stack:

  • node_modules\gauge\theme-set.js
  • node_modules\gauge\themes.js
  • node_modules\gauge\index.js

"object-assign" should be added to package.json dependencies

option to calculate and display an ETA

For a CLI project I'm currently engaged in, I looked closely at both gauge and https://github.com/tj/node-progress . I ended up opting for gauge, primarily because my project discovers more work to do as it progresses, which gauge handles perfectly.

However, I would like to eventually display an ETA to my users, especially as the workload stabilises fairly early within the process. Just not early enough to use progress instead.

Is this something that you think is within the scope of this project?
Or should we have some sort of extension mechanism first, and develop ETAs as a third-party extension?

[FEATURE] Dependencies should be updated to dedupe the tree for npm

What / Why

The npm package depends on cli-table3, which uses string-width and strip-ansi in recent versions.
It also uses this gauge package (through npmlog) which uses older versions of string-width and strip-ansi. the wide-align dependency also brings its own versions of string-width and strip-ansi, which are potentially different too.

When

  • n/a

Where

  • n/a

How

Current Behavior

Packages string-width and strip-ansi (and potentially others too, but I stopped analyzing the tree at some point) are installed many times in different versions

Expected Behavior

The dependencies should be updated to use recent versions, so that more deduplication can be done (and the maintenance status of older major version could be another reason to upgrade).

Who

  • n/a

References

  • n/a

TypeError: Object.keys called on non-object

run in node 0.12.7,gives me:
/Users/zhengxingcheng/data/lab/gauge/index.js:88 if (theme && (Object.keys(theme).length === 0 || theme.hasUnicode != null || ^ TypeError: Object.keys called on non-object at Function.keys (native) at Object.Gauge._computeTheme (/Users/zhengxingcheng/data/lab/gauge/index.js:88:24) at Object.Gauge (/Users/zhengxingcheng/data/lab/gauge/index.js:51:20) at nextBar (/Users/zhengxingcheng/data/lab/gauge/demo.js:19:12) at Object.<anonymous> (/Users/zhengxingcheng/data/lab/gauge/demo.js:13:1) at Module._compile (module.js:460:26) at Object.Module._extensions..js (module.js:478:10) at Module.load (module.js:355:32) at Function.Module._load (module.js:310:12) at Function.Module.runMain (module.js:501:10)

Am I using gauge wrong?

Not sure what I might be doing wrong here, but I don't see it working as expected. Here's my code

var Gauge = require('gauge');
var async = require('async');
var gauge = new Gauge();
var n = 20;

gauge.show('Test', 0);

async.times(n, function (index, cb) {
    gauge.pulse('run #' + index);
    setTimeout(function () {
        gauge.show(index, index / n);
    }, 3000);
}, function (err, res) {
    console.log('Done!');
});

And here's the result I'm seeing
test-gauge

every time I use it, I expect show to pulse too

Soo, any time I use it outside npmlog (which pulses on loglines only), I'm inevitably confused why just calling gauge.show on changes doesn't make the spinner spin.

I'm now of the opinion that gauge.show should increment the spinner just the way pulse does. This would make the two commands essentially identical, just having different short-cut type arguments– show being section and completed, and pulse be subsection. It might be time to just eliminate pulse entirely.

MaxListenersExceededWarning

When instantiating 10 or more gauges in the same process there are warnings from Nodejs core.

var G = require('gauge')

new G, new G, new G, new G, new G, new G, new G, new G, new G // first nine are okay

new G // tenth: resize
// > (node:71997) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 resize listeners added. Use emitter.setMaxListeners() to increase limit

new G  // eleventh: exit
// > (node:71997) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 exit listeners added. Use emitter.setMaxListeners() to increase limit

As a workaround:

  • Limit the number of concurrent instances to 9.
  • Always call gauge.disable() (where gauge is the instance of G).
  • Pass the constructor the option: {cleanupOnExit: false} (your app should deal with the cleanup in SIGINT).

But, it would be nice if the library could manage this overhead. I might get around to digging deeper and create a PR. For now just wanted to record this issue in case anyone else (or future me) runs into the same problem.

Progress bar theme set to 'fallback' regardless of unicode locale on Fedora Linux

It seems like progress bar theming isn't being properly selected when running commands like npm install on Fedora 27. Regardless of whether I run npm set unicode=true the theme always defaults to fallback and not the nicer theme like is does on macOS. I've checked my locales and everything like LC_ALL and LC_CTYPE in addition to the terminal emulator have it set to UTF-8 or 'en_US.UTF-8'. I'm running npm version 5.6.0 and I believe that uses gauge version 2.7.4.

[BUG] Themes no longer work from require

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Docs suggest using themes by requiring "gauge/themes." This stopped working at some point and no indication as to what the change is. Could the readme/docs get updated or point to the correct way to use this feature?

Expected Behavior

Require the theme and customize

Steps To Reproduce

  1. Follow docs and require gauge/themes
  2. Run build
  3. See error, gauge/themes not found

Environment

  • npm: 8.18.0
  • Node: 16.17.0
  • OS: macOS 12.4
  • platform: Apple Silicon M1

TypeError: Cannot read property 'startgroup' of undefined

// progress.js
import Gauge from 'gauge';

export default class Progress extends Gauge {
    constructor (options) {
        super(options);
    }
};
// test.js
import Progress from './progress';

let progress = new Progress('Parsing subjects', 0);
progress.show('test', 1);
➜ node test.js
/node_modules/gauge/progress-bar.js:174
  values.startgroup = theme.startgroup
                           ^
TypeError: Cannot read property 'startgroup' of undefined
    at ProgressBar.renderTemplate (/node_modules/gauge/progress-bar.js:174:28)
    at drawBar (/node_modules/gauge/progress-bar.js:160:27)
    at ProgressBar.show (/node_modules/gauge/progress-bar.js:149:10)
    at Progress.next (/tools/progress.js:28:8)
    at Object.<anonymous> (/test.js:4:10)
    at Module._compile (module.js:460:26)
    at normalLoader (/usr/local/lib/node_modules/babel/node_modules/babel-core/lib/api/register/node.js:199:5)
    at Object.require.extensions.(anonymous function) [as .js] (/usr/local/lib/node_modules/babel/node_modules/babel-core/lib/api/register/node.js:216:7)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)

[Question] Upgrade Dependencies to fix Vulnerability

What / Why

There's a Regular Expression Denial of Service vulnerability in the ansi-regex package in versions < 6.0.1: https://app.snyk.io/vuln/SNYK-JS-ANSIREGEX-1583908

Would it be possible to update gauge deps to use a patched version?

The dependencies from this package that use out of date versions that I see are:
[email protected] > [email protected] > [email protected]
[email protected] > [email protected]

Fix version is https://github.com/chalk/ansi-regex/releases/tag/v6.0.1

References

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.