Created
February 5, 2023 12:52
-
-
Save danywalls/193e46e42751e209760f29c1d3215b51 to your computer and use it in GitHub Desktop.
example of scaffolding with bash
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 | |
version="1.0" | |
#validate that the user passed the parameter | |
if [ -z "$1" ] | |
then | |
echo "Please add the parameter to script ex: ./scaffold.sh blog" | |
exit | |
fi | |
#get the project name parameter | |
projectName=$1 | |
#set a list of directories to create | |
listOfDirectories="pages components store" | |
# use the angular cli to generate | |
npx -p @angular/cli ng new $projectName | |
cd $projectName | |
cd src | |
echo "Generate directories" | |
#create the list of directories | |
for directory in $listOfDirectories; do | |
mkdir $directory | |
done | |
# initialize git and commit the changes | |
git init | |
git add . | |
git commit -m "basic template" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment