• Stars
    star
    156
  • Rank 239,589 (Top 5 %)
  • Language
    JavaScript
  • Created over 9 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A simple app to try React, ES6 and redux, using topheman-apis-proxy as data api backend

react-es6-redux

Build Status Coverage Status Sauce Test Status

image

This project started as a POC for React and has now become my own sandbox for testing the latest technologies. You'll find documentation across the code, the commits and the READMEs helping you implement the following I'm using:

The development / build / deploy workflow is based on topheman/webpack-babel-starter, which allows to have online both:

  • production version (minified js/css ...)
  • development version (with sourcemaps, so that users could see the original es6 source code, even online, just by opening the sources panel in the devtools console)

Support for Travis CI (see .travis.yml file):

  • builds are tested
  • source code is linted
  • unit tests are run
  • code coverage is sent to coveralls.io
  • e2e tests are run through SauceLabs (a cross-browser automation tool built on top of Selenium WebDriver)

Previous versions (checkout the releases sections):

  • The version without redux remains on the v1.x branch.
  • The version in babel v5 remains on the v2.x branch
  • You can see the isomorphic (universal if you will) version (with server-side rendering) at topheman/react-es6-isomorphic (based on v1 - not yet with redux at this time).

To read further about this project and its evolution:

ONLINE DEMO

Setup

This project now follows the same development workflow as the one explained in topheman/webpack-babel-starter (with some additions, specific to the project).

Install

If you don't have yarn yet, just npm install yarn -g

git clone https://github.com/topheman/react-es6-redux.git
cd react-es6-redux
yarn

Note: Installing the topheman-apis-proxy backend is no longer mandatory (I changed the code so that you could do unauthenticated request to the github API - you will be rate limited to 10 requests per minute though).

Run

Dev mode

You're good to go with hot-reload / redux-devtools / time-travel / sourcemaps ...!

Mock mode

You can also run the app in mock mode (useful for tests):

Build

At the root of the project :

  • npm run build: for debug (like in dev - with sourceMaps and all)
  • npm run build-prod: for production (minified/optimized ...)
  • npm run build-prod-all: both at once in the same build (with redux devtools & sourcemaps on dev version)

A /build/dist folder will be created with your project built in it.

You can run it with npm run serve-build

Test

Unit tests

npm test will launch:

  • linting of /src & /test folders via eslint
  • the unit-tests files are located in /src inside __tests__ folders, named like *.spec.js
  • those tests files are run by karma

This task is launched on pre-commit hook & on Travis CI.

If you wish to generate coverage reports, just npm run karma-coverage (those reports are generated on Travis CI anyway and available on coveralls.io), you will find them in local at /build/reports/coverage.

Note: Unit-tests are run through karma in PhantomJS (the webpack.config.js being injected), they can also be run directly via mocha (see wiki).

End to end tests

e2e tests are located in /test/e2e/spec.

Open two terminal tabs, on each one:

  • npm run webpack-mock: will launch the project in mock mode
  • npm run test-e2e: will run the e2e tests in /test/e2e via protractor against your local server

Those tests are run on Travis CI, via SauceLabs.

Linter

I'm using eslint, based on eslint-config-airbnb, a preset for .eslintrc configuration. For more infos, checkout the release it was implemented: v2.5.0.

  • npm run lint: single run linting of /src & /test folders
  • npm run lint-watch: same in watch mode

Specific commands

You may want some granularity, the DEVTOOLS, SHOW_DEVTOOLS, NODE_ENV & LINTER variables are at your disposal:

  • DEVTOOLS=true npm run build: will build a debug version with the devtools
  • DEVTOOLS=false npm run webpack: will launch a webpack dev server without the devtools (if you find it annoying)
  • LINTER=false npm start (if you don't want to be bothered by the linter - at your own risks! the pre-commit hook will run the linter and the tests anyway)
  • SHOW_DEVTOOLS=false npm start (if you want to hide the redux-devtools - you'll still be able to show them by ctrl+H)
  • DASHBOARD=true npm start: will use webpack-dashboard in dev-server mode
  • ... you can mix and match ;-)

Read the "Advanced tasks" wiki section for more infos ...

With topheman-apis-proxy

This part is optional

topheman-apis-proxy is a proxy that lets you do authenticated requests to github / twitter APIs (that way you have a much higher rate limit). For the install, please follow the installation steps README section.

Then your workflow will be:

  • Open a terminal in the react-es6-redux folder and npm run webpack-dev
  • Open a terminal in the topheman-apis-proxy folder and grunt serve (see more in the run in local README section)
  • Go to http://localhost:8080/

Deploy

I'm using github pages for hosting (free https, easy deploy via git - a good deal since I don't need any server-side logic). You'll find a gh-pages orphan branch where the deployed builds are stored.

My deployment routine is described on the topheman/webpack-babel-starter Wiki.

Notes

License

This software is distributed under an MIT licence.

Copyright 2015-2016 © Christophe Rosset

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. The Software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the Software.

More Repositories

1

vanilla-es6-jspm

Seed project for ES6 / jspm based apps with full production workflow
JavaScript
178
star
2

webpack-babel-starter

Webpack 2 / Babel starter kit with full development & build workflow
JavaScript
103
star
3

npm-registry-browser

Browse the npm registry with an SPA made in React, with full dev workflow.
JavaScript
101
star
4

docker-experiments

Discover docker with a simple use case in development, production (local kubernetes) and CI
JavaScript
96
star
5

topheman-datavisual

Realtime datavisualization with Angular, d3, and nodejs based on Twitter Stream API
JavaScript
77
star
6

twitter-stream-channels

Lets you manage multiple channels of keywords on the same twitter stream
JavaScript
70
star
7

d3-react-experiments

Mix d3 & react
JavaScript
51
star
8

nextjs-movie-browser

A NextJS implementation of the themoviedb.org website
TypeScript
45
star
9

react-es6-isomorphic

A simple app to try React and ES6, using topheman-apis-proxy as data api backend NOW with isomorphism
JavaScript
42
star
10

rxjs-experiments

Playing with RxJS
JavaScript
38
star
11

react-fiber-experiments

Discover the latest features of React fiber like "Suspense"
JavaScript
27
star
12

PanoramaSensorsViewer

Let Google Street View panoramas be browserable via the gyroscope+accelerometer of your mobile device
JavaScript
26
star
13

webassembly-wasi-experiments

Discover WebAssembly System Interface (WASI) with C/Rust use cases
Makefile
24
star
14

rust-wasm-experiments

Discover how to use Rust to generate WebAssembly, called by JavaScript
JavaScript
20
star
15

nextjs-github-browser

Browse github through a website made in NextJS
TypeScript
19
star
16

bevy-rust-wasm-experiments

🦀 A small video game developed in Rust with Bevy framework targeting both desktop and WebAssembly (browser)
Rust
19
star
17

angular2-sandbox

Mixing Angular2 and RxJS, using @ngrx/store for state management and Webpack for bundling
TypeScript
15
star
18

my-react-app-starter

eslint/prettier/other pre-configured and customisable create-react-app project
JavaScript
11
star
19

Ball.js

Ball.js is a Javascript class that handles physics interactions between balls (i.e. collisions) on a flat area as well as rendering.
JavaScript
10
star
20

webrtc-remote-control

Thin abstraction layer above peerjs that will let you be more productive at making WebRTC data channels based apps.
JavaScript
10
star
21

playground2

An experiment with socket.io and accelerometer (control your desktop with multiple mobile devices)
JavaScript
8
star
22

bombs

HTML5 / Javascript game that takes advantage of the canvas element and the accelerometer on your device.
JavaScript
7
star
23

gopher-ball

Video game made in golang, based on sdl2 bindings
Go
6
star
24

webrtc-experiments

An example of how you could use WebRTC on the web, based on the PeerJS library
JavaScript
5
star
25

sensorsChecker.js

Mostly all recent browsers expose an api for deviceorientation and devicemotion events. This module will let you check if there is really an accelerometer+gyroscope to rely on.
JavaScript
5
star
26

lite-router

A very light router based on history package
JavaScript
4
star
27

squares

An adaptation in HTML5/Javascript - based on the memories I have, of a game I used to play in the 90s on our IIvi (our first color computer).
JavaScript
4
star
28

topheman-apis-proxy

Access your public APIs on the same server, benefite from the existing proxies developed or create yours.
JavaScript
4
star
29

cycle-infos

AngularJS side project made up with the yeoman angular fullstack. Find out the availability of bikes and bike's stands of the JCDecaux self-service bikes
JavaScript
4
star
30

threejs-cone

A little test on threejs ...
JavaScript
3
star
31

BabylonJSFirstSteps

You will find here my first steps on BabylonJS. Those are only tests ...
JavaScript
3
star
32

rustlang-first-try

Starting out in rust
Rust
2
star
33

m102-notes

My general notes taken on the fly while watching the M102 for DBA courses
Shell
2
star
34

Array.foreachLoopBack.js

Loop from any index to any other in your array, looping back at the end of it without bothering about indexes
JavaScript
1
star
35

rust-wasm-examples

JavaScript
1
star
36

my-docker-fullstack-project

1
star
37

SoftLogger

Simple logger that overrides console.log and let's you inject it in a canvas
JavaScript
1
star
38

angular-yeoman-sass-compass

Playing with AngularJS, Yeoman, Grunt, Bower and Karma ...
JavaScript
1
star
39

delay-proxy

Delay specific requests with custom delay - perfect for development
JavaScript
1
star
40

webRtcFirstSteps

JavaScript
1
star
41

HighScoresManager.js

Simlple high scores manager with localStorage
JavaScript
1
star
42

build-free-boilerplate

Simple boilerplate, without any build pipeline, for practice and teaching purpose.
JavaScript
1
star
43

conventional-changelog-angular-loose

conventional-changelog angular config (for those who missed the colon)
JavaScript
1
star