12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- #!/bin/bash
- script_folder=`dirname $0`
- foldername="$1"
- echo "maker folder $maker_folder"
- echo "folder name $foldername"
- create-react-app $foldername
- cd $foldername
- # add packages
- yarn add react-bootstrap \
- redux react-redux \
- react-router react-router-dom react-router-redux@next \
- rxjs redux-observable
- #TODO: integrate react-router routes https://medium.com/@notrab/getting-started-with-create-react-app-redux-react-router-redux-thunk-d6a19259f71f
- #TODO: integrate react-router-bootstrap https://github.com/react-bootstrap/react-router-bootstrap
- # disable auto-open browser
- sed -i "s_console.log(chalk.cyan('Starting the development server_//console.log(chalk.cyan('Starting the development server_g" node_modules/react-scripts/scripts/start.js
- sed -i 's_openBrowser(_//openBrowser(_g' node_modules/react-scripts/scripts/start.js
- # add to .gitignore
- echo "" >> .gitignore
- echo "*.swp" >> .gitignore
- # add to package.json
- sed -i 's/"name": "/"name": "@catallaxy\//g' package.json
- sed -i 's/"private": true/"private": true,\n "author": "Brandon Wong <wong.brandon@rcgt.com> (https:\/\/www.catallaxy.com\/)"/g' package.json
- # add to index.html
- sed -i "s_<title>React App</title>_<title>$(echo $foldername | sed 's/-client$//g')</title>_" public/index.html
- sed -i 's_ </head>_\n <!-- Bootstrap CSS -->\n <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css">\n <!-- Optional Bootstrap theme -->\n <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap-theme.min.css">\n </head>_' public/index.html
- # copy files
- cp -R $script_folder/* src/
- rm -f src/main.sh
- # delete or move some existing files
- rm -f src/App.js src/App.css src/logo.svg
- mv src/App.test.js src/components/App.test.js
- # initialize git
- git init .
|