React is at active development state now. So, it updates very often. It will be very correctly to use available generators, instead of static ("boilerplate") template. This vill provide us ability to stay up-to-date with latest React development metodology.
There is short definition:
Yeoman generator for ReactJS - lets you quickly set up a project including karma test runner and Webpack module system.
Generator-React-Webpack will help you build new React projects using modern technologies.
Out of the box it comes with support for:
- Webpack
- ES2015 via Babel-Loader
- Different supported style languages (sass, scss, less, stylus)
- Style transformations via PostCSS
- Automatic code linting via esLint
- Ability to unit test components via Karma and Mocha/Chai
# Make sure both is installed globally
npm install -g yo
npm install -g generator-react-webpack
# Create a new directory, and `cd` into it:
mkdir my-new-project && cd my-new-project
# Run the generator
yo react-webpack
Please make sure to edit your newly generated package.json
file to set description, author information and the like.
The following commands are available in your project:
# Start for development
npm start # or
npm run serve
# Start the dev-server with the dist version
npm run serve:dist
# Just build the dist version and copy static files
npm run dist
# Run unit tests
npm test
# Lint all files in src (also automatically done AFTER tests are run)
npm run lint
# Clean up the dist directory
npm run clean
# Just copy the static assets
npm run copy
npm test
or node node_modules/.bin/mocha