forked from the-darc/angular-virtual-keyboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
80 lines (68 loc) · 1.72 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
var gulp = require('gulp'),
path = require('path'),
jshintReporter = require('jshint-stylish'),
plugins = require('gulp-load-plugins')({
config: path.join(__dirname, 'package.json')
});
var path = {
src: {
files: 'src/**/*.js'
}
}
gulp.task('jshint', function(done) {
gulp.src(path.src.files)
.pipe(plugins.jshint('.jshintrc'))
.pipe(plugins.jshint.reporter(jshintReporter));
done();
});
gulp.task('build', function() {
var pkg = require('./bower.json');
var header = ['/**',
' * <%= pkg.name %>',
' * <%= pkg.description %>',
' * @version v<%= pkg.version %>',
' * @author <%= pkg.author %>',
' * @link <%= pkg.homepage %>',
' * @license <%= pkg.license %>',
' */',
'(function (angular) {',
'',
''].join('\n');
var footer = [
'',
'})(angular);',
''].join('\n');
gulp.src([
'src/vki-core.js',
'src/angular-virtual-keyboard.js'
])
.pipe(plugins.concat('angular-virtual-keyboard.js'))
.pipe(plugins.header(header, {pkg: pkg}))
.pipe(plugins.footer(footer))
.pipe(gulp.dest('./release/'))
.pipe(plugins.uglify())
.pipe(plugins.concat('angular-virtual-keyboard.min.js'))
.pipe(gulp.dest('./release/'));
gulp.src('css/angular-virtual-keyboard.css')
.pipe(gulp.dest('./release/'));
});
gulp.task('default', ['jshint', 'build'], function() {
gulp.watch(path.src.files, ['jshint', 'build']);
});
gulp.task('changelog', function(done) {
var pkg = require('./bower.json');
var changelog = require('conventional-changelog');
var fs = require('fs');
var options = {
repository: pkg.homepage,
version: pkg.version,
file: 'CHANGELOG.md'
};
var filePath = './' + options.file;
changelog(options, function(err, log) {
if (err) {
throw err;
}
fs.writeFile(filePath, log, done);
});
});