Code Monkey home page Code Monkey logo

react-boilerplate's Introduction

React Boilerplate (deprecated)

This project is deprecated. Please use Create React App to bootstrap your React projects.

Build Status Test Coverage Code Climate License

A Digia project.

Why do I want this?

As you probably know, there are numerous boilerplates available for React, so you might be wondering why you would want to use ours. Most of the boilerplate projects come with a lot of code that you rarely need. Our boilerplate was bootstrapped with Create React App and provides you with a great starting point for any React project with as few lines of code as possible, especially if you want to use Flowtype.

What do I need to get started?

What's in the box?

How do I use this?

You can find our documentation here.

Usage

Create project

Install create-project and create your project.

yarn global add create-project
create-project my-project digiaonline/react-boilerplate && cd my-project

Install dependencies

Install the project dependencies using Yarn.

yarn

Create the environment

Create your environment by copying the example environment.

cp .env.example .env

Development server

You can start the development server with the start script.

yarn start

Distribution build

You can compile the distribution build with the build script.

yarn build

Test

Test suite

You can run the test suite with the test script.

yarn test

License

MIT

react-boilerplate's People

Contributors

crisu83 avatar dependabot[bot] avatar efueger avatar ericnishio avatar hugovk avatar jonnetanninen avatar kotpes avatar mika-lindell avatar scottschreckengaust avatar vaaralav avatar villeristi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-boilerplate's Issues

Swap Redux for MobX

Let's try to swap out Redux for MobX, because MobX is much easier to get started with and it comes with much less boilerplate than Redux.

Async/await

Async / await is not just for managing promises. It is the way to control synchronous / asynchronous execution on parts of the code.

Note that await may only be used in functions marked with the async keyword.

// with 
function sleep(ms) {
  // Promise here is just to accomplish the sleep functionality
  return new Promise(resolve => setTimeout(resolve, ms));
}
async function bar(x) {
    await sleep(2000); // wait for 2 seconds then return
    return x;
}
// this is incorrect, await is used without function being declared as async, will throw an error
function foo(x) {
    await bar(x);
}
// this is correct
async function foo(x) {
    await bar(x);
}

By marking the function as async,, we are able to use await ( or not ) to control if the functions called inside will be executed in synchronous or asynchronous manner.

// will return 2x after 2 seconds
async function add1(x) {
  var a = bar(x);
  var b = bar(x);
  return await a + await b; 
}

// returns 2x after 4 seconds.
async function add1(x) {
  var a = await bar(x);
  var b = await  bar(x); // starts after a is done
  return a + b;
}

This makes it possible to change the sync/async flow simply by adding or omitting await before the function call.

Update eslint

https://github.com/nordsoftware/react-boilerplate/blob/master/package.json#L45

The current version is causing an error on Code Climate:

/usr/src/app/node_modules/eslint/lib/config/config-validator.js:102
        throw new Error(message.join(""));
        ^

Error: /code/.eslintrc:
	Configuration for rule "eol-last" is invalid:
	Value "always" must be an enum value.

    at validateRuleOptions (/usr/src/app/node_modules/eslint/lib/config/config-validator.js:102:15)
    at /usr/src/app/node_modules/eslint/lib/config/config-validator.js:148:13
    at Array.forEach (native)
    at Object.validate (/usr/src/app/node_modules/eslint/lib/config/config-validator.js:147:35)
    at Object.load (/usr/src/app/node_modules/eslint/lib/config/config-file.js:394:19)
    at loadConfig (/usr/src/app/node_modules/eslint/lib/config.js:74:33)
    at getLocalConfig (/usr/src/app/node_modules/eslint/lib/config.js:177:23)
    at Config.getConfig (/usr/src/app/node_modules/eslint/lib/config.js:272:22)
    at CLIEngine.getConfigForFile (/usr/src/app/node_modules/eslint/lib/cli-engine.js:715:29)
    at module.exports (/usr/src/app/lib/validate_config.js:9:22)

https://codeclimate.com/github/nordsoftware/react-boilerplate/builds/1

Updating eslint should help:
airbnb/javascript#1088 (comment)

Feature wish: react-foundation or similar Foundation integration

While looking for React libs offering Foundation (the Zurb framework for sites) integration I discovered your nice react.foundation component library, then your react-starter template offering a starter template using react-foundation and read that the starter template is deprecated in favor of react-boilerplate here. Indeed the new boilerplate looks very promising. But I was missing react-foundation integration from it. I guess for some people having it directly integrated is nice. One question also interesting for these kinds of people. Is integrating react-foundation or some other approach using Foundation easy with the postcss approach taken here. I've never used postcss before, that's why I ask.

Test coverage is missing

Coverage is set up on Code Climate:
image
https://codeclimate.com/repos/594ad1a56cb63d656e000001/settings/test_reporter

And the CI attempts to send it coverage data:

after_script:
  - codeclimate-test-reporter < coverage/lcov.info

https://github.com/digiaonline/react-boilerplate/blob/master/.travis.yml#L14

But, looking at the last master build, there's no coverage data:

$ codeclimate-[secure]-reporter < coverage/lcov.info
/home/travis/.travis/job_stages: line 57: coverage/lcov.info: No such file or directory

https://travis-ci.org/digiaonline/react-boilerplate/jobs/272035507#L477

Documentation improvements (thoughts)

If we want other folks to use this awesome boilerplate, documentation should to be written and structured in a way that takes through every step (ideally, without jumping back and fourth) to a stage where all the essentials are set up, app is running and user knows where to look for information to proceed.
Right now information is scattered among Table of contents with essential tools and optional tools are mixed together.

  1. Clone project & run these lines to get everything installed
  2. Folder structure with explanation why it's like that and what each file does
  3. How to start the whole thing (with introduction of essential modules/components)
  4. Possible next steps to take
  5. Links to non-essential modules and how can they be used with this boilerplate
    We have most of that information already, it's just fragmented and scattered over docs.
    Ideally, a beginner should be able to set up a project just by reading the doc and have a clear understanding where he/she can find information to proceed

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.