Skip to content

Instantly share code, notes, and snippets.

@monkpit
Forked from kpittman-securus/build.sh
Created April 28, 2021 23:20
Show Gist options
  • Save monkpit/fd1ee6123902cc934f166775b9285e73 to your computer and use it in GitHub Desktop.
Save monkpit/fd1ee6123902cc934f166775b9285e73 to your computer and use it in GitHub Desktop.
Parallel execution with find and xargs
#! /usr/bin/env bash
find ./src/bookmarklets -name "*.js" -print0 | xargs -I FILE -0 -P "$(nproc)" npm run rollup -- --input "FILE" --file "output/FILE"
# EDIT: Per my latest comment - I now prefer this:
for bookmarklet in ./src/bookmarklets/**/*.js
do
npm run rollup -- --input "$bookmarklet" --file "output/$bookmarklet" &
done
wait
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment