Created
May 21, 2021 22:23
-
-
Save tomfa/259e3903e924ec64b32aa48e317cd07d to your computer and use it in GitHub Desktop.
Bash script to start any node project.
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
install() { | |
if test -f "package.json"; then | |
if test -f "package-lock.json"; then | |
npm install | |
elif test -f "yarn.lock"; then | |
yarn | |
else | |
echo "warning: no lock file" | |
yarn | |
fi | |
else | |
echo "Missing package.json" | |
fi | |
} | |
alias ins=install |
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
start() { | |
if test -f "package.json"; then | |
if grep -q "\"dev\"" "package.json"; then | |
yarn dev | |
elif grep -q "\"start:dev\"" "package.json"; then | |
yarn start:dev | |
elif grep -q "\"start:all\"" "package.json"; then | |
yarn start:all | |
else | |
yarn start | |
fi | |
else | |
echo "Missing package.json" | |
fi | |
} | |
alias sta=start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment