Skip to content

Instantly share code, notes, and snippets.

@atlc
Last active December 9, 2021 22:02
Show Gist options
  • Save atlc/0b201277b419ec0e371dde422fb72450 to your computer and use it in GitHub Desktop.
Save atlc/0b201277b419ec0e371dde422fb72450 to your computer and use it in GitHub Desktop.
Boilerplate Batteries Included
function fullstack () {
if [ "$#" -eq 0 ] # If no arguments are provided with the function call just clone the repo as-is
then
git clone git@github.com:covalence-io/barebones-react-typescript-express.git
else
# Clone boilerplate with the first argument as the directory name & cd into that directory
git clone git@github.com:covalence-io/barebones-react-typescript-express.git $1 && cd $1
# Delete the git directory and reinitialize project as a git repo
rm -rf .git && git init
# Create `.env` file and immediately add it to your `.gitignore`
touch .env && echo -n "\n\n# Don't commit your secrets!\n.env" >> .gitignore
# Create Profile and add web script instructions
echo "web: npm run start" >> Procfile
# Read and parse the package.json with `jq` and append a build script to it, outputted to a temp file
cat package.json | jq '.scripts += { "build": "webpack"}' > temp.json
# Output the temp file into the `package.json` and remove the temp file
cat temp.json > package.json && rm temp.json
# Install preexisting dependencies and add in additional starter ones of your own preference here
npm i && npm i bcrypt @types/bcrypt jsonwebtoken @types/jsonwebtoken mysql @types/mysql dotenv @types/dotenv helmet @types/helmet compression @types/compression morgan @types/morgan passport @types/passport passport-local @types/passport-local passport-jwt @types/passport-jwt
# Open up VSCode in this directory
code .
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment