Skip to content

Commit

Permalink
Refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
nkbt committed Sep 30, 2017
1 parent 1d8f15f commit e0b0ae8
Show file tree
Hide file tree
Showing 9 changed files with 1,651 additions and 1,464 deletions.
2 changes: 1 addition & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"presets": [
"es2015",
"env",
"react"
],
"plugins": [
Expand Down
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ version: 2

jobs:
build:
working_directory: ~/react-debounce-input
working_directory: ~/app
docker:
- image: circleci/node:8
- image: circleci/node:8.4.0
- image: selenium/standalone-firefox:3.4.0

steps:
Expand Down
29 changes: 12 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
[![Gitter](https://img.shields.io/gitter/room/nkbt/help.svg?style=flat-square)](https://gitter.im/nkbt/help)

[![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)
[![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)
[![Dependencies](https://img.shields.io/david/nkbt/react-debounce-input.svg?style=flat-square)](https://david-dm.org/nkbt/react-debounce-input)
[![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)

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

### NPM

```sh
npm install --save react react-debounce-input
```

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


### Bower:
```sh
bower install --save https://unpkg.com/react-debounce-input/bower.zip
```


### 1998 Script Tag:
```html
<script src="https://unpkg.com/react/dist/react.js"></script>
<script src="https://unpkg.com/react@16.0.0/umd/react.production.min.js"></script>
<script src="https://unpkg.com/react-debounce-input/build/react-debounce-input.js"></script>
(Module exposed as `DebounceInput`)
```
Expand All @@ -44,20 +38,18 @@ bower install --save https://unpkg.com/react-debounce-input/bower.zip

## Codepen demo

[http://codepen.io/nkbt/pen/VvmzLQ](http://codepen.io/nkbt/pen/VvmzLQ?editors=101)
[http://codepen.io/nkbt/pen/VvmzLQ](http://codepen.io/nkbt/pen/VvmzLQ?editors=0010)

## Usage
```js
import React from 'react';
import ReactDOM from 'react-dom';
import DebounceInput from 'react-debounce-input';
import {DebounceInput} from 'react-debounce-input';

const App = React.createClass({
getInitialState() {
return {
value: ''
};
},
class App extends React.Component {
state = {
value: ''
};

render() {
return (
Expand All @@ -71,7 +63,7 @@ const App = React.createClass({
</div>
);
}
});
}

const appRoot = document.createElement('div');
document.body.appendChild(appRoot);
Expand Down Expand Up @@ -185,6 +177,9 @@ yarn lint
yarn test

# to run end-to-end tests
# first, run `selenium/standalone-firefox:3.4.0` docker image
docker run -p 4444:4444 selenium/standalone-firefox:3.4.0
# then run test
yarn e2e
```

Expand Down
38 changes: 0 additions & 38 deletions bower.json

This file was deleted.

23 changes: 14 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
"description": "React component that renders Input with debounced onChange",
"main": "lib/index.js",
"config": {
"component": "DebounceInput"
"component": "DebounceInput",
"externals": {
"react": "React",
"react-dom": "ReactDOM"
}
},
"scripts": {
"build": "scripts/build.js",
Expand All @@ -17,7 +21,9 @@
"pub": "scripts/pub.js",
"test": "scripts/test.js",
"prepublish": "yarn build",
"postversion": "git push --follow-tags"
"postversion": "git push --follow-tags",
"nuke": "rm -rf node_modules yarn.lock",
"postnuke": "yarn install"
},
"repository": {
"type": "git",
Expand All @@ -38,23 +44,23 @@
},
"homepage": "https://github.com/nkbt/react-debounce-input",
"peerDependencies": {
"react": ">=15.3"
"react": "^15.3.0 || ^16.0.0"
},
"dependencies": {
"lodash.debounce": "^4",
"prop-types": "^15"
},
"devDependencies": {
"babel-cli": "^6.24.1",
"babel-eslint": "^7.2.3",
"babel-eslint": "^8.0.1",
"babel-loader": "^7.1.1",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.23.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.8",
"babel-preset-env": "^1.6.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-register": "^6.24.1",
"babili-webpack-plugin": "^0.1.2",
"css-loader": "^0.28.4",
"eslint": "^4.4.0",
"eslint-config-airbnb": "^15.1.0",
Expand All @@ -66,12 +72,12 @@
"finalhandler": "^1.0.4",
"gh-pages": "^1.0.0",
"glob": "^7.1.2",
"html-webpack-include-assets-plugin": "^0.0.7",
"html-webpack-include-assets-plugin": "^1.0.0",
"html-webpack-plugin": "^2.30.1",
"nightwatch": "^0.9.16",
"portfinder": "^1.0.13",
"react": "^15.6.1",
"react-dom": "^15.6.1",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"rimraf": "^2.6.1",
"serve-static": "^1.12.3",
"style-loader": "^0.18.2",
Expand All @@ -83,7 +89,6 @@
"build",
"lib",
"src",
"bower.json",
"LICENSE",
"package.json",
"README.md"
Expand Down
2 changes: 1 addition & 1 deletion scripts/lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
const {npm, CWD} = require(`./utils/bash`);


npm(`eslint --fix .`, {cwd: CWD});
npm(`eslint .`, {cwd: CWD});
25 changes: 18 additions & 7 deletions scripts/utils/webpack/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ const webpack = require(`webpack`);
const HtmlWebpackPlugin = require(`html-webpack-plugin`);
const HtmlWebpackIncludeAssetsPlugin = require(`html-webpack-include-assets-plugin`);
const path = require(`path`);
const BabiliPlugin = require(`babili-webpack-plugin`);


const {NODE_ENV = `development`} = process.env;


Expand All @@ -18,12 +21,17 @@ const {
externals: COMPONENT_EXTERNALS = {
[`react`]: `React`,
[`react-dom`]: `ReactDOM`
}
},
include: INCLUDE_JS = [
`https://unpkg.com/[email protected]/umd/react.production.min.js`,
`https://unpkg.com/[email protected]/umd/react-dom.production.min.js`
]
},
name: PACKAGE_NAME
} = require(pathTo(`package.json`));
exports.PACKAGE_NAME = PACKAGE_NAME;
exports.COMPONENT_NAME = COMPONENT_NAME;
exports.INCLUDE_JS = INCLUDE_JS;


if (!COMPONENT_NAME) {
Expand All @@ -47,8 +55,8 @@ exports.loaders = {
options: {
babelrc: false,
presets: [
[`es2015`, {modules: false}],
`react`
`react`,
[`env`, {modules: false}]
],
plugins: [
`transform-object-rest-spread`,
Expand All @@ -66,12 +74,17 @@ exports.loaders = {
};


const babiliPlugin = new BabiliPlugin({
mergeVars: false
}, {sourceMap: false});


exports.plugins = {
define: new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(NODE_ENV)
}),
html: new HtmlWebpackPlugin(),
uglify: new webpack.optimize.UglifyJsPlugin(),
uglify: babiliPlugin,
include: assets => new HtmlWebpackIncludeAssetsPlugin({
assets,
append: false
Expand All @@ -82,9 +95,7 @@ exports.plugins = {
};


exports.resolve = {
extensions: [`.js`]
};
exports.resolve = {};


exports.stats = {colors: true};
Expand Down
9 changes: 3 additions & 6 deletions scripts/utils/webpack/pub.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const {
loaders,
resolve,
stats,
externals
externals,
INCLUDE_JS
} = require(`./common`);


Expand All @@ -23,11 +24,7 @@ module.exports = {
plugins: [
plugins.define,
plugins.html,
plugins.include([
`https://unpkg.com/react/dist/react.min.js`,
`https://unpkg.com/react-dom/dist/react-dom.min.js`,
`styles.css`
]),
plugins.include(INCLUDE_JS.concat([`styles.css`])),
new ExtractTextPlugin(`styles.css`)
],
module: {
Expand Down
Loading

0 comments on commit e0b0ae8

Please sign in to comment.