Created
August 25, 2019 05:17
-
-
Save dittmaraz/ee1c1fb45a65006836d5036d2bed6667 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
if [ "$#" -ne 1 ]; then | |
echo "Invalid argument count, expected: 1" | |
usage() | |
exit | |
fi | |
PRJNAME="$1" | |
echo "Project name set to: $PRJNAME" | |
mkdir -p "$PRJNAME" | |
cd "$PRJNAME" | |
npm init -y | |
read -p "Enter packages, comma-delimited[ENTER for none]: " PKGS | |
PKGS="$(echo -e "${PKGS}" | tr -d '[:space:]')" # Trim whitespace | |
PKGSARR=$(echo $PKGS|tr "," "\n") | |
for PKG in $PKGSARR | |
do | |
npm i -S "$PKG" | |
done | |
usage() { | |
echo "Usage: mkprj.sh <projectname>" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment