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" ;
8
9
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" ;
14
16
15
17
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
- ' 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 } ` , "" ) ;
23
25
24
26
const JS_SKIPS = `+(${ TEST } |${ LIB } |${ DIST } |${ NODE_MODULES } )` ;
25
27
26
28
const 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 } ` , "" ) ;
32
34
33
35
const STYLE_SKIPS = `+(${ NODE_MODULES } )` ;
34
36
35
-
36
37
function clean ( ) {
37
38
return gulp
38
39
. src ( `./packages/+(${ JS_PKGS } )/+(${ LIB } |${ DIST } )` , { allowEmpty : true } )
@@ -43,45 +44,69 @@ function scripts() {
43
44
return gulp
44
45
. src ( [
45
46
`./packages/+(${ JS_PKGS } )/**/*.js` ,
46
- `!packages/+(${ JS_PKGS } )/${ JS_SKIPS } /**/*.js`
47
+ `!packages/+(${ JS_PKGS } )/${ JS_SKIPS } /**/*.js` ,
47
48
] )
48
49
. 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
+ )
56
59
. pipe ( gulp . dest ( PKG_PATH ) ) ;
57
60
}
58
61
59
62
function styles ( ) {
60
63
return gulp
61
64
. src ( [
62
65
`./packages/+(${ STYLE_PKGS } )/style/**/*.scss` ,
63
- `!packages/+(${ STYLE_PKGS } )/${ STYLE_SKIPS } /**/*.scss`
66
+ `!packages/+(${ STYLE_PKGS } )/${ STYLE_SKIPS } /**/*.scss` ,
64
67
] )
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
+ )
69
74
. 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
+ )
74
81
. pipe ( gulp . dest ( PKG_PATH ) ) ;
75
82
}
76
83
77
84
function umd ( done ) {
78
85
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 %>" ] ) )
85
110
) ( ) ;
86
111
done ( ) ;
87
112
}
@@ -90,5 +115,5 @@ const buildJS = gulp.parallel(umd, scripts);
90
115
const buildCSS = styles ;
91
116
const build = gulp . series ( clean , gulp . parallel ( buildJS , buildCSS ) ) ;
92
117
93
- gulp . task ( ' prod' , build ) ;
94
- gulp . task ( ' default' , build ) ;
118
+ gulp . task ( " prod" , build ) ;
119
+ gulp . task ( " default" , build ) ;
0 commit comments