Git Product home page Git Product logo

jingzhou123 / cra-template-typescript-redux Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alexandr-g/cra-template-typescript-redux

0.0 1.0 0.0 1.4 MB

Create React App template with Redux, TypeScript, React Router, Enzyme and custom ESlint

Home Page: https://cra-template-typescript-redux.now.sh

License: MIT License

HTML 15.38% TypeScript 65.96% CSS 3.66% Dockerfile 0.47% JavaScript 14.53%

cra-template-typescript-redux's Introduction

npm version Action status semantic-release npm downloads

A quick start Redux + TypeScript Create React App template

An opinionated quick start Create React App (CRA) template with configured Redux, TypeScript, React Router, Enzyme and custom ESlint configuration.

Original Create React App README available here

Usage

npx create-react-app your-project-name --template typescript-redux

Or

yarn create react-app your-project-name --template typescript-redux

npx command installs the most recent stable version of CRA from npm.

--template parameter points to this template, note that cra-template- prefix is omitted.

Motivation

You know the pain. You start a new project from scratch and need to configure it again and again. It needs routing, ok you setup Router, then you need Redux - ok, oh 😩Redux boilerplate is taking so much time to type. Wait... what if you could have all the tools you want just from the beginning? I want to focus on building amazing projects and not spending hours configuring. That's why I've created this template. It's here for you to use.

Available Scripts

In the project directory, you can run:

  • yarn start - runs the app in the development mode. Open http://localhost:3000 to view it in the browser.

  • yarn test - launches the test runner in the interactive watch mode.

  • yarn build - builds the app for production to the build folder.

  • yarn eject - exposes content of react-script package

  • yarn lint - lints project files according to eslint rules, see below. Typical use case: continuous integration environments, Travis, CircleCI, etc.

  • yarn fix - same as yarn lint, but also fixes errors, when possible. Typical use case: local development environment, git hooks.

Due to CRA template limitations (we can change only scripts and dependencies inside generated package.json) all configuration is done by adding config files where possible. Also no devDependencies for now, sorry.

Redux configuration

The template provides basic Redux configuration with feature based folder structure. You can use Redux devtools browser extension. Sample feature included in src/features folder, note technology agnostic features folder name. Based on Redux maintainers recommendation.

Testing

Testing is done with Enzyme.

I added prettier to force consistent formatting. Don't like trailing semicolons? Feel free to tweak prettier rules inside .prettierrc file to match your code style.

Styles/CSS/Styling

Just for the styling purpose of the example app, I used Materialize. The template is shipped with the Materialize by default. I want to make sure that this template is style agnostic so you can plugin any CSS-in-JS or whatever library/framework you want to use for styles on your own.

How to remove materialize

In order to remove Materialize MaterializeCSS navigate to the public folder, open index.html and remove following CDN link in the <head> lines 18-22:

<!--Import materialize.css-->
<link
  rel="stylesheet"
  href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css"
/>

Remove or adjust all the classNames related to the Materialize and feel free to use your own styling.

Eslint configurations

The template extends CRA ESLint rules with a custom set, tailored for the reasonable and clean development process.

Eslint rules are commented for your convenience feel free to tweak or remove them inside .eslintrc. No judgment.

How to create custom Create React App (CRA) templates

I created a step by step guide on how to create your own templates. Check it

View on Medium

View blog post

Thank you

I hope this template will be helpful for you and you will love using it πŸ’–!

cra-template-typescript-redux's People

Contributors

alexandr-g avatar dependabot[bot] avatar renovate-bot avatar renovate[bot] avatar semantic-release-bot avatar

Watchers

 avatar

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.