This repository has been archived by the owner on Nov 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 83
/
gulpfile.js
92 lines (85 loc) · 2.22 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
89
90
91
92
const gulp = require('gulp');
const rename = require('gulp-rename');
const uglify = require('gulp-uglify');
const umd = require('gulp-umd');
const pump = require('pump');
const del = require('del');
const banner = require('gulp-banner');
const ngAnnotate = require('gulp-ng-annotate');
const karma = require('karma').Server;
const runSequence = require('run-sequence');
const package = require('./package.json');
const date = new Date();
const license = `/**
* ${package.name} - ${package.homepage}
* Copyright (c) ${date.getFullYear()} Carl Craig
* Dual licensed with the Apache-2.0 or MIT license.
*/
`;
gulp.task('watch', () => {
return gulp.watch('./src/**/*', ['build']);
});
gulp.task('build', ['clean'], (cb) => {
pump(
[
gulp.src('src/tc-angular-chartjs.js'),
ngAnnotate(),
umd({
exports: function(file) {
return 'TcChartjsFactory';
},
namespace: function(file) {
return 'tcAngularChartjs';
},
dependencies: function(file) {
return [
{
name: 'angular',
amd: 'angular',
cjs: 'angular',
global: 'angular',
param: 'angular'
},
{
name: 'chart.js',
amd: 'chart.js',
cjs: 'chart.js',
global: 'Chart',
param: 'Chart'
}
];
}
}),
banner(license),
gulp.dest('dist'),
uglify({
preserveComments: 'license'
}),
rename('tc-angular-chartjs.min.js'),
gulp.dest('dist')
],
cb
);
});
gulp.task('clean', () => {
return del([
'dist/**/*'
]);
})
gulp.task('test', (cb) => {
runSequence('test:angular-1-5', 'test:angular-1-2', cb);
});
gulp.task('test:angular-1-5', (cb) => {
new karma({
configFile: __dirname + '/test/angular-1-5/karma.conf.js',
singleRun: true,
browsers: ['PhantomJS']
}, cb).start();
});
gulp.task('test:angular-1-2', (cb) => {
new karma({
configFile: __dirname + '/test/angular-1-2/karma.conf.js',
singleRun: true,
browsers: ['PhantomJS']
}, cb).start();
});