UNPKG

3.28 kBMarkdownView Raw
1[![build status](https://secure.travis-ci.org/survivejs/react-component-boilerplate.svg)](http://travis-ci.org/survivejs/react-component-boilerplate) [![bitHound Score](https://www.bithound.io/github/survivejs/react-component-boilerplate/badges/score.svg)](https://www.bithound.io/github/survivejs/react-component-boilerplate) [![Dependency Status](https://david-dm.org/survivejs/react-component-boilerplate.svg)](https://david-dm.org/survivejs/react-component-boilerplate)
2
3# react-component-boilerplate - Boilerplate for React.js components
4
5This is a simple boilerplate that has been developed to make it easier to develop React components and small projects.
6
7> Check out [SurviveJS - Webpack and React](http://survivejs.com/) to dig deeper into the topic.
8
9## Basic Usage
10
11Clone the repo : `git clone https://github.com/survivejs/react-component-boilerplate my-component`.
12
13To get started with fresh history, do this:
14
151. `cd my-component`
162. `rm -rf .git` - Remove Git database
173. `git init` - Initialize a new Git repository
184. `git add .` - Add all files to staging
195. `git commit -am "Initial commit"` - Commit the files
20
21After this you should push the project to some remote.
22
23If you want to replace project meta information (author etc.), consider using a tool like [replace-project-meta](https://www.npmjs.com/package/replace-project-meta).
24
25### Common Tasks
26
27* Developing - **npm start** - Runs the development server at *localhost:8080* and use Hot Module Replacement. You can override the default host and port through env (`HOST`, `PORT`).
28* Creating a version - **npm version <x.y.z>** - Updates */dist* and *package.json* with the new version and create a version tag to Git.
29* Publishing a version - **npm publish** - Pushes a new version to npm and updates the project site.
30
31### Testing
32
33The test setup is based on Jest. Code coverage report is generated to `coverage/`. The coverage information is also uploaded to codecov.io after a successful Travis build.
34
35* Running tests once - **npm test**
36* Running tests continuously - **npm run test:watch**
37* Running individual tests - **npm test -- <pattern>** - Works with `test:watch` too.
38* Linting - **npm run test:lint** - Runs ESLint.
39
40### Documentation Site
41
42The boilerplate includes a [GitHub Pages](https://pages.github.com/) specific portion for setting up a documentation site for the component. The main commands handle with the details for you. Sometimes you might want to generate and deploy it by hand, or just investigate the generated bundle.
43
44* Building - **npm run gh-pages** - Builds the documentation into `./gh-pages` directory.
45* Deploying - **npm run deploy-gh-pages** - Deploys the contents of `./gh-pages` to the `gh-pages` branch. GitHub will pick this up automatically. Your site will be available through *<user name>.github.io/<project name>`.
46* Generating stats - **npm run stats** - Generates stats that can be passed to [webpack analyse tool](https://webpack.github.io/analyse/). This is useful for investigating what the build consists of.
47
48## Highlighting Demo for the Site
49
50```js
51var a = 5;
52var b = 10;
53
54// just trying out code highlighting feature here
55console.log(a + b);
56```
57
58## License
59
60*react-component-boilerplate* is available under MIT. See LICENSE for more details.
61