Skip to content

Commit 686a7b4

Browse files
authored
Merge pull request #82 from nkbt/refresh
Refresh
2 parents 1d8f15f + e0b0ae8 commit 686a7b4

File tree

9 files changed

+1651
-1464
lines changed

9 files changed

+1651
-1464
lines changed

.babelrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"presets": [
3-
"es2015",
3+
"env",
44
"react"
55
],
66
"plugins": [

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ version: 2
33

44
jobs:
55
build:
6-
working_directory: ~/react-debounce-input
6+
working_directory: ~/app
77
docker:
8-
- image: circleci/node:8
8+
- image: circleci/node:8.4.0
99
- image: selenium/standalone-firefox:3.4.0
1010

1111
steps:

README.md

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
[![Gitter](https://img.shields.io/gitter/room/nkbt/help.svg?style=flat-square)](https://gitter.im/nkbt/help)
44

55
[![CircleCI](https://img.shields.io/circleci/project/nkbt/react-debounce-input.svg?style=flat-square&label=nix-build)](https://circleci.com/gh/nkbt/react-debounce-input)
6-
[![Coverage](https://img.shields.io/codecov/c/github/nkbt/react-debounce-input.svg?style=flat-square)](https://codecov.io/github/nkbt/react-debounce-input?branch=master)
76
[![Dependencies](https://img.shields.io/david/nkbt/react-debounce-input.svg?style=flat-square)](https://david-dm.org/nkbt/react-debounce-input)
87
[![Dev Dependencies](https://img.shields.io/david/dev/nkbt/react-debounce-input.svg?style=flat-square)](https://david-dm.org/nkbt/react-debounce-input#info=devDependencies)
98

@@ -17,22 +16,17 @@ Can be used as drop-in replacement for `<input type="text" />` or `<textarea />`
1716
## Installation
1817

1918
### NPM
19+
2020
```sh
2121
npm install --save react react-debounce-input
2222
```
2323

2424
Don't forget to manually install peer dependencies (`react`) if you use npm@3.
2525

2626

27-
### Bower:
28-
```sh
29-
bower install --save https://unpkg.com/react-debounce-input/bower.zip
30-
```
31-
32-
3327
### 1998 Script Tag:
3428
```html
35-
<script src="https://unpkg.com/react/dist/react.js"></script>
29+
<script src="https://unpkg.com/react@16.0.0/umd/react.production.min.js"></script>
3630
<script src="https://unpkg.com/react-debounce-input/build/react-debounce-input.js"></script>
3731
(Module exposed as `DebounceInput`)
3832
```
@@ -44,20 +38,18 @@ bower install --save https://unpkg.com/react-debounce-input/bower.zip
4438

4539
## Codepen demo
4640

47-
[http://codepen.io/nkbt/pen/VvmzLQ](http://codepen.io/nkbt/pen/VvmzLQ?editors=101)
41+
[http://codepen.io/nkbt/pen/VvmzLQ](http://codepen.io/nkbt/pen/VvmzLQ?editors=0010)
4842

4943
## Usage
5044
```js
5145
import React from 'react';
5246
import ReactDOM from 'react-dom';
53-
import DebounceInput from 'react-debounce-input';
47+
import {DebounceInput} from 'react-debounce-input';
5448

55-
const App = React.createClass({
56-
getInitialState() {
57-
return {
58-
value: ''
59-
};
60-
},
49+
class App extends React.Component {
50+
state = {
51+
value: ''
52+
};
6153

6254
render() {
6355
return (
@@ -71,7 +63,7 @@ const App = React.createClass({
7163
</div>
7264
);
7365
}
74-
});
66+
}
7567

7668
const appRoot = document.createElement('div');
7769
document.body.appendChild(appRoot);
@@ -185,6 +177,9 @@ yarn lint
185177
yarn test
186178

187179
# to run end-to-end tests
180+
# first, run `selenium/standalone-firefox:3.4.0` docker image
181+
docker run -p 4444:4444 selenium/standalone-firefox:3.4.0
182+
# then run test
188183
yarn e2e
189184
```
190185

bower.json

Lines changed: 0 additions & 38 deletions
This file was deleted.

package.json

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44
"description": "React component that renders Input with debounced onChange",
55
"main": "lib/index.js",
66
"config": {
7-
"component": "DebounceInput"
7+
"component": "DebounceInput",
8+
"externals": {
9+
"react": "React",
10+
"react-dom": "ReactDOM"
11+
}
812
},
913
"scripts": {
1014
"build": "scripts/build.js",
@@ -17,7 +21,9 @@
1721
"pub": "scripts/pub.js",
1822
"test": "scripts/test.js",
1923
"prepublish": "yarn build",
20-
"postversion": "git push --follow-tags"
24+
"postversion": "git push --follow-tags",
25+
"nuke": "rm -rf node_modules yarn.lock",
26+
"postnuke": "yarn install"
2127
},
2228
"repository": {
2329
"type": "git",
@@ -38,23 +44,23 @@
3844
},
3945
"homepage": "https://github.com/nkbt/react-debounce-input",
4046
"peerDependencies": {
41-
"react": ">=15.3"
47+
"react": "^15.3.0 || ^16.0.0"
4248
},
4349
"dependencies": {
4450
"lodash.debounce": "^4",
4551
"prop-types": "^15"
4652
},
4753
"devDependencies": {
4854
"babel-cli": "^6.24.1",
49-
"babel-eslint": "^7.2.3",
55+
"babel-eslint": "^8.0.1",
5056
"babel-loader": "^7.1.1",
5157
"babel-plugin-transform-class-properties": "^6.24.1",
5258
"babel-plugin-transform-object-rest-spread": "^6.23.0",
5359
"babel-plugin-transform-react-remove-prop-types": "^0.4.8",
5460
"babel-preset-env": "^1.6.0",
55-
"babel-preset-es2015": "^6.24.1",
5661
"babel-preset-react": "^6.24.1",
5762
"babel-register": "^6.24.1",
63+
"babili-webpack-plugin": "^0.1.2",
5864
"css-loader": "^0.28.4",
5965
"eslint": "^4.4.0",
6066
"eslint-config-airbnb": "^15.1.0",
@@ -66,12 +72,12 @@
6672
"finalhandler": "^1.0.4",
6773
"gh-pages": "^1.0.0",
6874
"glob": "^7.1.2",
69-
"html-webpack-include-assets-plugin": "^0.0.7",
75+
"html-webpack-include-assets-plugin": "^1.0.0",
7076
"html-webpack-plugin": "^2.30.1",
7177
"nightwatch": "^0.9.16",
7278
"portfinder": "^1.0.13",
73-
"react": "^15.6.1",
74-
"react-dom": "^15.6.1",
79+
"react": "^16.0.0",
80+
"react-dom": "^16.0.0",
7581
"rimraf": "^2.6.1",
7682
"serve-static": "^1.12.3",
7783
"style-loader": "^0.18.2",
@@ -83,7 +89,6 @@
8389
"build",
8490
"lib",
8591
"src",
86-
"bower.json",
8792
"LICENSE",
8893
"package.json",
8994
"README.md"

scripts/lint.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
const {npm, CWD} = require(`./utils/bash`);
66

77

8-
npm(`eslint --fix .`, {cwd: CWD});
8+
npm(`eslint .`, {cwd: CWD});

scripts/utils/webpack/common.js

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ const webpack = require(`webpack`);
55
const HtmlWebpackPlugin = require(`html-webpack-plugin`);
66
const HtmlWebpackIncludeAssetsPlugin = require(`html-webpack-include-assets-plugin`);
77
const path = require(`path`);
8+
const BabiliPlugin = require(`babili-webpack-plugin`);
9+
10+
811
const {NODE_ENV = `development`} = process.env;
912

1013

@@ -18,12 +21,17 @@ const {
1821
externals: COMPONENT_EXTERNALS = {
1922
[`react`]: `React`,
2023
[`react-dom`]: `ReactDOM`
21-
}
24+
},
25+
include: INCLUDE_JS = [
26+
`https://unpkg.com/react@16.0.0/umd/react.production.min.js`,
27+
`https://unpkg.com/react-dom@16.0.0/umd/react-dom.production.min.js`
28+
]
2229
},
2330
name: PACKAGE_NAME
2431
} = require(pathTo(`package.json`));
2532
exports.PACKAGE_NAME = PACKAGE_NAME;
2633
exports.COMPONENT_NAME = COMPONENT_NAME;
34+
exports.INCLUDE_JS = INCLUDE_JS;
2735

2836

2937
if (!COMPONENT_NAME) {
@@ -47,8 +55,8 @@ exports.loaders = {
4755
options: {
4856
babelrc: false,
4957
presets: [
50-
[`es2015`, {modules: false}],
51-
`react`
58+
`react`,
59+
[`env`, {modules: false}]
5260
],
5361
plugins: [
5462
`transform-object-rest-spread`,
@@ -66,12 +74,17 @@ exports.loaders = {
6674
};
6775

6876

77+
const babiliPlugin = new BabiliPlugin({
78+
mergeVars: false
79+
}, {sourceMap: false});
80+
81+
6982
exports.plugins = {
7083
define: new webpack.DefinePlugin({
7184
'process.env.NODE_ENV': JSON.stringify(NODE_ENV)
7285
}),
7386
html: new HtmlWebpackPlugin(),
74-
uglify: new webpack.optimize.UglifyJsPlugin(),
87+
uglify: babiliPlugin,
7588
include: assets => new HtmlWebpackIncludeAssetsPlugin({
7689
assets,
7790
append: false
@@ -82,9 +95,7 @@ exports.plugins = {
8295
};
8396

8497

85-
exports.resolve = {
86-
extensions: [`.js`]
87-
};
98+
exports.resolve = {};
8899

89100

90101
exports.stats = {colors: true};

scripts/utils/webpack/pub.config.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ const {
99
loaders,
1010
resolve,
1111
stats,
12-
externals
12+
externals,
13+
INCLUDE_JS
1314
} = require(`./common`);
1415

1516

@@ -23,11 +24,7 @@ module.exports = {
2324
plugins: [
2425
plugins.define,
2526
plugins.html,
26-
plugins.include([
27-
`https://unpkg.com/react/dist/react.min.js`,
28-
`https://unpkg.com/react-dom/dist/react-dom.min.js`,
29-
`styles.css`
30-
]),
27+
plugins.include(INCLUDE_JS.concat([`styles.css`])),
3128
new ExtractTextPlugin(`styles.css`)
3229
],
3330
module: {

0 commit comments

Comments
 (0)