Code Monkey home page Code Monkey logo

webpack-react-workflow's Introduction

Installation

npm install

Workflow

  1. Run webpack-dev-server acting as an asset server with hot module replacement enabled on port 5000:
npm run dev-server
  1. Run an HTTP server on port 5001. This is going to handle your back-end application (e.g. Rails). We have opted for http-server.
npm start
  1. Open http://localhost:5001 in your browser. If you are on OS X you can run:
npm run browse
  1. Make a change in any of your scripts or stylesheets - you should see these changes applied in the browser instantaneously.

  2. Once finished modifying files, get Webpack to compile the bundle(s) into the filesystem.

npm run build

Unit tests and code coverage

We use Mocha, Chai and React's TestUtils package.

npm test

Linting

We use ESLint for JavaScript code style and syntax validation.

npm run lint

Code coverage

We use Istanbul for unit test code coverage reports. But because Istanbul does not currently understand the ECMAScript 6 syntax, we use a tool bridging these two technologies called Isparta. This extension allows us to generate reports for the actual ES6 source, not the ES5-compatible code "transpiled" by Babel.

The actual integration of Isparta with the Karma tests runner is done via a Webpack pre-loader. We have opted for a pre-loader instead of a loaded to clearly separate the coverage generation from other actions that involve various source code transformations. This is 100% arbitrary and the coverage reporter might as well be included in the subsequent loaders step.

Running results on command line

As we have now introduced a React component that depends on the DOM's document object, you won't be able to run the application directly from command line (at least in the current configuration).

Clean project

npm run clean

This will remove contents of dist and tmp/coverage/javascript directories.

webpack-react-workflow's People

Stargazers

 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

webpack-react-workflow's Issues

Add scripts for running application in local environment

We need the following npm scripts defined in the package.json file:

  • starting Webpack development server
  • starting an "application" server; this will have a dependency on Node http-server
  • starting both of them (optional)
  • starting any other service handled by the application

Open-source this project

  • Choose an open source licence
  • Make this GitHub repository public
  • Spread the word on the internets :-)

React Test Utilities Integration

React test utilities brings a lot of convenient tools that makes it easier to test React applications. These utilities are automatically included in Jest but they could also be brought to any testing framework via react/addons module.

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.