How to use the showProgress function from npmlog

Find comprehensive JavaScript npmlog.showProgress code examples handpicked from public code repositorys.

197
198
199
200
201
202
203
204
205
206
logger.info("villages", "Fetching data");

let idx = 0;
for (const article of articles) {
  // https://github.com/npm/npmlog/blob/main/lib/log.js#L157
  logger.showProgress(article, idx++ / articles.length);

  results.villages.push({
    name: article,
    description: await getDescription(article),
fork icon0
star icon0
watch icon1

+ 9 other calls in file

1
2
3
4
5
6
7
var log = require('npmlog')
// output to stdout in a progress bar compatible way
module.exports = function () {
  log.clearProgress()
  console.log.apply(console, arguments)
  log.showProgress()
}
fork icon0
star icon0
watch icon0

6
7
8
9
10
11
12
13


// istanbul ignore next
function output(...args) {
  log.clearProgress();
  console.log(...args);
  log.showProgress();
}
fork icon0
star icon0
watch icon0

16
17
18
19
20
21
22
23
24
25
26
27
const usernamePrompt = 'npm username: '
const emailPrompt = 'email (this IS public): '


function read (opts) {
  log.clearProgress()
  return readAsync(opts).finally(() => log.showProgress())
}


function readOTP (msg = otpPrompt, otp, isRetry) {
  if (isRetry && otp && /^[\d ]+$|^[A-Fa-f0-9]{64,64}$/.test(otp))
fork icon0
star icon0
watch icon0