Created
December 24, 2017 23:04
-
-
Save kheob/9491c5038db2b9eb61560e72ccdccd48 to your computer and use it in GitHub Desktop.
Generates a React TypeScript 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
echo "React project name: " | |
read project_name | |
if [ -d "$project_name" ]; then | |
echo "Project already exists." | |
elif [ -z "$project_name" ]; then | |
echo "You didn't enter a name." | |
else | |
create-react-app $project_name --scripts-version=react-scripts-ts | |
cd $project_name | |
npm install --save node-sass-chokidar npm-run-all redux react-redux @types/react-redux redux-logger @types/redux-logger | |
mv src/App.css src/App.scss && mv src/index.css src/index.scss | |
git init | |
GREEN='\033[0;32m' | |
NC='\033[0m' # No Color | |
echo '' | |
echo ${GREEN}Replace \"scripts\" in package.json with:${NC} | |
echo '' | |
echo '"scripts": {' | |
echo ' "build-css": "node-sass-chokidar --include-path ./src --include-path ./node_modules src/ -o src/",' | |
echo ' "watch-css": "npm run build-css && node-sass-chokidar --include-path ./src --include-path ./node_modules src/ -o src/ --watch --recursive",' | |
echo ' "start-js": "react-scripts-ts start",' | |
echo ' "start": "npm-run-all -p watch-css start-js",' | |
echo ' "build-js": "react-scripts-ts build",' | |
echo ' "build": "npm-run-all build-css build-js",' | |
echo ' "test": "react-scripts-ts test --env=jsdom",' | |
echo ' "eject": "react-scripts-ts eject"' | |
echo '}' | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment