|
1 | 1 | var gulp = require('gulp'),
|
2 |
| - path = require('path'), |
3 |
| - jshintReporter = require('jshint-stylish'), |
4 |
| - plugins = require('gulp-load-plugins')({ |
5 |
| - config: path.join(__dirname, 'package.json') |
6 |
| - }); |
| 2 | + path = require('path'), |
| 3 | + jshintReporter = require('jshint-stylish'), |
| 4 | + plugins = require('gulp-load-plugins')({ |
| 5 | + config: path.join(__dirname, 'package.json') |
| 6 | + }); |
7 | 7 |
|
8 | 8 | var sctiptPath = {
|
9 |
| - src: { |
10 |
| - files: 'src/js/**/*.js' |
11 |
| - } |
| 9 | + src: { |
| 10 | + files: 'src/js/**/*.js' |
| 11 | + } |
12 | 12 | };
|
13 | 13 |
|
14 |
| -gulp.task('jshint', function(done) { |
15 |
| - gulp.src(sctiptPath.src.files) |
16 |
| - .pipe(plugins.jshint('.jshintrc')) |
17 |
| - .pipe(plugins.jshint.reporter(jshintReporter)); |
18 |
| - done(); |
| 14 | +gulp.task('jshint', function (done) { |
| 15 | + gulp |
| 16 | + .src(sctiptPath.src.files) |
| 17 | + .pipe(plugins.jshint('.jshintrc')) |
| 18 | + .pipe(plugins.jshint.reporter(jshintReporter)); |
| 19 | + done(); |
19 | 20 | });
|
20 | 21 |
|
21 |
| -gulp.task('build', function() { |
22 |
| - var pkg = require('./bower.json'); |
| 22 | +gulp.task('build', function () { |
| 23 | + var pkg = require('./bower.json'); |
23 | 24 |
|
24 |
| - var header = ['/**', |
25 |
| - ' * <%= pkg.name %>', |
26 |
| - ' * <%= pkg.description %>', |
27 |
| - ' * @version v<%= pkg.version %>', |
28 |
| - ' * @author <%= pkg.author %>', |
29 |
| - ' * @link <%= pkg.homepage %>', |
30 |
| - ' * @license <%= pkg.license %>', |
31 |
| - ' */', |
32 |
| - '(function (angular) {', |
33 |
| - '', |
34 |
| - ''].join('\n'); |
| 25 | + var header = ['/**', |
| 26 | + ' * <%= pkg.name %>', |
| 27 | + ' * <%= pkg.description %>', |
| 28 | + ' * @version v<%= pkg.version %>', |
| 29 | + ' * @author <%= pkg.author %>', |
| 30 | + ' * @link <%= pkg.homepage %>', |
| 31 | + ' * @license <%= pkg.license %>', |
| 32 | + ' */', |
| 33 | + '(function (angular) {', |
| 34 | + '', |
| 35 | + ''].join('\n'); |
35 | 36 |
|
36 |
| - var footer = [ |
37 |
| - '', |
38 |
| - '})(angular);', |
39 |
| - ''].join('\n'); |
| 37 | + var footer = [ |
| 38 | + '', |
| 39 | + '})(angular);', |
| 40 | + ''].join('\n'); |
40 | 41 |
|
41 |
| - gulp.src([ |
42 |
| - 'src/js/vki-core.js', |
43 |
| - 'src/js/mdKeyboard.js' |
44 |
| - ]) |
45 |
| - .pipe(plugins.concat('mdKeyboard.js')) |
46 |
| - .pipe(plugins.header(header, {pkg: pkg})) |
47 |
| - .pipe(plugins.footer(footer)) |
48 |
| - .pipe(gulp.dest('./dist/')) |
49 |
| - .pipe(plugins.uglify()) |
50 |
| - .pipe(plugins.concat('mdKeyboard.min.js')) |
51 |
| - .pipe(gulp.dest('./dist/')); |
| 42 | + gulp |
| 43 | + .src([ |
| 44 | + 'src/js/mdKeyboard.js' |
| 45 | + ]) |
| 46 | + .pipe(plugins.concat('mdKeyboard.js')) |
| 47 | + .pipe(plugins.header(header, {pkg: pkg})) |
| 48 | + .pipe(plugins.footer(footer)) |
| 49 | + .pipe(plugins.replace(/[\r\n]+\s*\/\/.*TODO:+.*/gi, '')) |
| 50 | + .pipe(gulp.dest('./dist/')) |
| 51 | + .pipe(plugins.uglify()) |
| 52 | + .pipe(plugins.concat('mdKeyboard.min.js')) |
| 53 | + .pipe(gulp.dest('./dist/')); |
52 | 54 |
|
53 |
| - gulp.src('src/css/mdKeyboard.css') |
54 |
| - .pipe(gulp.dest('./dist/')); |
| 55 | + gulp.src('src/css/mdKeyboard.css') |
| 56 | + .pipe(gulp.dest('./dist/')); |
55 | 57 | });
|
56 | 58 |
|
57 |
| -gulp.task('default', ['jshint', 'build'], function() { |
58 |
| - gulp.watch(sctiptPath.src.files, ['jshint', 'build']); |
| 59 | +gulp.task('default', ['jshint', 'build'], function () { |
| 60 | + gulp.watch(sctiptPath.src.files, ['jshint', 'build']); |
59 | 61 | });
|
60 | 62 |
|
61 |
| -gulp.task('changelog', function(done) { |
62 |
| - var pkg = require('./bower.json'); |
63 |
| - var changelog = require('conventional-changelog'); |
64 |
| - var fs = require('fs'); |
| 63 | +gulp.task('changelog', function (done) { |
| 64 | + var pkg = require('./bower.json'); |
| 65 | + var changelog = require('conventional-changelog'); |
| 66 | + var fs = require('fs'); |
65 | 67 |
|
66 |
| - var options = { |
67 |
| - repository: pkg.homepage, |
68 |
| - version: pkg.version, |
69 |
| - file: 'CHANGELOG.md' |
70 |
| - }; |
| 68 | + var options = { |
| 69 | + repository: pkg.homepage, |
| 70 | + version: pkg.version, |
| 71 | + file: 'CHANGELOG.md' |
| 72 | + }; |
71 | 73 |
|
72 |
| - var filePath = './' + options.file; |
73 |
| - changelog(options, function(err, log) { |
74 |
| - if (err) { |
75 |
| - throw err; |
76 |
| - } |
| 74 | + var filePath = './' + options.file; |
| 75 | + changelog(options, function (err, log) { |
| 76 | + if (err) { |
| 77 | + throw err; |
| 78 | + } |
77 | 79 |
|
78 |
| - fs.writeFile(filePath, log, done); |
79 |
| - }); |
| 80 | + fs.writeFile(filePath, log, done); |
| 81 | + }); |
80 | 82 | });
|
0 commit comments