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' ;
1+ import gulp from "gulp" ;
2+ import babel from "gulp-babel" ;
3+ import gulpSass from "gulp-sass" ;
4+ import dartSass from "sass" ;
5+ import cleanCSS from "gulp-clean-css" ;
6+ import cleanDir from "gulp-clean" ;
7+ import rename from "gulp-rename" ;
8+ import shell from "gulp-shell" ;
89
9- const LIB = 'lib' ;
10- const DIST = 'dist' ;
11- const TEST = 'test' ;
12- const PKG_PATH = './packages' ;
13- const NODE_MODULES = 'node_modules' ;
10+ const sass = gulpSass ( dartSass ) ;
11+ const LIB = "lib" ;
12+ const DIST = "dist" ;
13+ const TEST = "test" ;
14+ const PKG_PATH = "./packages" ;
15+ const NODE_MODULES = "node_modules" ;
1416
1517const 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- ' react-bootstrap-table2-toolkit'
22- ] . reduce ( ( pkg , curr ) => `${ curr } |${ pkg } ` , '' ) ;
18+ " react-bootstrap-table2" ,
19+ " react-bootstrap-table2-editor" ,
20+ " react-bootstrap-table2-filter" ,
21+ " react-bootstrap-table2-overlay" ,
22+ " react-bootstrap-table2-paginator" ,
23+ " react-bootstrap-table2-toolkit" ,
24+ ] . reduce ( ( pkg , curr ) => `${ curr } |${ pkg } ` , "" ) ;
2325
2426const JS_SKIPS = `+(${ TEST } |${ LIB } |${ DIST } |${ NODE_MODULES } )` ;
2527
2628const STYLE_PKGS = [
27- ' react-bootstrap-table2' ,
28- ' react-bootstrap-table2-filter' ,
29- ' react-bootstrap-table2-paginator' ,
30- ' react-bootstrap-table2-toolkit' ,
31- ] . reduce ( ( pkg , curr ) => `${ curr } |${ pkg } ` , '' ) ;
29+ " react-bootstrap-table2" ,
30+ " react-bootstrap-table2-filter" ,
31+ " react-bootstrap-table2-paginator" ,
32+ " react-bootstrap-table2-toolkit" ,
33+ ] . reduce ( ( pkg , curr ) => `${ curr } |${ pkg } ` , "" ) ;
3234
3335const STYLE_SKIPS = `+(${ NODE_MODULES } )` ;
3436
35-
3637function clean ( ) {
3738 return gulp
3839 . src ( `./packages/+(${ JS_PKGS } )/+(${ LIB } |${ DIST } )` , { allowEmpty : true } )
@@ -43,45 +44,69 @@ function scripts() {
4344 return gulp
4445 . src ( [
4546 `./packages/+(${ JS_PKGS } )/**/*.js` ,
46- `!packages/+(${ JS_PKGS } )/${ JS_SKIPS } /**/*.js`
47+ `!packages/+(${ JS_PKGS } )/${ JS_SKIPS } /**/*.js` ,
4748 ] )
4849 . pipe ( babel ( ) )
49- . pipe ( rename ( ( path ) => {
50- if ( path . dirname . indexOf ( 'src' ) > - 1 ) {
51- path . dirname = path . dirname . replace ( 'src' , `${ LIB } /src` ) ;
52- } else {
53- path . dirname += `/${ LIB } ` ;
54- }
55- } ) )
50+ . pipe (
51+ rename ( ( path ) => {
52+ if ( path . dirname . indexOf ( "src" ) > - 1 ) {
53+ path . dirname = path . dirname . replace ( "src" , `${ LIB } /src` ) ;
54+ } else {
55+ path . dirname += `/${ LIB } ` ;
56+ }
57+ } )
58+ )
5659 . pipe ( gulp . dest ( PKG_PATH ) ) ;
5760}
5861
5962function styles ( ) {
6063 return gulp
6164 . src ( [
6265 `./packages/+(${ STYLE_PKGS } )/style/**/*.scss` ,
63- `!packages/+(${ STYLE_PKGS } )/${ STYLE_SKIPS } /**/*.scss`
66+ `!packages/+(${ STYLE_PKGS } )/${ STYLE_SKIPS } /**/*.scss` ,
6467 ] )
65- . pipe ( sass ( ) . on ( 'error' , sass . logError ) )
66- . pipe ( rename ( ( path ) => {
67- path . dirname = path . dirname . replace ( 'style' , DIST ) ;
68- } ) )
68+ . pipe ( sass ( ) . on ( "error" , sass . logError ) )
69+ . pipe (
70+ rename ( ( path ) => {
71+ path . dirname = path . dirname . replace ( "style" , DIST ) ;
72+ } )
73+ )
6974 . pipe ( gulp . dest ( PKG_PATH ) )
70- . pipe ( cleanCSS ( { compatibility : 'ie8' } ) )
71- . pipe ( rename ( ( path ) => {
72- path . extname = '.min.css' ;
73- } ) )
75+ . pipe ( cleanCSS ( { compatibility : "ie8" } ) )
76+ . pipe (
77+ rename ( ( path ) => {
78+ path . extname = ".min.css" ;
79+ } )
80+ )
7481 . pipe ( gulp . dest ( PKG_PATH ) ) ;
7582}
7683
7784function umd ( done ) {
7885 gulp . parallel (
79- ( ) => gulp . src ( './webpack/next.umd.babel.js' ) . pipe ( shell ( [ 'webpack --config <%= file.path %>' ] ) ) ,
80- ( ) => gulp . src ( './webpack/editor.umd.babel.js' ) . pipe ( shell ( [ 'webpack --config <%= file.path %>' ] ) ) ,
81- ( ) => gulp . src ( './webpack/filter.umd.babel.js' ) . pipe ( shell ( [ 'webpack --config <%= file.path %>' ] ) ) ,
82- ( ) => gulp . src ( './webpack/overlay.umd.babel.js' ) . pipe ( shell ( [ 'webpack --config <%= file.path %>' ] ) ) ,
83- ( ) => gulp . src ( './webpack/paginator.umd.babel.js' ) . pipe ( shell ( [ 'webpack --config <%= file.path %>' ] ) ) ,
84- ( ) => gulp . src ( './webpack/toolkit.umd.babel.js' ) . pipe ( shell ( [ 'webpack --config <%= file.path %>' ] ) )
86+ ( ) =>
87+ gulp
88+ . src ( "./webpack/next.umd.babel.js" )
89+ . pipe ( shell ( [ "webpack --config <%= file.path %>" ] ) ) ,
90+ ( ) =>
91+ gulp
92+ . src ( "./webpack/editor.umd.babel.js" )
93+ . pipe ( shell ( [ "webpack --config <%= file.path %>" ] ) ) ,
94+ ( ) =>
95+ gulp
96+ . src ( "./webpack/filter.umd.babel.js" )
97+ . pipe ( shell ( [ "webpack --config <%= file.path %>" ] ) ) ,
98+ ( ) =>
99+ gulp
100+ . src ( "./webpack/overlay.umd.babel.js" )
101+ . pipe ( shell ( [ "webpack --config <%= file.path %>" ] ) ) ,
102+ ( ) =>
103+ gulp
104+ . src ( "./webpack/paginator.umd.babel.js" )
105+ . pipe ( shell ( [ "webpack --config <%= file.path %>" ] ) ) ,
106+ ( ) =>
107+ gulp
108+ . src ( "./webpack/toolkit.umd.babel.js" )
109+ . pipe ( shell ( [ "webpack --config <%= file.path %>" ] ) )
85110 ) ( ) ;
86111 done ( ) ;
87112}
@@ -90,5 +115,5 @@ const buildJS = gulp.parallel(umd, scripts);
90115const buildCSS = styles ;
91116const build = gulp . series ( clean , gulp . parallel ( buildJS , buildCSS ) ) ;
92117
93- gulp . task ( ' prod' , build ) ;
94- gulp . task ( ' default' , build ) ;
118+ gulp . task ( " prod" , build ) ;
119+ gulp . task ( " default" , build ) ;
0 commit comments