forked from dieface/ag-grid-react
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
61 lines (52 loc) · 1.79 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
const gulp = require('gulp');
const gulpTypescript = require('gulp-typescript');
const header = require('gulp-header');
const merge = require('merge2');
const pkg = require('./package.json');
const tsConfig = 'tsconfig.json';
const rename = require('gulp-rename');
const headerTemplate = '// <%= pkg.name %> v<%= pkg.version %>\n';
const tsProject = gulpTypescript.createProject(tsConfig);
gulp.task('default', ['commonjs', 'umd']);
gulp.task('commonjs', tscTask)
function tscTask() {
const tsResult = gulp.src('src/**/*.ts').pipe(tsProject());
return merge([
tsResult.dts.pipe(header(headerTemplate, {pkg: pkg})).pipe(gulp.dest('lib')),
tsResult.js.pipe(header(headerTemplate, {pkg: pkg})).pipe(gulp.dest('lib'))
]);
}
gulp.task('publishForCI', () => {
return gulp
.src('./ag-grid-react*.tgz')
.pipe(rename('ag-grid-react.tgz'))
.pipe(gulp.dest('c:/ci/ag-grid-react/'));
});
var typescript = require('rollup-plugin-typescript');
const commonjs = require('rollup-plugin-commonjs');
var uglify = require('rollup-plugin-uglify');
var rollup = require('rollup-stream');
var source = require('vinyl-source-stream');
gulp.task('umd', () => {
return rollup({
entry: './src/main.ts',
rollup: require('rollup'),
output: {
name: 'AgGridReact',
file: 'my-file.umd.js',
format: 'umd',
globals: {
'react-dom-factories': 'ReactDOMFactories',
react: 'React',
'react-dom': 'ReactDOM',
'prop-types': 'PropTypes',
'ag-grid': 'agGrid'
}
},
plugins: [typescript(), commonjs(),
uglify()
]
})
.pipe(source('ag-grid-react.min.js'))
.pipe(gulp.dest('./umd'));
});