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

Commit b409e6f

Browse files
authored
Merge pull request #47 from FormidableLabs/add-contribution-guide-scripts
Add contribution guide scripts
2 parents 65a76bc + 055209f commit b409e6f

File tree

10 files changed

+62
-19
lines changed

10 files changed

+62
-19
lines changed

.travis.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
language: node_js
2+
3+
node_js:
4+
- "4"
5+
- "6"
6+
- "8"
7+
8+
branches:
9+
only:
10+
- master
11+
12+
script:
13+
- npm run lint
14+
- npm run build
15+
- npm run umd

CONTRIBUTING.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Thanks for contributing!
2+
3+
## Development
4+
5+
### Installing dependencies
6+
7+
```bash
8+
npm install
9+
```
10+
11+
### Demo
12+
13+
You can run the demo locally by simply doing `npm start`; this will start the demo at `http://localhost:3000`.
14+
15+
### Linting
16+
17+
Before commiting any changes, be sure to do `npm run lint`; this will lint all relevant files using [ESLint](http://eslint.org/) and report on any changes that you need to make. You can also run `npm run lint-fix` to fix most common lint errors automatically.
18+
19+
## Releasing a new version to NPM (only for project administrators):
20+
21+
1. Run `npm version patch` (or `minor`, `major` as appropriate) to lint and build the `lib` and `umd` directories.
22+
2. Run `npm publish` and publish to NPM if all is well.
23+
3. Run `git push && git push --tags`

package.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@
1212
"start": "webpack-dev-server --hot --inline --port 3000 --config webpack.config.dev.js --content-base demo/",
1313
"build": "babel src -d lib --copy-files",
1414
"clean": "rimraf dist",
15+
"clean-build": "rimraf lib",
1516
"clean-umd": "rimraf umd",
1617
"copy-assets": "cp -a demo/assets/. dist/assets",
1718
"copy-html-css": "cp -a demo/index.html dist/index.html && cp -a demo/index.css dist/index.css",
1819
"dist": "npm run clean && webpack && npm run copy-assets && npm run copy-html-css",
19-
"lint": "eslint src demo --fix",
20-
"umd": "npm run clean-umd && webpack --config webpack.config.umd.js"
20+
"lint": "eslint src demo",
21+
"lint-fix": "eslint src demo --fix",
22+
"umd": "npm run clean-umd && webpack --config webpack.config.umd.js",
23+
"preversion": "npm run lint",
24+
"version": "npm run clean-build && npm run build && npm run umd"
2125
},
2226
"author": "Ken Wheeler",
2327
"license": "MIT",
@@ -48,9 +52,10 @@
4852
"postcss-loader": "^2.0.6",
4953
"prop-types": "^15.5.10",
5054
"raw-loader": "^0.5.1",
51-
"react": "^16.0.0",
52-
"react-dom": "^16.0.0",
55+
"react": "16.0.0",
56+
"react-dom": "16.0.0",
5357
"react-hot-loader": "^3.0.0-beta.2",
58+
"react-native": "0.50.4",
5459
"rimraf": "^2.5.4",
5560
"style-loader": "^0.19.0",
5661
"webpack": "^3.6.0",

src/components/body.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,14 @@ export default class Body extends Component {
7979
constructor(props, context) {
8080
super(props);
8181

82-
const { args, children, shape, ...options } = props;
82+
const { args, children, shape, ...options } = props; // eslint-disable-line no-unused-vars
8383

8484
this.body = Bodies[shape](...args, options);
8585
World.addBody(context.engine.world, this.body);
8686
}
8787

8888
componentWillReceiveProps(nextProps) {
89-
const { args, children, shape, ...options } = nextProps;
89+
const { args, children, shape, ...options } = nextProps; // eslint-disable-line no-unused-vars
9090

9191
Object.keys(options).forEach((option) => {
9292
if (option in this.body && this.props[option] !== nextProps[option]) {

src/native/components/body.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,14 @@ export default class Body extends Component {
7979
constructor(props, context) {
8080
super(props);
8181

82-
const { args, children, shape, ...options } = props;
82+
const { args, children, shape, ...options } = props; // eslint-disable-line no-unused-vars
8383

8484
this.body = Bodies[shape](...args, options);
8585
World.addBody(context.engine.world, this.body);
8686
}
8787

8888
componentWillReceiveProps(nextProps) {
89-
const { args, children, shape, ...options } = nextProps;
89+
const { args, children, shape, ...options } = nextProps; // eslint-disable-line no-unused-vars
9090

9191
Object.keys(options).forEach((option) => {
9292
if (option in this.body && this.props[option] !== nextProps[option]) {

src/native/components/loop.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default class Loop extends Component {
4040

4141
render() {
4242
const defaultStyles = {
43-
flex: 1
43+
flex: 1,
4444
};
4545
const styles = { ...defaultStyles, ...this.props.style };
4646
return (

src/native/components/sprite.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ export default class Sprite extends Component {
111111
position: 'absolute',
112112
transform: [
113113
{ translateX: left * -1 },
114-
{ translateY: top * -1 }
115-
]
114+
{ translateY: top * -1 },
115+
],
116116
};
117117
}
118118

@@ -123,7 +123,7 @@ export default class Sprite extends Component {
123123
width: this.props.tileWidth,
124124
overflow: 'hidden',
125125
position: 'relative',
126-
transform: [{scale: scale}]
126+
transform: [{ scale }],
127127
};
128128
}
129129

src/native/components/stage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export default class Stage extends Component {
7070

7171
getWrapperStyles() {
7272
return {
73-
flex: 1
73+
flex: 1,
7474
};
7575
}
7676

src/native/components/tile-map.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ export default class TileMap extends Component {
88
static propTypes = {
99
columns: PropTypes.number,
1010
layers: PropTypes.array,
11-
sourceWidth: PropTypes.number.isRequired,
1211
renderTile: PropTypes.func,
1312
rows: PropTypes.number,
1413
scale: PropTypes.number,
14+
sourceWidth: PropTypes.number.isRequired,
1515
src: PropTypes.number,
1616
style: PropTypes.object,
1717
tileSize: PropTypes.number,
@@ -117,7 +117,7 @@ export default class TileMap extends Component {
117117
overflow: 'hidden',
118118
position: 'absolute',
119119
top,
120-
left: left,
120+
left,
121121
};
122122
}
123123

src/native/components/world.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import React, { Component } from 'react';
22
import PropTypes from 'prop-types';
33

4-
import {View} from 'react-native';
4+
import { View } from 'react-native';
55

6-
import Matter, {Engine, Events} from 'matter-js';
6+
import Matter, { Engine, Events } from 'matter-js';
77

88
export default class World extends Component {
99
static propTypes = {
@@ -54,15 +54,15 @@ export default class World extends Component {
5454
this.loopID = null;
5555
this.lastTime = null;
5656

57-
const world = Matter.World.create({gravity: props.gravity});
57+
const world = Matter.World.create({ gravity: props.gravity });
5858

5959
this.engine = Engine.create({
6060
world,
6161
});
6262
}
6363

6464
componentWillReceiveProps(nextProps) {
65-
const {gravity} = nextProps;
65+
const { gravity } = nextProps;
6666

6767
if (gravity !== this.props.gravity) {
6868
this.engine.world.gravity = gravity;

0 commit comments

Comments
 (0)