/
gulpfile.js
74 lines (62 loc) · 2.29 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
62
63
64
65
66
67
68
69
70
71
72
73
const headerTemplate = '// <%= pkg.name %> v<%= pkg.version %>\n';
const gulp = require('gulp');
const header = require('gulp-header');
const pkg = require('./package.json');
const del = require('del');
const ngc = require('gulp-ngc');
const runSequence = require('run-sequence');
const rename = require("gulp-rename");
gulp.task('clean', function () {
return del(['aot/**', '!aot',
'dist/**', '!dist',
'./main.metadata.json', './main.js*', './main.d.ts']);
});
/*
* ngc compilation tasks
*/
gulp.task('clean-ngc', (callback) => {
return runSequence('clean', 'ngc', callback);
});
gulp.task('ngc', (callback) => {
return runSequence('ngc-src', 'ngc-main', callback);
});
gulp.task('ngc-src', (callback) => {
return ngc('./tsconfig-src.json', callback);
});
gulp.task('clean-build-main', ['build-main'], (callback) => {
// post build cleanup
return del(['./aot', 'exports.js*', 'exports.d.ts', 'exports.metadata.json', './src/*.js*', './src/*.d.ts', './src/*.metadata.*'], callback);
});
gulp.task('build-main', ['ngc-main'], (callback) => {
// this is here to facilitate the case where ag-grid-angular is symlinked into another project
// if we have main.ts and leave it as that the the project that depends on ag-grid-angular (again, only if symlinked)
// will complain about node_modules/ag-grid-angular/main.ts not being part of the source files
gulp.src("./exports.js")
.pipe(rename(('main.js')))
.pipe(gulp.dest("./"));
gulp.src("./exports.d.ts")
.pipe(rename(('main.d.ts')))
.pipe(gulp.dest("./"));
return gulp.src("./exports.metadata.json")
.pipe(rename(('main.metadata.json')))
.pipe(gulp.dest("./"));
});
gulp.task('ngc-main', (callback) => {
return gulp
.src('./exports.ts')
.pipe(ngc('./tsconfig-main.json', callback));
});
gulp.task('watch', ['ngc-src'], () => {
gulp.watch([
'./src/*.ts',
'./node_modules/ag-grid-community/dist/lib/**/*'
],
['ngc-src']);
});
// the main release task - clean, compile and add header template
gulp.task('release', ['clean-ngc'], function () {
require('./agGridPropertiesCheck');
gulp.src(['./dist/', '!./dist/**/*.metadata.json'])
.pipe(header(headerTemplate, {pkg: pkg}))
.pipe(gulp.dest('./dist/'));
});