Merge pull request #167 from react-bootstrap-table/Chun-MingChen-prod-setup

Production build
This commit is contained in:
Allen
2018-01-18 23:17:37 +08:00
committed by GitHub
26 changed files with 2585 additions and 676 deletions
+7
View File
@@ -15,3 +15,10 @@ lerna-debug.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# gh-pages
storybook-static
# build
lib
dist
+84
View File
@@ -0,0 +1,84 @@
import gulp from 'gulp';
import babel from 'gulp-babel';
import sass from 'gulp-sass';
import cleanCSS from 'gulp-clean-css';
import cleanDir from 'gulp-clean';
import rename from 'gulp-rename';
import shell from 'gulp-shell';
const LIB = 'lib';
const DIST = 'dist';
const TEST = 'test';
const PKG_PATH = './packages';
const NODE_MODULES = 'node_modules';
const JS_PKGS = [
'react-bootstrap-table2',
'react-bootstrap-table2-editor',
'react-bootstrap-table2-filter',
'react-bootstrap-table2-overlay',
'react-bootstrap-table2-paginator'
].reduce((pkg, curr) => `${curr}|${pkg}`, '');
const JS_SKIPS = `+(${TEST}|${LIB}|${DIST}|${NODE_MODULES})`;
const STYLE_PKGS = [
'react-bootstrap-table2',
'react-bootstrap-table2-paginator'
].reduce((pkg, curr) => `${curr}|${pkg}`, '');
const STYLE_SKIPS = `+(${NODE_MODULES})`;
function clean() {
return gulp
.src(`./packages/+(${JS_PKGS})/+(${LIB}|${DIST})`, { allowEmpty: true })
.pipe(cleanDir());
}
function scripts() {
return gulp
.src([
`./packages/+(${JS_PKGS})/**/*.js`,
`!packages/+(${JS_PKGS})/${JS_SKIPS}/**/*.js`
])
.pipe(babel())
.pipe(rename((path) => {
if (path.dirname.indexOf('src') > -1) {
path.dirname = path.dirname.replace('src', `${LIB}/src`);
} else {
path.dirname += `/${LIB}`;
}
}))
.pipe(gulp.dest(PKG_PATH));
}
function styles() {
return gulp
.src([
`./packages/+(${STYLE_PKGS})/style/**/*.scss`,
`!packages/+(${STYLE_PKGS})/${STYLE_SKIPS}/**/*.scss`
])
.pipe(sass().on('error', sass.logError))
.pipe(rename((path) => {
path.dirname = path.dirname.replace('style', DIST);
}))
.pipe(gulp.dest(PKG_PATH))
.pipe(cleanCSS({ compatibility: 'ie8' }))
.pipe(rename((path) => {
path.extname = '.min.css';
}))
.pipe(gulp.dest(PKG_PATH));
}
function umd() {
return gulp.src('./webpack.prod.config.babel.js')
.pipe(shell(['webpack --config <%= file.path %>']));
}
const buildJS = gulp.parallel(umd, scripts);
const buildCSS = styles;
const build = gulp.series(clean, gulp.parallel(buildJS, buildCSS));
gulp.task('prod', build);
gulp.task('default', build);
+1 -1
View File
@@ -3,5 +3,5 @@
"packages": [
"packages/*"
],
"version": "0.0.0"
"version": "independent"
}
+13 -1
View File
@@ -5,13 +5,17 @@
"main": "index.js",
"scripts": {
"postinstall": "lerna bootstrap",
"publish": "lerna run build && lerna publish --silent",
"build": "./node_modules/.bin/gulp prod",
"start": "node -r babel-register ./node_modules/.bin/webpack-dev-server --config webpack.config.babel.js",
"lint": "eslint ./packages --ext .js --ext .jsx --ignore-path .gitignore",
"pretest": "yarn lint --cache",
"test": "jest",
"test:coverage": "jest --coverage",
"test:watch": "jest --watch",
"storybook": "cd ./packages/react-bootstrap-table2-example && yarn storybook"
"storybook": "cd ./packages/react-bootstrap-table2-example && yarn storybook",
"gh-pages:clean": "cd ./packages/react-bootstrap-table2-example && yarn gh-pages:clean",
"gh-pages:build": "cd ./packages/react-bootstrap-table2-example && yarn gh-pages:build"
},
"repository": {
"type": "git",
@@ -24,6 +28,7 @@
},
"homepage": "https://github.com/react-bootstrap-table/react-bootstrap-table2#readme",
"devDependencies": {
"babel-cli": "6.26.0",
"babel-core": "6.25.0",
"babel-eslint": "7.2.3",
"babel-jest": "20.0.3",
@@ -41,6 +46,13 @@
"eslint-plugin-import": "2.7.0",
"eslint-plugin-jsx-a11y": "5.1.1",
"eslint-plugin-react": "7.2.1",
"gulp": "4.0.0",
"gulp-babel": "7.0.0",
"gulp-clean": "0.4.0",
"gulp-clean-css": "3.9.2",
"gulp-rename": "^1.2.2",
"gulp-sass": "3.1.0",
"gulp-shell": "0.6.5",
"html-webpack-plugin": "2.30.1",
"jest": "20.0.4",
"jsdom": "11.2.0",
@@ -1,10 +1,10 @@
import wrapperFactory from './wrapper';
import editingCellFactory from './editing-cell';
import wrapperFactory from './src/wrapper';
import editingCellFactory from './src/editing-cell';
import {
CLICK_TO_CELL_EDIT,
DBCLICK_TO_CELL_EDIT,
DELAY_FOR_DBCLICK
} from './const';
} from './src/const';
export default (options = {}) => ({
wrapperFactory,
@@ -2,7 +2,7 @@
"name": "react-bootstrap-table2-editor",
"version": "0.0.1",
"description": "it's the editor addon for react-bootstrap-table2",
"main": "src/index.js",
"main": "./lib/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
@@ -6,7 +6,7 @@ import _ from 'react-bootstrap-table2/src/utils';
import remoteResolver from 'react-bootstrap-table2/src/props-resolver/remote-resolver';
import Store from 'react-bootstrap-table2/src/store';
import BootstrapTable from 'react-bootstrap-table2/src/bootstrap-table';
import cellEditFactory from '../src';
import cellEditFactory from '..';
import * as Const from '../src/const';
import wrapperFactory from '../src/wrapper';
@@ -0,0 +1,3 @@
{
"presets": ["react", "es2015", "stage-0", ["env", {"modules": false} ]]
}
@@ -1,10 +1,10 @@
const path = require('path');
const sourcePath = path.join(__dirname, '../../react-bootstrap-table2/src');
const paginationSourcePath = path.join(__dirname, '../../react-bootstrap-table2-paginator/src');
const overlaySourcePath = path.join(__dirname, '../../react-bootstrap-table2-overlay/src');
const filterSourcePath = path.join(__dirname, '../../react-bootstrap-table2-filter/src');
const editorSourcePath = path.join(__dirname, '../../react-bootstrap-table2-editor/src');
const sourcePath = path.join(__dirname, '../../react-bootstrap-table2');
const paginationSourcePath = path.join(__dirname, '../../react-bootstrap-table2-paginator');
const overlaySourcePath = path.join(__dirname, '../../react-bootstrap-table2-overlay');
const filterSourcePath = path.join(__dirname, '../../react-bootstrap-table2-filter');
const editorSourcePath = path.join(__dirname, '../../react-bootstrap-table2-editor');
const sourceStylePath = path.join(__dirname, '../../react-bootstrap-table2/style');
const paginationStylePath = path.join(__dirname, '../../react-bootstrap-table2-paginator/style');
const storyPath = path.join(__dirname, '../stories');
@@ -16,6 +16,12 @@ const aliasPath = {
src: srcPath,
components: path.join(srcPath, 'components'),
utils: path.join(srcPath, 'utils'),
'react-bootstrap-table2': sourcePath,
'react-bootstrap-table2-editor': editorSourcePath,
'react-bootstrap-table2-filter': filterSourcePath,
'react-bootstrap-table2-overlay': overlaySourcePath,
'react-bootstrap-table2-paginator': paginationSourcePath,
};
const loaders = [{
@@ -28,7 +34,7 @@ const loaders = [{
test: /\.js?$/,
use: ['babel-loader'],
exclude: /node_modules/,
include: [sourcePath, paginationSourcePath, overlaySourcePath, filterSourcePath, editorSourcePath, storyPath],
include: [sourcePath, paginationSourcePath, overlaySourcePath, filterSourcePath, editorSourcePath, storyPath]
}, {
test: /\.css$/,
use: ['style-loader', 'css-loader'],
@@ -3,10 +3,12 @@
"version": "0.0.1",
"description": "",
"main": "index.js",
"private": true,
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook"
"gh-pages:clean": "rimraf ./storybook-static",
"gh-pages:build": "build-storybook"
},
"author": "",
"license": "ISC",
@@ -16,16 +18,12 @@
"react-dom": "^15.0.0"
},
"dependencies": {
"bootstrap": "^3.3.7",
"react-bootstrap-table2": "0.0.1",
"react-bootstrap-table2-editor": "0.0.1",
"react-bootstrap-table2-paginator": "0.0.1",
"react-bootstrap-table2-overlay": "0.0.1",
"react-bootstrap-table2-filter": "0.0.1"
"bootstrap": "^3.3.7"
},
"devDependencies": {
"@storybook/addon-console": "^1.0.0",
"@storybook/react": "^3.2.8",
"babel-preset-env": "^1.6.1",
"react-redux": "^5.0.6",
"redux": "^3.7.2",
"redux-thunk": "^2.2.0",
@@ -1,6 +1,6 @@
import TextFilter from './components/text';
import wrapperFactory from './wrapper';
import * as Comparison from './comparison';
import TextFilter from './src/components/text';
import wrapperFactory from './src/wrapper';
import * as Comparison from './src/comparison';
export default (options = {}) => ({
wrapperFactory,
@@ -2,10 +2,7 @@
"name": "react-bootstrap-table2-filter",
"version": "0.0.1",
"description": "it's the column filter addon for react-bootstrap-table2",
"main": "src/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"main": "./lib/index.js",
"author": "",
"license": "ISC"
}
@@ -6,7 +6,7 @@ import _ from 'react-bootstrap-table2/src/utils';
import remoteResolver from 'react-bootstrap-table2/src/props-resolver/remote-resolver';
import BootstrapTable from 'react-bootstrap-table2/src/bootstrap-table';
import Store from 'react-bootstrap-table2/src/store';
import filter, { textFilter } from '../src';
import filter, { textFilter } from '..';
import wrapperFactory from '../src/wrapper';
import { FILTER_TYPE } from '../src/const';
@@ -2,10 +2,7 @@
"name": "react-bootstrap-table2-overlay",
"version": "0.0.1",
"description": "it's a loading overlay component for react-bootstrap-table2",
"main": "src/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"main": "./lib/index.js",
"author": "",
"license": "ISC",
"dependencies": {
@@ -2,7 +2,7 @@ import React from 'react';
import { shallow, render } from 'enzyme';
import LoadingOverlay from 'react-loading-overlay';
import overlayFactory from '../src';
import overlayFactory from '..';
describe('overlayFactory', () => {
let wrapper;
@@ -1,4 +1,4 @@
import wrapperFactory from './wrapper';
import wrapperFactory from './src/wrapper';
export default (options = {}) => ({
wrapperFactory,
@@ -2,10 +2,7 @@
"name": "react-bootstrap-table2-paginator",
"version": "0.0.1",
"description": "it's the pagination addon for react-bootstrap-table2",
"main": "src/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"main": "./lib/index.js",
"author": "",
"license": "ISC"
}
@@ -6,7 +6,7 @@ import { shallow } from 'enzyme';
import BootstrapTable from 'react-bootstrap-table2/src/bootstrap-table';
import remoteResolver from 'react-bootstrap-table2/src/props-resolver/remote-resolver';
import Store from 'react-bootstrap-table2/src/store';
import paginator from '../src';
import paginator from '..';
import wrapperFactory from '../src/wrapper';
import Pagination from '../src/pagination';
import Const from '../src/const';
+5
View File
@@ -0,0 +1,5 @@
import BootstrapTable from './src/bootstrap-table';
import withDataStore from './src/container';
export default withDataStore(BootstrapTable);
+1 -4
View File
@@ -2,10 +2,7 @@
"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"
},
"main": "./lib/index.js",
"author": "",
"license": "ISC"
}
-5
View File
@@ -1,5 +0,0 @@
import BootstrapTable from './bootstrap-table';
import withDataStore from './container';
export default withDataStore(BootstrapTable);
@@ -4,7 +4,7 @@ import React from 'react';
import { shallow } from 'enzyme';
import BootstrapTable from '../src/bootstrap-table';
import Container from '../src';
import Container from '../index.js';
describe('container', () => {
let wrapper;
@@ -3,7 +3,7 @@ import React from 'react';
import sinon from 'sinon';
import { shallow } from 'enzyme';
import Container from '../../src/';
import Container from '../../';
// import remoteResolver from '../../src/props-resolver/remote-resolver';
describe('remoteResolver', () => {
+64
View File
@@ -0,0 +1,64 @@
import * as path from 'path';
import webpack from 'webpack';
module.exports = {
entry: {
'react-bootstrap-table2/dist/react-bootstrap-table2': './packages/react-bootstrap-table2/index.js',
'react-bootstrap-table2/dist/react-bootstrap-table2.min': './packages/react-bootstrap-table2/index.js',
'react-bootstrap-table2-editor/dist/react-bootstrap-table2-editor': './packages/react-bootstrap-table2-editor/index.js',
'react-bootstrap-table2-editor/dist/react-bootstrap-table2-editor.min': './packages/react-bootstrap-table2-editor/index.js',
'react-bootstrap-table2-filter/dist/react-bootstrap-table2-filter': './packages/react-bootstrap-table2-filter/index.js',
'react-bootstrap-table2-filter/dist/react-bootstrap-table2-filter.min': './packages/react-bootstrap-table2-filter/index.js',
'react-bootstrap-table2-overlay/dist/react-bootstrap-table2-overlay': './packages/react-bootstrap-table2-overlay/index.js',
'react-bootstrap-table2-overlay/dist/react-bootstrap-table2-overlay.min': './packages/react-bootstrap-table2-overlay/index.js',
'react-bootstrap-table2-paginator/dist/react-bootstrap-table2-paginator': './packages/react-bootstrap-table2-paginator/index.js',
'react-bootstrap-table2-paginator/dist/react-bootstrap-table2-paginator.min': './packages/react-bootstrap-table2-paginator/index.js'
},
devtool: 'source-map',
output: {
path: path.join(__dirname, 'packages'),
filename: '[name].js',
library: 'ReactBootstrapTable',
libraryTarget: 'umd'
},
externals: [{
'react': {
root: 'React',
commonjs2: 'react',
commonjs: 'react',
amd: 'react'
}
}, {
'react-dom': {
root: 'ReactDOM',
commonjs2: 'react-dom',
commonjs: 'react-dom',
amd: 'react-dom'
}
}],
module: {
rules: [{
enforce: 'pre',
test: /\.js?$/,
exclude: /node_modules/,
loader: 'eslint-loader'
}, {
test: /\.js?$/,
use: ['babel-loader'],
exclude: /node_modules/
}]
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
}),
new webpack.SourceMapDevToolPlugin(),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.optimize.AggressiveMergingPlugin(),
new webpack.optimize.UglifyJsPlugin({
include: /\.min\.js$/,
compress: { warnings: false }
})
]
};
+2373 -626
View File
File diff suppressed because it is too large Load Diff