Giter Site home page Giter Site logo

calazans10 / create-personal-react-app Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 1.0 146 KB

A thin wrapper around Facebook's create-react-app

License: MIT License

JavaScript 91.03% CSS 8.97%
react redux redux-saga react-router-v4 zero-configuration build-tools

create-personal-react-app's Introduction

Create Personal React App

Build Status dependencies Status npm package npm package

A thin wrapper around Facebook's create-react-app inspired by @Chris Patty's blog post.

Create Personal React App works on macOS, Windows, and Linux.

Quick Overview

npm install -g create-personal-react-app
create-personal-react-app my-app
cd my-app
npm start

Then open http://localhost:3000/ to see your app. When you’re ready to deploy to production, create a minified bundle with npm run build.

Get Started Immediately

You don’t need to install or configure tools like Webpack or Babel.
They are preconfigured and hidden so that you can focus on the code.

Just create a project, and you’re good to go.

Creating an App

You’ll need to have Node >= 6 on your local development machine (but it’s not required on the server). You can use nvm (macOS/Linux) or nvm-windows to easily switch Node versions between different projects.

To create a new app, just run the following command:

create-personal-react-app my-app

It will create a directory called my-app inside the current folder.
Inside that directory, it will generate the initial project structure and install the transitive dependencies:

.
├── README.md
├── node_modules
├── package.json
├── package-lock.json
├── .editorconfig
├── .env
├── .env.dist
├── .env.prod
├── .env.stg
├── .eslintrc.json
├── .gitignore
├── .prettierrc
├── .sass-lint.yml
├── public
│   ├── favicon.ico
│   ├── index.html
│   └── manifest.json
└── src
    ├── app
    |   ├── core
    |   │   └── components
    |   │       ├── modules
    |   |       |   ├── MainContent
    |   |       |   |   ├── index.js
    |   |       |   |   ├── index.scss
    |   |       |   |   └── index.spec.js
    |   |       |   ├── MainHeader
    |   |       |   |   ├── index.js
    |   |       |   |   ├── index.scss
    |   |       |   |   └── index.spec.js
    |   │       |   └── MainNavigation
    |   |       |   |   ├── index.js
    |   |       |   |   ├── index.scss
    |   |       |   |   └── index.spec.js
    |   │       └── pages
    |   |           ├── Home
    |   |           |   ├── index.js
    |   |           |   └── index.spec.js
    |   │           └── NotFound
    |   |               ├── index.js
    |   |               └── index.spec.js
    |   ├── ui
    |   │   ├── actions
    |   │   |   ├── index.js
    |   |   |   └── index.spec.js
    |   │   ├── components
    |   │   |   └── modules
    |   |   |           ├── Loading
    |   |   |           |   ├── index.js
    |   |   |           |   ├── index.scss
    |   |   |           |   └── index.spec.js
    |   │   |           └── Snackbar
    |   |   |               ├── index.js
    |   |   |               ├── index.scss
    |   |   |               └── index.spec.js
    |   │   ├── constants
    |   |   |   └── actionTypes.js
    |   │   ├── reducers
    |   │   |   ├── loading
    |   |   │   |   ├── index.js
    |   |   |   |   └── index.spec.js
    |   │   |   ├── snackbar
    |   |   │   |   ├── index.js
    |   |   |   |   └── index.spec.js
    |   │   |   ├── index.js
    |   |   |   └── index.spec.js
    |   │   ├── sagas
    |   │   |   ├── index.js
    |   |   |   └── index.spec.js
    |   │   ├── selectors
    |   │   |   ├── index.js
    |   |   |   └── index.spec.js
    |   │   └── index.js
    |   ├── user
    |   │   ├── actions
    |   │   |   ├── index.js
    |   |   |   └── index.spec.js
    |   │   ├── api
    |   │   |   ├── index.js
    |   |   |   └── index.spec.js
    |   │   ├── components
    |   │   |   ├── modules
    |   │   |   |       └── UserTable
    |   |   |   |           ├── index.js
    |   |   |   |           ├── index.scss
    |   |   |   |           └── index.spec.js
    |   │   |   └── pages
    |   │   |           └── UserList
    |   |   |               ├── index.js
    |   |   |               └── index.spec.js
    |   │   ├── constants
    |   |   |   └── actionTypes.js
    |   │   ├── reducers
    |   │   |   ├── index.js
    |   |   |   └── index.spec.js
    |   │   ├── sagas
    |   │   |   ├── index.js
    |   |   |   └── index.spec.js
    |   │   ├── selectors
    |   │   |   ├── index.js
    |   |   |   └── index.spec.js
    |   │   └── index.js
    |   └── index.js
    ├── history
    │   └── index.js
    ├── images
    |   ├── closeicon.svg
    │   └── loader.gif
    ├── lib
    │   └── axios.js
    ├── reducers
    |   ├── index.js
    │   └── index.spec.js
    ├── sagas
    │   └── index.js
    ├── store
    |   ├── configureStore.js
    │   └── index.js
    ├── styles
    |   ├── _base.scss
    │   └── _utilities.scss
    ├── index.js
    ├── index.scss
    ├── serviceWorker.js
    └── setupTests.js

No configuration or complicated folder structures, just the files you need to build your app.
Once the installation is done, you can open your project folder:

cd my-app

Inside the newly created project, you can run some built-in commands:

npm start

Runs the app in development mode.
Open http://localhost:3000 to view it in the browser.

The page will automatically reload if you make changes to the code.
You will see the build errors and lint warnings in the console.

npm test

Runs the test watcher in an interactive mode.
By default, runs tests related to files changed since the last commit.

Read more about testing.

npm run build

Builds the app for production to the build folder.
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.

Your app is ready to be deployed.

Naming convention

  • Action Types

    • API related

      export const GET_POSTS_REQUEST = "GET_POSTS_REQUEST";
      export const GET_POSTS_SUCCESS = "GET_POSTS_SUCCESS";
      export const GET_POSTS_FAILURE = "GET_POSTS_FAILURE";
    • Others

      export const LOADING_REQUEST = "LOADING_REQUEST";
      export const LOADING_SHOW = "LOADING_SHOW";
      export const LOADING_HIDE = "LOADING_HIDE";
      export const USERNAME_CHANGE = "USERNAME_CHANGE";
  • Action Creators

    • API related

      export const doRequestGetPosts = () => ({});
      export const doSuccesGetPosts = () => ({});
      export const doFailureGetPosts = () => ({});
    • Others

      export const doRequestLogin = () => ({});
      export const doShowLogin = () => ({});
      export const doHideLogin = () => ({});
      export const doChangeusername = () => ({});
  • Sagas

    export function* handleChangeUsername() {}
    export function* handleRequestLogin() {}
    export function* handleRequestGetPosts() {}
  • Reducers

    const loadingReducer = (state = INITIAL_STATE, action) => {};
    const modalReducer = (state = INITIAL_STATE, action) => {};
    • Helpers

      const applyShowLoading = (state, action) => ({});
      const applyChangeUsername = (state, action) => ({});
    • Combined reducers

      const uiReducer = combineReducers({
        loading: loadingReducer,
        modal: modalReducer
      });
  • Selectors

    • Boolean

      export const isLoadingVisible = ({ ui }) => ui.loading.isVisible;
      export const hasPermission = ({ auth }) => auth.user.hasPermission;
    • Others

      export const getUsername = ({ auth }) => auth.user.username;
  • API

    export const requestGetPosts = () => {};
    export const requestCreatePost = payload => {};
    export const requestGetPost = postId => {};
    export const requestUpdatePost = (postId, payload) => {};
    export const requestDeletePost = postId => {};
  • mapDispatchToProps

    import { doRequestLogin } from "../actions/auth";
    import { doShowLoading } from "../actions/ui";
    
    const mapDispatchToProps = {
      onRequestLogin: doRequestLogin,
      onShowLoading: doShowLoading
    };
    
    export default connect(
      null,
      mapDispatchToProps
    )(Home);

Contribute

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Submit a pull request

License

Create Personal React App is open source software licensed as MIT.

create-personal-react-app's People

Contributors

calazans10 avatar dependabot-preview[bot] avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

thiagoppo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.