DEV Community

loading...

2020 Bash Scripts for React

Skyler Dowdy
・1 min read

I wrote a few BASH scripts to help in the Git and React World

All instructions are in the README

Bash Scripts

File 1 - Bash Aliases - to make your life easier...

Script 1 - setup-react.sh

  1. Asks for an app name and creates it in the current folder
  2. Installs react-router and react-router-dom
  3. Creates a file / folder structure:
    • configs/AppRouter.jsx
    • configs/PrivateRoute.jsx
    • components/reuse/NavBar.jsx
    • components/pages/Header.jsx
    • components/pages/Footer.jsx
    • pages/user/Home.jsx
    • pages/user/Contact.jsx
    • pages/user/About.jsx
  4. Writes the Routes for the pages and puts content into each of them
  5. Rewrites the App.js file to contain:
    • <Header />
    • <AppRouter />
    • <Footer />
  6. Rewrites index.js to wrap the App component in BrowserRouter

Script 2 - Git Create Branch

  1. Asks for branch name
  2. Creates a new branch
  3. Sets the upstream for the branch

Script 3 -- Git Deploy

  1. Asks for a Commit message
  2. Adds files
  3. Commits files with commit message
  4. Pushes files to current branch as long as the upstream is set

Script 4 - Clean Node Modules

  • Digs down deep to remove node modules folders

Discussion (0)