Created
August 6, 2023 13:28
-
-
Save wojpawlik/e297c5b8e9fa795dfb4d0a9a57cfb7f0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -eu | |
export PATH="$PWD/node_modules/.bin:$PATH" | |
name="$1" | |
shift | |
args="${*@Q}" | |
if cmd="$(jq --raw-output --exit-status --arg name "pre$name" '.scripts[$name]' package.json)"; then | |
echo "> $cmd" | |
eval "$cmd" | |
fi | |
cmd="$(jq --raw-output --exit-status --arg name "$name" '.scripts[$name]' package.json)" | |
echo "> $cmd $args" | |
eval "$cmd $args" | |
if cmd="$(jq --raw-output --exit-status --arg name "post$name" '.scripts[$name]' package.json)"; then | |
echo "> $cmd" | |
eval "$cmd" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment