How to use the npmlog.enableProgress function in npmlog

To help you get started, we’ve selected a few npmlog examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lerna / lerna / core / command / index.js View on Github external
enableProgressBar() {
    /* istanbul ignore next */
    if (this.options.progress !== false) {
      log.enableProgress();
    }
  }
github othiym23 / packard / src / command / pls.js View on Github external
export default function pls (roots) {
  log.enableProgress()
  return scanAlbums(roots)
    .then((albums) => {
      log.disableProgress()
      console.log(makePlaylist([...albums].sort(byDate)))
    })
}
github othiym23 / packard / src / command / inspect.js View on Github external
export default function inspect (files) {
  const progressGroups = new Map()
  log.silly('inspect', 'files', files)

  log.enableProgress()
  return Bluebird.map(files, (path) => {
    progressGroups.set(basename(path), log.newGroup(path))
    return scan({ path }, progressGroups)
  }).then((track) => {
    log.disableProgress()
    console.log(JSON.stringify(track, null, 2))
  })
}
github othiym23 / packard / src / command / pack.js View on Github external
export default function pack (sources, destination, blockSize) {
  log.enableProgress()

  const getBlockSize = blockSizeFromPath(destination)

  const sizeDestination = getBlockSize
    .then((blockBytes) => [
      blockBytes,
      freeBlocksFromPath(destination, blockBytes)
    ]).all()

  return sizeDestination.spread((blockBytes, { available }) => {
    return scanAlbums(sources, progressGroups).then((albums) => {
      const { included, discarded } = optimize(albums, available, blockBytes)

      let usedBlocks = 0
      for (let album of included.sort(bySize)) {
        log.silly(
github othiym23 / packard / src / command / albums.js View on Github external
export default function showAlbums (files = [], roots = [], progressGroups) {
  log.enableProgress()
  roots = files.concat(roots)
  log.silly('showAlbums', 'scanning', roots)

  const sorted = scanAlbums(roots, progressGroups).then((albums) => {
    log.silly('scanAlbums', 'albums', albums)
    const sorted = [...albums].sort(byDate)
    log.silly('scanAlbums', 'sorted', sorted.map((a) => '[' + a.date + '] ' + a.name))

    log.disableProgress()
    return sorted
  })

  return sorted.then(report)
}
github othiym23 / packard / src / command / unpack.js View on Github external
export default function unpack (target = {}, staging, archiveRoot, playlist) {
  log.enableProgress()

  const { roots = [], pattern, files = [] } = target
  log.silly('unpack', 'initial files', files)

  let paths
  if (roots.length && pattern) {
    paths = Bluebird.map(
      roots,
      (path) => glob(join(path, pattern))
    ).then((lists) => lists.reduce((a, c) => a.concat(c), files))
  } else {
    paths = Bluebird.resolve(files)
  }
  paths = paths.then((expanded) => {
    log.silly('unpack', 'expanded files', expanded)
    return expanded
github othiym23 / packard / src / command / artists.js View on Github external
export default function scanArtists (files = [], roots = [], progressGroups = new Map()) {
  log.enableProgress()
  roots = files.concat(roots)

  return Bluebird.mapSeries(
    roots,
    (root) => {
      log.verbose('scanArtists', 'processing', root)

      const artists = readFSMetadata(root).map(
        (info) => scan(info, progressGroups),
        { concurrency: 2 }
      ).then(tracksToArtists)

      return artists.then((artists) => [root, artists])
    }
  ).then(report)
}
github othiym23 / packard / src / command / optimize.js View on Github external
export default function optimizeAlbums (
  files = [],
  roots = [],
  blockSize,
  capacity) {
  const entities = files.concat(roots)
  log.enableProgress()
  log.silly('optimizeAlbums', 'entities', entities)
  return scanAlbums(entities)
    .then((albums) => {
      log.disableProgress()
      calculate([...albums], blockSize, capacity)
    })
}
github othiym23 / packard / src / command / audit.js View on Github external
export default function audit (roots) {
  log.silly('audit', 'files', roots)

  log.enableProgress()
  return scanAlbums(roots)
    .then((albums) => {
      log.disableProgress()
      log.silly('audit', 'albums', albums)
      for (let album of albums) {
        const id = album.artist.name + ': ' + album.name + ' /'
        for (let warning of auditAlbum(album)) log.warn('audit', id, warning)
      }
    })
}