Skip to content
/ pkgrun Public

🏃 Run multiple package.json scripts with one command.

License

Notifications You must be signed in to change notification settings

reggi/pkgrun

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pkgrun

Run multiple package.json scripts with one command. pkgrun allows you to select scripts to run in package.json with a glob pattern. Basically npm run with glob support!

Turn this:

npm run soup-clam && npm run soup-cream && npm run soup-mushroom

Into this:

pkgrun 'soup-*'

Normally you want to have each command in it's own line, tucked away with it's own property, and you want to use && to concat multiple operations together. This can get really messy really fast.

{
  "soup": "npm run soup-clam && soup-cream && soup-mushroom",
  "soup-clam": "echo 'clam soup'",
  "soup-cream": "echo 'cream soup'",
  "soup-mushroom": "echo 'cream mushroom'"
}

Now you can just write:

{
  "soup": "pkgrun 'soup*'",
  "soup-clam": "echo 'clam soup'",
  "soup-cream": "echo 'cream soup'",
  "soup-mushroom": "echo 'cream mushroom'"
}

The command pkgrun 'soup*' will go into your package.json and pull all of the scripts starting with soup (in the order they are in) and execute them one by one.

Glob Reminder

Most shells use glob patterns to select files and send the matched files to a command. If you have a file soup-file.js in your working directory then pkgrun soup* (note that the argument is not in quotes) will return No package script match found: soup-file.js. If theres a glob pattern in the argument should encapsulated in quotes.

About

🏃 Run multiple package.json scripts with one command.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published