npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

bucketlist

v0.1.2

Published

Node task runner of async jobs with nice interface

Downloads

3

Readme

bucketlist

build status Coverage Status

Simple async task (promise) runner for node with a nice interface

Example flow: Things to do

(the remaining "50 places" is an artifact in the gif, doesn't actually show up like that)

Parallel tasks Parallel

Installation

$ npm install --save bucketlist

Usage

Go take a look at the examples, probably clearer that way

const bucketlist = require('bucketlist')

bucketlist([
  task1,
  task2
], config)
.then((data) => {
  console.log('done', data)
})
.catch((error) => {
  console.error('error', error)
})

Tasks is an array of tasks to run, each of them being run in sequence. If a single task fails execution stops there.

The return value is a promise that resolves with data (more on that later) or rejects on first failed task

Tasks can also contain arrays which are processed in parallel. Here series2 waits for series1 to finish, then runs all the parallel tasks in parallel and finally runs series3

bucketlist([
  series1,
  series2,
  [
    parallel1,
    parallel2,
    parallel3
  ],
  series3
])

Task definition

A task is a simple JavaScript object that should have two properties: name and run + an optional id.

name is as you might expect what shows up in the UI. Put whatever you want there.

run is a function that gets executed when the task should run. It should return a promise. The signature is:

function run (log, data) {
  // return promise or value
}

You can return a value directly too (so it acts synchronously) however that's a bit pointless..

Logging

The first argument passes to run is a function you can call to log out extra information. Call it with something and that will show up next to the task in the runner.

Calling log(<0-1>) (with a number, 0-1) will output a percentage (0-100%). If you want to log 0.5 and not have it become 50% use toString().

Data

The second argument is a data object that becomes populated if the the task had an id.

const task1 = {
  name: 'Sets data',
  id: 'setData',
  run: (log, data) => {
    return Promise.resolve({ meaningOfLife: 42 })
  }
}

const task2 = {
  name: 'Wants data',
  run: (log, data) => {
    // data.setData.meaningOfLife is now 42
  }
}

bucketlist([task1, task2])

Don't modify data directly, return a value when resolving the promise instead.