Stop using the deprecated gulp-util
module
The `gulp-util` module is now deprecated and authors are asked to stop using it (refer to https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5 for more information). PDF.js does not rely on it that much, fortunately, so it's relatively easy for us to remove the dependency. This patch does that by making the following changes: - Require `gulp-zip` version 4.1.0 or higher since they already removed their `gulp-util` dependency in that version. - Replace `gulp-util.log` with the `fancylog` module as recommended in the article above. - Replace `gulp-util.File` with the `Vinyl` module as recommended in the article above. The only change I had to make for Vinyl is removing the `base` and `cwd` lines since they may not be empty strings anymore. This way we fall back to the defaults Vinyl provides, which for us doesn't matter since we move the file afterwards anyway. Moreover, I used `vfs` for `vinyl-fs` in the `Gulpfile` to avoid confusion with `vinyl` (which is also how the documentation names the variable). This is all we can do on our side; the other modules that still use `gulp-util` must be updated upstream.
This commit is contained in:
parent
4cc0f8c721
commit
d688b8ea31
25
gulpfile.js
25
gulpfile.js
@ -18,9 +18,9 @@
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
var fancylog = require('fancy-log');
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var gulp = require('gulp');
|
var gulp = require('gulp');
|
||||||
var gutil = require('gulp-util');
|
|
||||||
var rename = require('gulp-rename');
|
var rename = require('gulp-rename');
|
||||||
var replace = require('gulp-replace');
|
var replace = require('gulp-replace');
|
||||||
var transform = require('gulp-transform');
|
var transform = require('gulp-transform');
|
||||||
@ -36,7 +36,8 @@ var merge = require('merge-stream');
|
|||||||
var zip = require('gulp-zip');
|
var zip = require('gulp-zip');
|
||||||
var webpack2 = require('webpack');
|
var webpack2 = require('webpack');
|
||||||
var webpackStream = require('webpack-stream');
|
var webpackStream = require('webpack-stream');
|
||||||
var vinyl = require('vinyl-fs');
|
var Vinyl = require('vinyl');
|
||||||
|
var vfs = require('vinyl-fs');
|
||||||
|
|
||||||
var BUILD_DIR = 'build/';
|
var BUILD_DIR = 'build/';
|
||||||
var L10N_DIR = 'l10n/';
|
var L10N_DIR = 'l10n/';
|
||||||
@ -108,9 +109,7 @@ function safeSpawnSync(command, parameters, options) {
|
|||||||
function createStringSource(filename, content) {
|
function createStringSource(filename, content) {
|
||||||
var source = stream.Readable({ objectMode: true, });
|
var source = stream.Readable({ objectMode: true, });
|
||||||
source._read = function () {
|
source._read = function () {
|
||||||
this.push(new gutil.File({
|
this.push(new Vinyl({
|
||||||
cwd: '',
|
|
||||||
base: '',
|
|
||||||
path: filename,
|
path: filename,
|
||||||
contents: new Buffer(content),
|
contents: new Buffer(content),
|
||||||
}));
|
}));
|
||||||
@ -1217,10 +1216,10 @@ gulp.task('gh-pages-prepare', ['web-pre'], function () {
|
|||||||
|
|
||||||
rimraf.sync(GH_PAGES_DIR);
|
rimraf.sync(GH_PAGES_DIR);
|
||||||
|
|
||||||
// 'vinyl' because web/viewer.html needs its BOM.
|
// 'vfs' because web/viewer.html needs its BOM.
|
||||||
return merge([
|
return merge([
|
||||||
vinyl.src(GENERIC_DIR + '**/*', { base: GENERIC_DIR, stripBOM: false, })
|
vfs.src(GENERIC_DIR + '**/*', { base: GENERIC_DIR, stripBOM: false, })
|
||||||
.pipe(gulp.dest(GH_PAGES_DIR)),
|
.pipe(gulp.dest(GH_PAGES_DIR)),
|
||||||
gulp.src([FIREFOX_BUILD_DIR + '*.xpi',
|
gulp.src([FIREFOX_BUILD_DIR + '*.xpi',
|
||||||
FIREFOX_BUILD_DIR + '*.rdf'])
|
FIREFOX_BUILD_DIR + '*.rdf'])
|
||||||
.pipe(gulp.dest(GH_PAGES_DIR + EXTENSION_SRC_DIR + 'firefox/')),
|
.pipe(gulp.dest(GH_PAGES_DIR + EXTENSION_SRC_DIR + 'firefox/')),
|
||||||
@ -1340,9 +1339,9 @@ gulp.task('dist-pre',
|
|||||||
.pipe(gulp.dest('build/dist/')),
|
.pipe(gulp.dest('build/dist/')),
|
||||||
packageJsonSrc.pipe(gulp.dest(DIST_DIR)),
|
packageJsonSrc.pipe(gulp.dest(DIST_DIR)),
|
||||||
bowerJsonSrc.pipe(gulp.dest(DIST_DIR)),
|
bowerJsonSrc.pipe(gulp.dest(DIST_DIR)),
|
||||||
vinyl.src('external/dist/**/*',
|
vfs.src('external/dist/**/*',
|
||||||
{ base: 'external/dist', stripBOM: false, })
|
{ base: 'external/dist', stripBOM: false, })
|
||||||
.pipe(gulp.dest(DIST_DIR)),
|
.pipe(gulp.dest(DIST_DIR)),
|
||||||
gulp.src(GENERIC_DIR + 'LICENSE')
|
gulp.src(GENERIC_DIR + 'LICENSE')
|
||||||
.pipe(gulp.dest(DIST_DIR)),
|
.pipe(gulp.dest(DIST_DIR)),
|
||||||
gulp.src(GENERIC_DIR + 'web/cmaps/**/*',
|
gulp.src(GENERIC_DIR + 'web/cmaps/**/*',
|
||||||
@ -1461,10 +1460,10 @@ gulp.task('mozcentraldiff', ['mozcentral', 'mozcentralbaseline'],
|
|||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('externaltest', function () {
|
gulp.task('externaltest', function () {
|
||||||
gutil.log('Running test-fixtures.js');
|
fancylog('Running test-fixtures.js');
|
||||||
safeSpawnSync('node', ['external/builder/test-fixtures.js'],
|
safeSpawnSync('node', ['external/builder/test-fixtures.js'],
|
||||||
{ stdio: 'inherit', });
|
{ stdio: 'inherit', });
|
||||||
gutil.log('Running test-fixtures_esprima.js');
|
fancylog('Running test-fixtures_esprima.js');
|
||||||
safeSpawnSync('node', ['external/builder/test-fixtures_esprima.js'],
|
safeSpawnSync('node', ['external/builder/test-fixtures_esprima.js'],
|
||||||
{ stdio: 'inherit', });
|
{ stdio: 'inherit', });
|
||||||
});
|
});
|
||||||
|
@ -12,12 +12,12 @@
|
|||||||
"eslint": "^4.10.0",
|
"eslint": "^4.10.0",
|
||||||
"eslint-plugin-mozilla": "^0.4.9",
|
"eslint-plugin-mozilla": "^0.4.9",
|
||||||
"eslint-plugin-no-unsanitized": "^2.0.1",
|
"eslint-plugin-no-unsanitized": "^2.0.1",
|
||||||
|
"fancy-log": "^1.3.2",
|
||||||
"gulp": "^3.9.1",
|
"gulp": "^3.9.1",
|
||||||
"gulp-rename": "^1.2.2",
|
"gulp-rename": "^1.2.2",
|
||||||
"gulp-replace": "^0.6.1",
|
"gulp-replace": "^0.6.1",
|
||||||
"gulp-transform": "^3.0.5",
|
"gulp-transform": "^3.0.5",
|
||||||
"gulp-util": "^3.0.8",
|
"gulp-zip": "^4.1.0",
|
||||||
"gulp-zip": "^4.0.0",
|
|
||||||
"jasmine": "^2.8.0",
|
"jasmine": "^2.8.0",
|
||||||
"jasmine-core": "^2.8.0",
|
"jasmine-core": "^2.8.0",
|
||||||
"jsdoc": "^3.5.5",
|
"jsdoc": "^3.5.5",
|
||||||
@ -31,6 +31,7 @@
|
|||||||
"ttest": "^1.1.0",
|
"ttest": "^1.1.0",
|
||||||
"typogr": "^0.6.7",
|
"typogr": "^0.6.7",
|
||||||
"uglify-es": "^3.1.2",
|
"uglify-es": "^3.1.2",
|
||||||
|
"vinyl": "^2.1.0",
|
||||||
"vinyl-fs": "^2.4.4",
|
"vinyl-fs": "^2.4.4",
|
||||||
"webpack": "^3.6.0",
|
"webpack": "^3.6.0",
|
||||||
"webpack-stream": "^4.0.0",
|
"webpack-stream": "^4.0.0",
|
||||||
|
Loading…
Reference in New Issue
Block a user