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

run-in-parallel

v1.1.0

Published

This is package to run processes in parallel. Most useful use case: to run vite build and typescript type checking in parallel.

Downloads

11

Readme

run-in-parallel npm

Simple utility to run multiple commands in parallel.

Install

npm install --save-dev run-in-parallel
yarn install -D run-in-parallel

Usage

Command line:

run-in-parallel \"comand1 arg1\" \"comand2 arg1 arg2\"

will start comand1 and comand2 with arguments in parallel and will wait for both to finish. If any of the commands fail, the whole process will fail. You will see the output of both commands in the console. Also, you can use run-in-parallel in package.json scripts:

{
  "scripts": {
    "build": "run-in-parallel \"tsc --noEmit\" \"vite build\""
  }
}

This is one of the real use cases when you need to run tsc --noEmit and vite build together. Vite suggests this solution tsc --noEmit && vite build, but it runs sequentially and takes more time than if it were run in parallel. This problem can be solved by using this script.

result of npm run build

> run-in-parallel "tsc --noEmit" "vite build"
node build.mjs "tsc --noEmit" "vite build"

Start: tsc --noEmit
Start: vite build
vite: vite v5.1.0 building for production...

vite: transforming...

✓ tsc: executed successfully!
vite: ✓ 34 modules transformed.

vite: rendering chunks...

vite: computing gzip size...

vite: dist/index.html                   0.46 kB │ gzip:  0.30 kB

vite: dist/assets/react-h3aPdYU7.svg    4.13 kB │ gzip:  2.14 kB
dist/assets/index-4sK4E3Wk.css    1.39 kB │ gzip:  0.72 kB
dist/assets/index-YnIXOLyF.js   143.39 kB │ gzip: 46.11 kB

vite: ✓ built in 509ms

✓ vite: executed successfully!
✅ All commands executed successfully!

Flags

  • --output=inherit - Output messages during the execution of the commands will pipe directly to the console. You will be able to see different output messages from the commands than in default mode. But the problem is that commands will be mixed and layered. In the example below we can see that vite was in the process of transforming but tsc threw the error and mixed with the vite output.
> run-in-parallel --output=inherit "tsc --noEmit" "vite build"

Start: tsc --noEmit
Start: vite build
vite v5.1.0 building for production...
transforming (25) node_modules/react-dom/client.jssrc/App.tsx:7:46 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number | (() => number)'.

7   const [count, setCount] = useState<number>('s')
                                               ~~~


Found 1 error in src/App.tsx:7

In the case of the successful execution you can see the following output:

> run-in-parallel --output=inherit "tsc --noEmit" "vite build"

Start: tsc --noEmit
Start: vite build
vite v5.1.0 building for production...
✓ 34 modules transformed.
dist/index.html                   0.46 kB │ gzip:  0.30 kB
dist/assets/react-h3aPdYU7.svg    4.13 kB │ gzip:  2.14 kB
dist/assets/index-4sK4E3Wk.css    1.39 kB │ gzip:  0.72 kB
dist/assets/index-YnIXOLyF.js   143.39 kB │ gzip: 46.11 kB
✓ built in 489ms
✅ All processes executed successfully!