main.sh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/bin/bash
  2. script_folder=`dirname $0`
  3. foldername="$1"
  4. echo "maker folder $maker_folder"
  5. echo "folder name $foldername"
  6. create-react-app $foldername
  7. cd $foldername
  8. # add packages
  9. yarn add react-bootstrap \
  10. redux react-redux \
  11. react-router react-router-dom react-router-redux@next \
  12. rxjs redux-observable
  13. #TODO: integrate react-router routes https://medium.com/@notrab/getting-started-with-create-react-app-redux-react-router-redux-thunk-d6a19259f71f
  14. #TODO: integrate react-router-bootstrap https://github.com/react-bootstrap/react-router-bootstrap
  15. # disable auto-open browser
  16. 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
  17. sed -i 's_openBrowser(_//openBrowser(_g' node_modules/react-scripts/scripts/start.js
  18. # add to .gitignore
  19. echo "" >> .gitignore
  20. echo "*.swp" >> .gitignore
  21. # add to package.json
  22. sed -i 's/"name": "/"name": "@brwong\//g' package.json
  23. sed -i 's/"private": true/"private": true,\n "author": "Brandon Wong <projects@brwong.net> (https:\/\/www.brwong.net\/)"/g' package.json
  24. # add to index.html
  25. sed -i "s_<title>React App</title>_<title>$(echo $foldername | sed 's/-client$//g')</title>_" public/index.html
  26. 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
  27. # copy files
  28. cp $script_folder/App.js $script_folder/epics.js $script_folder/index.js $script_folder/reducers.js $script_folder/store.js src/
  29. # initialize git
  30. git init .