Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2824039

Browse files
Merge pull request #167 from react-bootstrap-table/Chun-MingChen-prod-setup
Production build
2 parents 55fe007 + 1cedea5 commit 2824039

File tree

26 files changed

+2582
-673
lines changed

26 files changed

+2582
-673
lines changed

‎.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,10 @@ lerna-debug.log
1515
npm-debug.log*
1616
yarn-debug.log*
1717
yarn-error.log*
18+
19+
# gh-pages
20+
storybook-static
21+
22+
# build
23+
lib
24+
dist

‎gulpfile.babel.js

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
import gulp from 'gulp';
2+
import babel from 'gulp-babel';
3+
import sass from 'gulp-sass';
4+
import cleanCSS from 'gulp-clean-css';
5+
import cleanDir from 'gulp-clean';
6+
import rename from 'gulp-rename';
7+
import shell from 'gulp-shell';
8+
9+
const LIB = 'lib';
10+
const DIST = 'dist';
11+
const TEST = 'test';
12+
const PKG_PATH = './packages';
13+
const NODE_MODULES = 'node_modules';
14+
15+
const JS_PKGS = [
16+
'react-bootstrap-table2',
17+
'react-bootstrap-table2-editor',
18+
'react-bootstrap-table2-filter',
19+
'react-bootstrap-table2-overlay',
20+
'react-bootstrap-table2-paginator'
21+
].reduce((pkg, curr) => `${curr}|${pkg}`, '');
22+
23+
const JS_SKIPS = `+(${TEST}|${LIB}|${DIST}|${NODE_MODULES})`;
24+
25+
const STYLE_PKGS = [
26+
'react-bootstrap-table2',
27+
'react-bootstrap-table2-paginator'
28+
].reduce((pkg, curr) => `${curr}|${pkg}`, '');
29+
30+
const STYLE_SKIPS = `+(${NODE_MODULES})`;
31+
32+
33+
function clean() {
34+
return gulp
35+
.src(`./packages/+(${JS_PKGS})/+(${LIB}|${DIST})`, { allowEmpty: true })
36+
.pipe(cleanDir());
37+
}
38+
39+
function scripts() {
40+
return gulp
41+
.src([
42+
`./packages/+(${JS_PKGS})/**/*.js`,
43+
`!packages/+(${JS_PKGS})/${JS_SKIPS}/**/*.js`
44+
])
45+
.pipe(babel())
46+
.pipe(rename((path) => {
47+
if (path.dirname.indexOf('src') > -1) {
48+
path.dirname = path.dirname.replace('src', `${LIB}/src`);
49+
} else {
50+
path.dirname += `/${LIB}`;
51+
}
52+
}))
53+
.pipe(gulp.dest(PKG_PATH));
54+
}
55+
56+
function styles() {
57+
return gulp
58+
.src([
59+
`./packages/+(${STYLE_PKGS})/style/**/*.scss`,
60+
`!packages/+(${STYLE_PKGS})/${STYLE_SKIPS}/**/*.scss`
61+
])
62+
.pipe(sass().on('error', sass.logError))
63+
.pipe(rename((path) => {
64+
path.dirname = path.dirname.replace('style', DIST);
65+
}))
66+
.pipe(gulp.dest(PKG_PATH))
67+
.pipe(cleanCSS({ compatibility: 'ie8' }))
68+
.pipe(rename((path) => {
69+
path.extname = '.min.css';
70+
}))
71+
.pipe(gulp.dest(PKG_PATH));
72+
}
73+
74+
function umd() {
75+
return gulp.src('./webpack.prod.config.babel.js')
76+
.pipe(shell(['webpack --config <%= file.path %>']));
77+
}
78+
79+
const buildJS = gulp.parallel(umd, scripts);
80+
const buildCSS = styles;
81+
const build = gulp.series(clean, gulp.parallel(buildJS, buildCSS));
82+
83+
gulp.task('prod', build);
84+
gulp.task('default', build);

‎lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
"packages": [
44
"packages/*"
55
],
6-
"version": "0.0.0"
6+
"version": "independent"
77
}

‎package.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@
55
"main": "index.js",
66
"scripts": {
77
"postinstall": "lerna bootstrap",
8+
"publish": "lerna run build && lerna publish --silent",
9+
"build": "./node_modules/.bin/gulp prod",
810
"start": "node -r babel-register ./node_modules/.bin/webpack-dev-server --config webpack.config.babel.js",
911
"lint": "eslint ./packages --ext .js --ext .jsx --ignore-path .gitignore",
1012
"pretest": "yarn lint --cache",
1113
"test": "jest",
1214
"test:coverage": "jest --coverage",
1315
"test:watch": "jest --watch",
14-
"storybook": "cd ./packages/react-bootstrap-table2-example && yarn storybook"
16+
"storybook": "cd ./packages/react-bootstrap-table2-example && yarn storybook",
17+
"gh-pages:clean": "cd ./packages/react-bootstrap-table2-example && yarn gh-pages:clean",
18+
"gh-pages:build": "cd ./packages/react-bootstrap-table2-example && yarn gh-pages:build"
1519
},
1620
"repository": {
1721
"type": "git",
@@ -24,6 +28,7 @@
2428
},
2529
"homepage": "https://github.com/react-bootstrap-table/react-bootstrap-table2#readme",
2630
"devDependencies": {
31+
"babel-cli": "6.26.0",
2732
"babel-core": "6.25.0",
2833
"babel-eslint": "7.2.3",
2934
"babel-jest": "20.0.3",
@@ -41,6 +46,13 @@
4146
"eslint-plugin-import": "2.7.0",
4247
"eslint-plugin-jsx-a11y": "5.1.1",
4348
"eslint-plugin-react": "7.2.1",
49+
"gulp": "4.0.0",
50+
"gulp-babel": "7.0.0",
51+
"gulp-clean": "0.4.0",
52+
"gulp-clean-css": "3.9.2",
53+
"gulp-rename": "^1.2.2",
54+
"gulp-sass": "3.1.0",
55+
"gulp-shell": "0.6.5",
4456
"html-webpack-plugin": "2.30.1",
4557
"jest": "20.0.4",
4658
"jsdom": "11.2.0",

‎packages/react-bootstrap-table2-editor/src/index.js renamed to ‎packages/react-bootstrap-table2-editor/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import wrapperFactory from './wrapper';
2-
import editingCellFactory from './editing-cell';
1+
import wrapperFactory from './src/wrapper';
2+
import editingCellFactory from './src/editing-cell';
33
import {
44
CLICK_TO_CELL_EDIT,
55
DBCLICK_TO_CELL_EDIT,
66
DELAY_FOR_DBCLICK
7-
} from './const';
7+
} from './src/const';
88

99
export default (options = {}) => ({
1010
wrapperFactory,

‎packages/react-bootstrap-table2-editor/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "react-bootstrap-table2-editor",
33
"version": "0.0.1",
44
"description": "it's the editor addon for react-bootstrap-table2",
5-
"main": "src/index.js",
5+
"main": "./lib/index.js",
66
"scripts": {
77
"test": "echo \"Error: no test specified\" && exit 1"
88
},

‎packages/react-bootstrap-table2-editor/test/wrapper.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import _ from 'react-bootstrap-table2/src/utils';
66
import remoteResolver from 'react-bootstrap-table2/src/props-resolver/remote-resolver';
77
import Store from 'react-bootstrap-table2/src/store';
88
import BootstrapTable from 'react-bootstrap-table2/src/bootstrap-table';
9-
import cellEditFactory from '../src';
9+
import cellEditFactory from '..';
1010
import * as Const from '../src/const';
1111
import wrapperFactory from '../src/wrapper';
1212

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["react", "es2015", "stage-0", ["env", {"modules": false} ]]
3+
}

‎packages/react-bootstrap-table2-example/.storybook/webpack.config.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
const path = require('path');
22

3-
const sourcePath = path.join(__dirname, '../../react-bootstrap-table2/src');
4-
const paginationSourcePath = path.join(__dirname, '../../react-bootstrap-table2-paginator/src');
5-
const overlaySourcePath = path.join(__dirname, '../../react-bootstrap-table2-overlay/src');
6-
const filterSourcePath = path.join(__dirname, '../../react-bootstrap-table2-filter/src');
7-
const editorSourcePath = path.join(__dirname, '../../react-bootstrap-table2-editor/src');
3+
const sourcePath = path.join(__dirname, '../../react-bootstrap-table2');
4+
const paginationSourcePath = path.join(__dirname, '../../react-bootstrap-table2-paginator');
5+
const overlaySourcePath = path.join(__dirname, '../../react-bootstrap-table2-overlay');
6+
const filterSourcePath = path.join(__dirname, '../../react-bootstrap-table2-filter');
7+
const editorSourcePath = path.join(__dirname, '../../react-bootstrap-table2-editor');
88
const sourceStylePath = path.join(__dirname, '../../react-bootstrap-table2/style');
99
const paginationStylePath = path.join(__dirname, '../../react-bootstrap-table2-paginator/style');
1010
const storyPath = path.join(__dirname, '../stories');
@@ -16,6 +16,12 @@ const aliasPath = {
1616
src: srcPath,
1717
components: path.join(srcPath, 'components'),
1818
utils: path.join(srcPath, 'utils'),
19+
20+
'react-bootstrap-table2': sourcePath,
21+
'react-bootstrap-table2-editor': editorSourcePath,
22+
'react-bootstrap-table2-filter': filterSourcePath,
23+
'react-bootstrap-table2-overlay': overlaySourcePath,
24+
'react-bootstrap-table2-paginator': paginationSourcePath,
1925
};
2026

2127
const loaders = [{
@@ -28,7 +34,7 @@ const loaders = [{
2834
test: /\.js?$/,
2935
use: ['babel-loader'],
3036
exclude: /node_modules/,
31-
include: [sourcePath, paginationSourcePath, overlaySourcePath, filterSourcePath, editorSourcePath, storyPath],
37+
include: [sourcePath, paginationSourcePath, overlaySourcePath, filterSourcePath, editorSourcePath, storyPath]
3238
}, {
3339
test: /\.css$/,
3440
use: ['style-loader', 'css-loader'],

‎packages/react-bootstrap-table2-example/package.json

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
"version": "0.0.1",
44
"description": "",
55
"main": "index.js",
6+
"private": true,
67
"scripts": {
78
"test": "echo \"Error: no test specified\" && exit 1",
89
"storybook": "start-storybook -p 6006",
9-
"build-storybook": "build-storybook"
10+
"gh-pages:clean": "rimraf ./storybook-static",
11+
"gh-pages:build": "build-storybook"
1012
},
1113
"author": "",
1214
"license": "ISC",
@@ -16,16 +18,12 @@
1618
"react-dom": "^15.0.0"
1719
},
1820
"dependencies": {
19-
"bootstrap": "^3.3.7",
20-
"react-bootstrap-table2": "0.0.1",
21-
"react-bootstrap-table2-editor": "0.0.1",
22-
"react-bootstrap-table2-paginator": "0.0.1",
23-
"react-bootstrap-table2-overlay": "0.0.1",
24-
"react-bootstrap-table2-filter": "0.0.1"
21+
"bootstrap": "^3.3.7"
2522
},
2623
"devDependencies": {
2724
"@storybook/addon-console": "^1.0.0",
2825
"@storybook/react": "^3.2.8",
26+
"babel-preset-env": "^1.6.1",
2927
"react-redux": "^5.0.6",
3028
"redux": "^3.7.2",
3129
"redux-thunk": "^2.2.0",

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /