forked from outsideris/angular-summernote
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
113 lines (98 loc) · 3.07 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
var gulp = require('gulp'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
rename = require("gulp-rename"),
header = require("gulp-header"),
Server = require('karma').Server,
coveralls = require('gulp-coveralls'),
del = require('del'),
nugetpack = require('gulp-nuget-pack'),
pkg = require('./package.json');
var banner = '/* angular-summernote v<%=pkg.version%> | (c) 2016 JeongHoon Byun | MIT license */\n';
var isAngular12 = isAngular13 = isAngular14 = false;
gulp.task('lint', function() {
return gulp.src(['./src/**/*.js', './test/**/*.test.js'])
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'));
});
gulp.task('copy', function() {
return gulp.src('./src/angular-summernote.js')
.pipe(header(banner, {pkg: pkg}))
.pipe(gulp.dest('dist'));
});
gulp.task('build', ['copy'], function() {
return gulp.src('./src/angular-summernote.js')
.pipe(uglify({mangle: false}))
.pipe(rename({extname: '.min.js'}))
.pipe(header(banner, {pkg: pkg}))
.pipe(gulp.dest('dist'));
});
gulp.task('karma', function (done) {
var configFile = '/test/karma.conf.js';
if (isAngular12) { configFile = '/test/karma-angular-1-2-x.conf.js'; }
if (isAngular13) { configFile = '/test/karma-angular-1-3-x.conf.js'; }
if (isAngular14) { configFile = '/test/karma-angular-1-4-x.conf.js'; }
if (!process.env.CI) {
new Server({
configFile: __dirname + configFile,
autoWatch: true
}, done).start();
} else {
new Server({
configFile: __dirname + configFile,
browsers: ['PhantomJS'],
singleRun: true
}, done).start();
}
});
gulp.task('test', function() {
gulp.start('karma');
});
gulp.task('test:angular12', function() {
isAngular12 = true;
gulp.start('karma');
});
gulp.task('test:angular13', function() {
isAngular13 = true;
gulp.start('karma');
});
gulp.task('test:angular14', function() {
isAngular14 = true;
gulp.start('karma');
});
gulp.task('test:coverage', function(done) {
var configFile = '/test/karma.conf.js';
new Server({
configFile: __dirname + configFile,
singleRun: true,
browsers: ['PhantomJS'],
reporters: ['progress', 'coverage'],
preprocessors: { '../**/src/**/*.js': 'coverage' },
coverageReporter: { type: 'lcov', dir: '../coverage/' },
plugins: [ 'karma-*' ]
}, done).start();
});
gulp.task('clean:coverage', function () {
return del([
'coverage'
]);
});
gulp.task('coveralls', ['clean:coverage', 'test:coverage'], function() {
return gulp.src('./coverage/**/lcov.info')
.pipe(coveralls());
});
gulp.task('travis', ['test', 'test:angular12', 'test:angular13', 'test:angular14'], function() {
});
gulp.task('nuget-pack', function(done) {
nugetpack({
id: "Angular.Summernote",
version: pkg.version,
authors: pkg.author.name,
description: pkg.description,
projectUrl: pkg.homepage,
licenseUrl: "https://github.com/summernote/angular-summernote/blob/master/LICENSE-MIT",
copyright: "MIT",
tags: pkg.keywords.join(' '),
outputDir: "out"
}, ['dist/*.js', 'README.md' ], done);
});