Skip to content

Commit 78b1310

Browse files
committed
chore(build): update gulp version
1 parent 719cd34 commit 78b1310

File tree

4 files changed

+4451
-4034
lines changed

4 files changed

+4451
-4034
lines changed

dist/angular-screenfull.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gulpfile.js

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
var gulp = require('gulp'),
2-
concat = require('gulp-concat'),
3-
uglify = require('gulp-uglify'),
4-
gulpDocs = require('gulp-ngdocs'),
5-
clean = require('gulp-clean'),
6-
rename = require('gulp-rename');
1+
const gulp = require('gulp');
2+
const concat = require('gulp-concat');
3+
const uglify = require('gulp-uglify');
4+
const gulpDocs = require('gulp-ngdocs');
5+
const clean = require('gulp-clean');
6+
const rename = require('gulp-rename');
7+
const through = require('through2');
8+
const File = require('vinyl');
79

810
var fs = require('fs');
911

@@ -18,22 +20,22 @@ var target = {
1820
docs: env.docs || './docs'
1921
};
2022

21-
gulp.task('process-scripts', function() {
23+
function processScripts () {
2224
return gulp.src('./src/**/*.js')
2325
.pipe(concat('angular-screenfull.js'))
2426
.pipe(gulp.dest('./dist/'))
2527
.pipe(uglify())
2628
.pipe(rename({suffix: '.min'}))
2729
.pipe(gulp.dest('./dist/'));
30+
};
2831

29-
});
32+
const watch = function() {
33+
gulp.watch('./src/**/*.js', gulp.series(processScripts, ngdocs));
34+
};
3035

31-
gulp.task('watch', function() {
32-
gulp.watch('./src/**/*.js', ['process-scripts', 'ngdocs']);
36+
exports.watch = watch;
3337

34-
});
35-
36-
gulp.task('ngdocs', ['clean-ngdocs'], function () {
38+
const ngdocs = gulp.series(cleanNgdocs, function ngdocs () {
3739
var options = {
3840
html5Mode: false,
3941
analytics: {
@@ -47,14 +49,28 @@ gulp.task('ngdocs', ['clean-ngdocs'], function () {
4749
};
4850
return gulp.src(['./src/**/*.js', './src/**/*.ngdoc'])
4951
.pipe(gulpDocs.process(options))
52+
.pipe(upgradeVynil())
5053
.pipe(gulp.dest(target.docs));
5154
});
5255

53-
gulp.task('clean-ngdocs', function() {
56+
/**
57+
* gulp-watch/vinyl-source-stream uses an outdated vinyl, which doesn't have some functions which vinyl-fs expects.
58+
* Can be removed when gulp-watch updates it to vinyl 2.x.
59+
* @returns {NodeJS.ReadWriteStream}
60+
*/
61+
function upgradeVynil() {
62+
return through.obj(function(file, encoding, cb) {
63+
const upgradedFile = new File(file);
64+
cb(null, upgradedFile);
65+
});
66+
}
67+
68+
exports.ngdocs = ngdocs;
69+
function cleanNgdocs() {
5470
return gulp.src(target.docs + '/*', {read:false})
5571
.pipe(clean({force: true}));
56-
});
72+
}
5773

58-
gulp.task('release', ['process-scripts', 'ngdocs']);
74+
exports.release = gulp.series(processScripts, ngdocs);
75+
exports.default = gulp.series(processScripts, ngdocs, watch);
5976

60-
gulp.task('default', ['process-scripts', 'ngdocs', 'watch']);

0 commit comments

Comments
 (0)