-
Notifications
You must be signed in to change notification settings - Fork 5
/
gulpfile.js
88 lines (87 loc) · 4.05 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
var gulp = require('gulp');
var filesExist = require('files-exist');
var concat = require('gulp-concat');
var babel = require('gulp-babel');
var maps = require('gulp-sourcemaps');
var uglifyes = require('uglify-es');
var composer = require('gulp-uglify/composer');
var uglify = composer(uglifyes, console);
gulp.task('build_flot_plugins', function () {
'use strict';
var src1 = ['source/**'];
var src2 = ['examples/**'];
var src3 = ['styles/**'];
var src4 = ['docs/**'];
gulp.src(filesExist(src1, { exceptionMessage: 'Missing file' }))
.pipe(gulp.dest('dist/source'));
gulp.src(filesExist(src2, { exceptionMessage: 'Missing file' }))
.pipe(gulp.dest('dist/examples'));
gulp.src(filesExist(src3, { exceptionMessage: 'Missing file' }))
.pipe(gulp.dest('dist/styles'));
return gulp.src(filesExist(src4, { exceptionMessage: 'Missing file' }))
.pipe(gulp.dest('dist/docs'));
});
gulp.task('build_charting', function () {
'use strict';
var src = [
'lib/cbuffer.js',
'source/NationalInstruments/jquery.flot.historybuffer.js',
'source/NationalInstruments/jquery.flot.historybuffer.numeric.js',
'source/NationalInstruments/jquery.flot.historybuffer.analogWaveform.js',
'source/NationalInstruments/jquery.flot.segment-tree.js',
'source/NationalInstruments/jquery.flot.charting.js'
];
return gulp.src(filesExist(src, { exceptionMessage: 'Missing file' }))
.pipe(concat('jquery.flot.charting.js'))
.pipe(gulp.dest('dist/source/NationalInstruments'));
});
gulp.task('build_charting2', function () {
var src2 = [
'source/NationalInstruments/jquery.flot.scattergraph.js',
'source/NationalInstruments/jquery.thumb.js',
'source/NationalInstruments/jquery.flot.cursors.js',
'source/NationalInstruments/jquery.flot.axishandle.js',
'source/NationalInstruments/jquery.flot.parkinglot.js',
'source/NationalInstruments/jquery.flot.range.cursors.js',
'source/NationalInstruments/jquery.flot.intensitygraph.js',
'source/NationalInstruments/jquery.flot.digitalWaveform.js',
'source/NationalInstruments/jquery.flot.digitalAxis.js',
'source/NationalInstruments/jquery.flot.highlights.js',
'source/NationalInstruments/jquery.flot.annotations.js',
'source/NationalInstruments/jquery.flot.scrollbar.js',
'dist/source/NationalInstruments/jquery.flot.charting.js'
];
return gulp.src(filesExist(src2, { exceptionMessage: 'Missing file' }))
.pipe(maps.init())
.pipe(babel({
presets: ['@babel/env']
}))
.pipe(concat('jquery.flot.plugins.js'))
.pipe(uglify())
.pipe(maps.write('./'))
.pipe(gulp.dest('dist/es5/NationalInstruments'));
});
gulp.task('build_charting_es6', function () {
var src2 = [
'source/NationalInstruments/jquery.flot.scattergraph.js',
'source/NationalInstruments/jquery.thumb.js',
'source/NationalInstruments/jquery.flot.cursors.js',
'source/NationalInstruments/jquery.flot.axishandle.js',
'source/NationalInstruments/jquery.flot.parkinglot.js',
'source/NationalInstruments/jquery.flot.range.cursors.js',
'source/NationalInstruments/jquery.flot.intensitygraph.js',
'source/NationalInstruments/jquery.flot.digitalWaveform.js',
'source/NationalInstruments/jquery.flot.digitalAxis.js',
'source/NationalInstruments/jquery.flot.highlights.js',
'source/NationalInstruments/jquery.flot.annotations.js',
'source/NationalInstruments/jquery.flot.scrollbar.js',
'dist/source/NationalInstruments/jquery.flot.charting.js'
];
return gulp.src(filesExist(src2, { exceptionMessage: 'Missing file' }))
.pipe(maps.init())
.pipe(concat('jquery.flot.plugins.min.js'))
.pipe(uglify({ecma: 6}))
.pipe(maps.write('./'))
.pipe(gulp.dest('dist/es6_minified/NationalInstruments'));
});
gulp.task('build', gulp.series('build_charting', 'build_charting2', 'build_charting_es6', 'build_flot_plugins'));