Skip to content
This repository was archived by the owner on Feb 2, 2021. It is now read-only.

Commit fcdf2ae

Browse files
author
Giuseppe Aremare
committed
initial commit
0 parents  commit fcdf2ae

14 files changed

+334
-0
lines changed

.babelrc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"presets": [
3+
"es2015",
4+
"react"
5+
],
6+
"plugins": [
7+
[
8+
"transform-react-remove-prop-types",
9+
{
10+
"mode": "wrap"
11+
}
12+
]
13+
],
14+
"env": {
15+
"start": {
16+
"presets": [
17+
"react-hmre"
18+
]
19+
}
20+
}
21+
}

.bithoundrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"ignore": [
3+
"dist/*.js"
4+
]
5+
}

.editorconfig

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# EditorConfig helps developers define and maintain consistent
2+
# coding styles between different editors and IDEs
3+
# editorconfig.org
4+
5+
root = true
6+
7+
8+
[*]
9+
10+
# Change these settings to your own preference
11+
indent_style = space
12+
indent_size = 2
13+
14+
# We recommend you to keep these unchanged
15+
end_of_line = lf
16+
charset = utf-8
17+
trim_trailing_whitespace = true
18+
insert_final_newline = true
19+
20+
[*.md]
21+
trim_trailing_whitespace = false

.eslintrc.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
module.exports = {
2+
"extends": "airbnb",
3+
"parser": "babel-eslint",
4+
"env": {
5+
"browser": true,
6+
"jasmine": true,
7+
"node": true
8+
},
9+
"plugins": [
10+
"react"
11+
],
12+
"rules": {
13+
"semi": ["error", "never"],
14+
"comma-dangle": ["error", "never"],
15+
"prefer-arrow-callback": 1,
16+
"func-names": 0,
17+
"import/no-extraneous-dependencies": 0,
18+
"no-underscore-dangle": 0,
19+
"no-unused-expressions": 0,
20+
"no-use-before-define": 0,
21+
"react/sort-comp": 0,
22+
"react/no-multi-comp": 0,
23+
"react/require-extension": 0
24+
}
25+
};

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
* text=auto
2+
bin/* eol=lf

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
build/
2+
gh-pages/
3+
dist-modules/
4+
node_modules/
5+
coverage/
6+
npm-debug.log
7+
.eslintcache

.npmignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
demo/
2+
dist/
3+
tests/
4+
src/
5+
.*
6+

.travis.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
language: node_js
2+
node_js:
3+
- "4"
4+
- "5"
5+
- "6"
6+
script:
7+
- npm run test:lint
8+
- npm run test:coverage
9+
after_success:
10+
- bash <(curl -s https://codecov.io/bash)

README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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+
5+
This 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+
11+
Clone the repo : `git clone https://github.com/survivejs/react-component-boilerplate my-component`.
12+
13+
To get started with fresh history, do this:
14+
15+
1. `cd my-component`
16+
2. `rm -rf .git` - Remove Git database
17+
3. `git init` - Initialize a new Git repository
18+
4. `git add .` - Add all files to staging
19+
5. `git commit -am "Initial commit"` - Commit the files
20+
21+
After this you should push the project to some remote.
22+
23+
If 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+
33+
The 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+
42+
The 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
51+
var a = 5;
52+
var b = 10;
53+
54+
// just trying out code highlighting feature here
55+
console.log(a + b);
56+
```
57+
58+
## License
59+
60+
*react-component-boilerplate* is available under MIT. See LICENSE for more details.
61+

lib/post_install.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/* eslint-disable */
2+
// adapted based on rackt/history (MIT)
3+
// Node 0.10+
4+
var execSync = require('child_process').execSync;
5+
var stat = require('fs').stat;
6+
7+
// Node 0.10 check
8+
if (!execSync) {
9+
execSync = require('sync-exec');
10+
}
11+
12+
function exec(command) {
13+
execSync(command, {
14+
stdio: [0, 1, 2]
15+
});
16+
}
17+
18+
stat('dist-modules', function(error, stat) {
19+
// Skip building on Travis
20+
if (process.env.TRAVIS) {
21+
return;
22+
}
23+
24+
if (error || !stat.isDirectory()) {
25+
exec('npm i babel-cli babel-preset-es2015 babel-preset-react');
26+
exec('npm run dist:modules');
27+
}
28+
});

0 commit comments

Comments
 (0)