Run Create React App, removing extras.
This assumes several things:
- You are running oh-my-zsh
- You have the
code
shell command installed to launch VS Code - You have
npx
- I used this with
yarn
- Probably some other stuff
Clone the repo into your oh-my-zsh custom plugins:
git clone https://github.com/AnthonyMedina/cra.git $ZSH/custom/plugins/cra
Add this cra
to the plugins array in your .zshrc
:
plugins=(... cra)
Source your .zshrc
to register the changes:
source ~/.zshrc
if [[ -z $1 ]]; then
echo "Please provide a name for your app"
exit
fi
npx create-react-app $1 $2
rm -rf "$1/src/"
templates="$ZSH/custom/plugins/cra/templates"
if [[ $2 == "--typescript" ]]; then
cp -rf "$templates/typescript/." $1
else
cp -rf "$templates/standard/." $1
fi
code $1
cd $1
git mv -f "src/App.js" "src/app.js"
git mv -f "src/App.css" "src/app.css"
git add .
git commit -m 'use custom templates'
cd ..
I take no responsibility for this