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

redrun

v11.0.5

Published

CLI tool to run multiple npm-scripts fast

Downloads

4,829

Readme

Redrun License NPM version Build Status Coverage Status

CLI tool to run multiple npm-scripts fast. Supports madly comfortable 🏎 Madrun.

Redrun

Install

npm i redrun -g

Usage

Usage: redrun [...tasks] [options] [-- ...args]
Options:
  -p, --parallel          run scripts in parallel
  -s, --series            run scripts in series
  -q, --quiet             do not output result command before execution
  -c, --calm              return zero exit code when command completed with error
  -P, --parallel-calm     run scripts in parallel and return zero exit code
  -S, --series-calm       run scripts in series and return zero exit code
  -h, --help              display this help and exit
  -v, --version           output version information and exit

Completion

You can enable tab-completion of npm scripts similar to npm's completion using:

redrun-completion >> ~/.bashrc
redrun-completion >> ~/.zshrc

You may also pipe the output of redrun-completion to a file such as /usr/local/etc/bash_completion.d/redrun if you have a system that will read that file for you.

How it works

package.json:

{
    "scripts": {
        "one": "npm run two",
        "two": "npm run three",
        "three": "echo 'hello'"
    }
}

Usually these expressions would be executed one after another:

coderaiser@cloudcmd:~/redrun$ npm run one

> [email protected] one /home/coderaiser/redrun
> npm run two


> [email protected] two /home/coderaiser/redrun
> npm run three


> [email protected] three /home/coderaiser/redrun
> echo 'hello'

hello

All these npm run commands that are created are slow, because each time it creates a new process.

redrun makes it faster:

coderaiser@cloudcmd:~/redrun$ redrun one
> echo 'hello'
hello

How to use?

Redrun could be used via the command line, the scripts section of package.json or in a script:

import redrun from 'redrun';

await redrun('one', {
    one: 'npm run two',
    two: 'npm run three',
    three: `echo 'hello'`,
});

// returns
`echo 'hello'`;

await redrun('one', {
    one: 'redrun -p two three',
    two: 'redrun four five',
    three: `echo 'hello'`,
    four: 'jshint lib',
    five: 'jscs test',
});

// returns
`jshint lib && jscs test & echo 'hello'`;

Speed comparison

The less spend time is better:

  • npm-run-all: 1m12.570s
  • npm run && npm run: 1m10.727s
  • redrun: 0m38.312s

Here are logs:

npm-run-all:

coderaiser@cloudcmd:~/redrun$ time npm run speed:npm-run-all

> speed:npm-run-all /home/coderaiser/redrun
> npm-run-all lint:*


> [email protected] lint:jshint /home/coderaiser/redrun
> jshint bin lib test


> [email protected] lint:eslint-bin /home/coderaiser/redrun
> eslint --rule 'no-console:0' bin


> [email protected] lint:eslint-lib /home/coderaiser/redrun
> eslint lib test


> [email protected] lint:jscs /home/coderaiser/redrun
> jscs --esnext bin lib test


real    1m12.570s
user    0m14.431s
sys     0m17.147s

npm run && npm run

coderaiserser@cloudcmd:~/redrun$ time npm run speed:npm-run

[email protected] speed:npm-run /home/coderaiser/redrun
> npm run lint:jshint && npm run lint:eslint-bin && npm run lint:eslint-lib && npm run lint:jscs


> [email protected] lint:jshint /home/coderaiser/redrun
> jshint bin lib test


> [email protected] lint:eslint-bin /home/coderaiser/redrun
> eslint --rule 'no-console:0' bin


> [email protected] lint:eslint-lib /home/coderaiser/redrun
> eslint lib test


> [email protected] lint:jscs /home/coderaiser/redrun
> jscs --esnext bin lib test


real    1m10.727s
user    0m14.670s
sys     0m16.663s

redrun

coderaiser@cloudcmd:~/redrun$ redrun lint:*
> jshint bin lib test && eslint --rule 'no-console:0' bin && eslint lib test && jscs --esnext bin lib test

real    0m38.312s
user    0m8.198s
sys     0m9.113s

As you can see redrun is much faster and more DRY way of using npm scripts than regular solutions.

Related

  • madrun - CLI tool to run multiple npm-scripts in a madly comfortable way.

License

MIT