Skip to content

Commit 8aeacfd

Browse files
committed
Merge pull request #22 from nkbt/refresh
Update from react-component-template
2 parents 39d6f95 + 71a0110 commit 8aeacfd

18 files changed

+70
-593
lines changed

.editorconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# editorconfig.org
2+
root = true
3+
4+
[*]
5+
end_of_line = lf
6+
charset = utf-8
7+
trim_trailing_whitespace = true
8+
insert_final_newline = true
9+
indent_style = space
10+
indent_size = 2

.eslintrc

Lines changed: 1 addition & 332 deletions
Large diffs are not rendered by default.

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ pids
1515

1616
/lib/
1717
/example/
18-
/.coveralls.yml
1918
/reports/
2019

2120
/.eslintcache

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2015 Nik Butenko
3+
Copyright (c) 2016 Nik Butenko
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ Can be used as drop-in replacement for `<input type="text" />`
1919
## Installation
2020

2121
### NPM
22-
2322
```sh
2423
npm install --save react react-debounce-input
2524
```
@@ -32,22 +31,6 @@ Don't forget to manually install peer dependencies (`react`) if you use npm@3.
3231
bower install --save https://npmcdn.com/react-debounce-input/bower.zip
3332
```
3433

35-
or in `bower.json`
36-
37-
```json
38-
{
39-
"dependencies": {
40-
"react-debounce-input": "https://npmcdn.com/react-debounce-input/bower.zip"
41-
}
42-
}
43-
```
44-
45-
then include as
46-
```html
47-
<script src="bower_components/react/react.js"></script>
48-
<script src="bower_components/react-debounce-input/build/react-debounce-input.js"></script>
49-
```
50-
5134

5235
### 1998 Script Tag:
5336
```html
@@ -59,7 +42,7 @@ then include as
5942

6043
## Demo
6144

62-
[http://nkbt.github.io/react-debounce-input/example](http://nkbt.github.io/react-debounce-input/example)
45+
[http://nkbt.github.io/react-debounce-input](http://nkbt.github.io/react-debounce-input)
6346

6447
## Codepen demo
6548

@@ -150,15 +133,14 @@ Will result in
150133
## Development and testing
151134

152135
Currently is being developed and tested with the latest stable `Node 5` on `OSX` and `Windows`.
153-
Should be ok with Node 4, but not guaranteed.
154136

155-
To run example covering all `DebounceInput` features, use `npm start`, which will compile `src/example/Example.js`
137+
To run example covering all `DebounceInput` features, use `npm start dev`, which will compile `src/example/Example.js`
156138

157139
```bash
158140
git clone git@github.com:nkbt/react-debounce-input.git
159141
cd react-debounce-input
160142
npm install
161-
npm start
143+
npm start dev
162144

163145
# then
164146
open http://localhost:8080
@@ -167,13 +149,14 @@ open http://localhost:8080
167149
## Tests
168150

169151
```bash
170-
npm test
171-
172-
# to run tests in watch mode for development
173-
npm run test:dev
152+
# to run tests
153+
npm start test
174154

175155
# to generate test coverage (./reports/coverage)
176-
npm run test:cov
156+
npm start test.cov
157+
158+
# to run end-to-end tests
159+
npm start test.e2e
177160
```
178161

179162
## License

bower.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@
2121
"throttle"
2222
],
2323
"authors": [
24-
"Nik Butenko <nik@butenko.me> (http://butenko.me/)"
24+
"Nik Butenko <nik@butenko.me>"
2525
],
2626
"license": "MIT",
2727
"homepage": "https://github.com/nkbt/react-debounce-input",
2828
"dependencies": {
29-
"react": "^0.14"
29+
"react": "^0.14 || ^15"
3030
},
3131
"ignore": [
3232
"**/.*",

circle.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
machine:
22
node:
3-
version: v5.7.1
3+
version: v5.10.1
44

55
test:
66
override:
7-
- $(npm bin)/eslint --debug . --format tap | $(npm bin)/tap-xunit > ${CIRCLE_TEST_REPORTS}/lint.xml && test ${PIPESTATUS[0]} -eq 0
8-
- $(npm bin)/babel-node test | $(npm bin)/tap-xunit > ${CIRCLE_TEST_REPORTS}/test.xml && test ${PIPESTATUS[0]} -eq 0
9-
- NODE_ENV=test $(npm bin)/babel-node $(npm bin)/isparta cover --report text --report lcov --verbose --dir ${CIRCLE_ARTIFACTS}/coverage test/index.js
10-
- REPORT_DIR=${CIRCLE_TEST_REPORTS} LOG_DIR=${CIRCLE_ARTIFACTS} npm run test:e2e -s
7+
- npm start ci.lint
8+
- npm start ci.test
9+
- npm start ci.cov
10+
- npm start ci.e2e
1111

1212
post:
13-
- cat ${CIRCLE_ARTIFACTS}/coverage/lcov.info | $(npm bin)/codecov
13+
- npm start ci.codecov

package.json

Lines changed: 12 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,16 @@
33
"version": "2.3.0",
44
"description": "React component that renders Input with debounced onChange",
55
"main": "lib/index.js",
6+
"config": {
7+
"component": "DebounceInput"
8+
},
69
"scripts": {
7-
"pregh-pages": "git fetch origin",
8-
"gh-pages": "git checkout gh-pages && git rebase origin/master --force-rebase && npm run build && git add . && git commit --amend --no-edit && git push --force && git checkout master",
9-
"build": "parallelshell -w \"npm run build:lib -s\" \"npm run build:ghPages -s\" \"npm run build:dist -s\" \"npm run build:min -s\"",
10-
"prebuild": "rimraf lib example build",
11-
"build:lib": "cross-env NODE_ENV=production babel src --out-dir lib --source-maps --ignore src/example",
12-
"build:ghPages": "cross-env NODE_ENV=production BUILD=ghPages webpack",
13-
"build:dist": "cross-env NODE_ENV=production BUILD=dist webpack",
14-
"build:min": "cross-env NODE_ENV=production BUILD=min webpack",
15-
"prepublish": "parallelshell -w \"npm run build:lib -s\" \"npm run build:dist -s\" \"npm run build:min -s\"",
16-
"start": "cross-env NODE_ENV=development webpack-dev-server",
17-
"test": "cross-env NODE_ENV=test babel-node test",
18-
"test:dev": "cross-env NODE_ENV=test babel-node test | tap-nyan",
19-
"test:cov": "cross-env NODE_ENV=test babel-node node_modules/isparta/bin/isparta cover --report text --report html --report lcov --dir reports/coverage test",
20-
"test:e2e": "cross-env NODE_ENV=development nightwatch-autorun",
21-
"lint": "eslint --cache .",
22-
"precommit": "npm run lint -s",
23-
"prepush": "npm run test -s",
24-
"postversion": "git push --follow-tags"
10+
"start": "p-s --config react-component-template/package-scripts -s",
11+
"test": "npm start test",
12+
"precommit": "npm start precommit",
13+
"prepush": "npm start prepush",
14+
"postversion": "npm start postversion",
15+
"prepublish": "npm start prepublish"
2516
},
2617
"repository": {
2718
"type": "git",
@@ -35,7 +26,7 @@
3526
"debounce",
3627
"throttle"
3728
],
38-
"author": "Nik Butenko <nik@butenko.me> (http://butenko.me/)",
29+
"author": "Nik Butenko <nik@butenko.me>",
3930
"license": "MIT",
4031
"bugs": {
4132
"url": "https://github.com/nkbt/react-debounce-input/issues"
@@ -48,36 +39,7 @@
4839
"lodash.debounce": "^3 || ^4"
4940
},
5041
"devDependencies": {
51-
"babel-cli": "6.8.0",
52-
"babel-core": "6.8.0",
53-
"babel-eslint": "6.0.3",
54-
"babel-loader": "6.2.4",
55-
"babel-plugin-transform-object-rest-spread": "6.8.0",
56-
"babel-plugin-webpack-loaders": "0.4.0",
57-
"babel-preset-es2015": "6.6.0",
58-
"babel-preset-react": "6.5.0",
59-
"codecov.io": "0.1.6",
60-
"cross-env": "1.0.7",
61-
"css-loader": "0.23.1",
62-
"eslint": "2.9.0",
63-
"eslint-loader": "1.3.0",
64-
"eslint-plugin-react": "5.0.1",
65-
"glob": "7.0.3",
66-
"html-webpack-plugin": "2.16.1",
67-
"husky": "0.11.4",
68-
"isparta": "4.0.0",
69-
"json-loader": "0.5.4",
70-
"nightwatch-autorun": "2.3.1",
71-
"parallelshell": "2.0.0",
72-
"react-dom": "15.0.2",
73-
"react": "15.0.2",
74-
"rimraf": "2.5.2",
75-
"sinon": "1.17.4",
76-
"style-loader": "0.13.1",
77-
"tap-nyan": "0.0.2",
78-
"tap-xunit": "1.3.1",
79-
"tape": "4.5.1",
80-
"webpack": "1.13.0",
81-
"webpack-dev-server": "1.14.1"
42+
"p-s": "0.9.0",
43+
"react-component-template": "0.1.2"
8244
}
8345
}

src/DebounceInput.js renamed to src/Component.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import debounce from 'lodash.debounce';
33
import {shouldComponentUpdate} from 'react/lib/ReactComponentWithPureRenderMixin';
44

55

6-
const DebounceInput = React.createClass({
6+
export const DebounceInput = React.createClass({
77
propTypes: {
88
onChange: React.PropTypes.func.isRequired,
99
onKeyDown: React.PropTypes.func,
@@ -142,13 +142,10 @@ const DebounceInput = React.createClass({
142142
return (
143143
<input type="text"
144144
{...props}
145-
value={this.state.value}
146145
onChange={this.onChange}
146+
value={this.state.value}
147147
{...onKeyDown}
148148
{...onBlur} />
149149
);
150150
}
151151
});
152-
153-
154-
export default DebounceInput;

src/example/App/App.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
.container {
1+
.app {
2+
padding: 2em;
23
max-width: 800px;
34
}
45

src/example/App/Controllable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import DebounceInput from '../../DebounceInput';
2+
import DebounceInput from '../..';
33
import css from './App.css';
44

55

src/example/App/Customizable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import DebounceInput from '../../DebounceInput';
2+
import DebounceInput from '../..';
33
import css from './App.css';
44

55

src/example/App/UndoRedo.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import DebounceInput from '../../DebounceInput';
2+
import DebounceInput from '../..';
33
import css from './App.css';
44

55

src/example/App/index.js

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,28 @@ import React from 'react';
22
import Controllable from './Controllable';
33
import Customizable from './Customizable';
44
import UndoRedo from './UndoRedo';
5-
import {name} from '../../../package.json';
65
import css from './App.css';
76

87

9-
const App = React.createClass({
10-
render() {
11-
return (
12-
<div className={css.container}>
13-
<h1>{name}</h1>
8+
const App = () => (
9+
<div className={css.app}>
10+
<h1>react-debounce-input</h1>
11+
<section className={css.section}>
12+
<h2>Example 1. Customizable</h2>
13+
<Customizable />
14+
</section>
1415

15-
<section className={css.section}>
16-
<h2>Example 1. Customizable</h2>
17-
<Customizable />
18-
</section>
16+
<section className={css.section}>
17+
<h2>Example 2. Controllable</h2>
18+
<Controllable />
19+
</section>
1920

20-
<section className={css.section}>
21-
<h2>Example 2. Controllable</h2>
22-
<Controllable />
23-
</section>
24-
25-
<section className={css.section}>
26-
<h2>Example 3. Undo-Redo</h2>
27-
<UndoRedo />
28-
</section>
29-
</div>
30-
);
31-
}
32-
});
21+
<section className={css.section}>
22+
<h2>Example 3. Undo-Redo</h2>
23+
<UndoRedo />
24+
</section>
25+
</div>
26+
);
3327

3428

3529
export default App;

src/index.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
'use strict';
1+
const {DebounceInput} = require('./Component');
22

3-
// Babel6 does not hack the default behaviour of ES Modules anymore, so we should export
4-
const DebounceInput = require('./DebounceInput').default;
53

64
module.exports = DebounceInput;

test-e2e/Smoketest.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
11
'use strict';
22

33

4-
module.exports = {
5-
'Smoketest'(browser) {
6-
browser
7-
.url(`${browser.launchUrl}/`)
8-
.waitForElementVisible('body', 1000)
9-
.assert.containsText('body', require('../package.json').name)
10-
.end();
11-
}
12-
};
4+
module.exports = require('react-component-template/test-e2e/Smoketest');

test/DebounceInput-test.js renamed to test/Component-test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import test from 'tape';
2-
import DebounceInput from '../src/DebounceInput';
2+
import {DebounceInput} from '../src/Component';
3+
34

45
test('DebounceInput', t => {
56
t.ok(DebounceInput instanceof Function, 'should be function');

0 commit comments

Comments
 (0)