Last active
May 23, 2017 11:40
-
-
Save mohayonao/28ca88f64dddb575948c95a6dbd9a222 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/sh | |
cmd="" | |
arg=$* | |
if [ -z "$cmd" ]; then | |
if [[ $1 =~ (^|\/)test\/.+\.js$ ]]; then | |
if [[ $(npm run) =~ ( test ) ]]; then | |
cmd="npm run test" | |
arg="-- $*" | |
fi | |
fi | |
fi | |
if [ -z "$cmd" ]; then | |
if [ -f "$(npm bin)/../../.babelrc" ]; then | |
if [ -f "$(npm bin)/babel-node" ]; then | |
cmd="$(npm bin)/babel-node" | |
elif [ -f "$(which babel-node)" ]; then | |
cmd="$(which babel-node)" | |
fi | |
fi | |
fi | |
if [ -z "$cmd" ]; then | |
cmd="node" | |
fi | |
$cmd $arg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment