init for starting develop

This commit is contained in:
AllenFang 2017-08-19 14:55:04 +08:00
parent bd58b436e4
commit 4d6ad8d7e8
12 changed files with 204 additions and 1 deletions

3
.babelrc Normal file
View File

@ -0,0 +1,3 @@
{
"presets": ["react", "es2015", "stage-0"]
}

23
.eslintrc Normal file
View File

@ -0,0 +1,23 @@
{
"extends": "airbnb",
"parser": "babel-eslint",
"env": {
"browser": true,
"jasmine": true,
"node": true
},
"plugins": [
"react"
],
"rules": {
"comma-dangle": ["error", "never"],
"react/jsx-curly-spacing": 0,
"react/forbid-prop-types": 0,
"react/jsx-filename-extension": 0,
"import/prefer-default-export": 0,
"import/no-extraneous-dependencies": 0
},
"globals": {
"jest": false
}
}

7
lerna.json Normal file
View File

@ -0,0 +1,7 @@
{
"lerna": "2.0.0",
"packages": [
"packages/*"
],
"version": "0.0.0"
}

View File

@ -4,6 +4,7 @@
"description": "Rebuilt for react-bootstrap-table",
"main": "index.js",
"scripts": {
"start": "node -r babel-register ./node_modules/.bin/webpack-dev-server --config webpack.config.babel.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
@ -15,5 +16,34 @@
"bugs": {
"url": "https://github.com/react-bootstrap-table/react-bootstrap-table2/issues"
},
"homepage": "https://github.com/react-bootstrap-table/react-bootstrap-table2#readme"
"homepage": "https://github.com/react-bootstrap-table/react-bootstrap-table2#readme",
"devDependencies": {
"babel-core": "^6.25.0",
"babel-eslint": "^7.2.3",
"babel-loader": "^7.1.1",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"babel-register": "^6.24.1",
"eslint": "^4.5.0",
"eslint-config-airbnb": "^14.1.0",
"eslint-loader": "^1.9.0",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jsx-a11y": "^4.0.0",
"eslint-plugin-react": "^7.2.1",
"html-webpack-plugin": "^2.30.1",
"lerna": "^2.0.0",
"webpack": "^3.5.4",
"webpack-dev-server": "^2.7.1"
},
"dependencies": {
"prop-types": "^15.5.10",
"react": "^15.6.1",
"react-dom": "^15.6.1"
},
"peerDependencies": {
"react": "^15.0.0",
"react-dom": "^15.0.0",
"prop-types": "^15.0.0"
}
}

View File

@ -0,0 +1,14 @@
{
"name": "react-bootstrap-table2-example",
"version": "0.0.1",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"react-bootstrap-table2": "0.0.1"
}
}

View File

@ -0,0 +1,18 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>react-bootstrap-table demo</title>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<script src="http://code.jquery.com/jquery-2.1.3.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.js"></script>
<!-- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script>
<script src="https://use.fontawesome.com/f52b8fd2c4.js"></script> -->
</head>
<body>
<div id="example"></div>
</body>
</html>

View File

@ -0,0 +1,10 @@
import React from 'react';
import ReactDom from 'react-dom';
import { BootstrapTable } from 'react-bootstrap-table2';
const data = [1, 2, 3, 4];
ReactDom.render(
<BootstrapTable data={ data } />,
document.getElementById('example'));

View File

@ -0,0 +1,11 @@
{
"name": "react-bootstrap-table2",
"version": "0.0.1",
"description": "Rebuilt for react-bootstrap-table",
"main": "src/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}

View File

@ -0,0 +1,26 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import storeBase from './store/base';
class BootstrapTable extends storeBase(Component) {
render() {
return (
<ul>
{
this.props.data.map(d => <li>{ d }</li>)
}
</ul>
);
}
}
BootstrapTable.propTypes = {
data: PropTypes.array
};
BootstrapTable.defaultProps = {
data: []
};
export default BootstrapTable;

View File

@ -0,0 +1,5 @@
import BootstrapTable from './bootstrap-table';
export {
BootstrapTable
};

View File

@ -0,0 +1,8 @@
export default ExtendBase =>
class Store extends ExtendBase {
constructor(props) {
super(props);
const { data } = this.props;
this.data = data ? data.slice() : [];
}
};

48
webpack.config.babel.js Normal file
View File

@ -0,0 +1,48 @@
import * as path from 'path';
import webpack from 'webpack';
import HtmlWebpackPlugin from 'html-webpack-plugin';
const sourcePath = path.join(__dirname, 'packages/react-bootstrap-table2/src');
const examplePath = path.join(__dirname, 'packages/react-bootstrap-table2-example/src');
const exampleHTMLPath = path.join(__dirname, 'packages/react-bootstrap-table2-example/src/index.html');
module.exports = {
entry: examplePath,
devtool: '#eval-source-map',
devServer: {
historyApiFallback: true,
hot: true,
inline: true,
// progress: true,
noInfo: true,
stats: 'errors-only'
},
output: {
path: path.join(__dirname, 'examples'),
filename: '[name].bundle.js'
},
module: {
rules: [ {
enforce: 'pre',
test: /\.js?$/,
exclude: /node_modules/,
include: [ sourcePath, examplePath ],
loader: 'eslint-loader'
}, {
test: /\.js?$/,
use: [ 'babel-loader' ],
exclude: /node_modules/,
include: [ sourcePath, examplePath ],
}, {
test: /\.css$/,
use: 'style-loader!css-loader'
} ]
},
plugins: [
new HtmlWebpackPlugin({
template: exampleHTMLPath
}),
new webpack.HotModuleReplacementPlugin()
]
};