|
1 | 1 |
|
2 | 2 | const gulp = require("gulp"); |
3 | 3 | const clean = require('gulp-clean'); |
4 | | -const runSequence = require('run-sequence'); |
| 4 | +const runSequence = require('gulp4-run-sequence'); |
5 | 5 | const rename = require("gulp-rename"); |
6 | 6 | const through = require('through2'); |
7 | 7 | const gulpif = require('gulp-if'); |
8 | 8 | const lazypipe = require('lazypipe'); |
9 | | -const buffer = require("vinyl-buffer"); |
| 9 | +const vinylString = require("vinyl-string"); |
10 | 10 | const source = require('vinyl-source-stream'); |
11 | 11 | const filter = require('gulp-filter'); |
12 | 12 | const debug = require('gulp-debug'); |
@@ -139,7 +139,7 @@ var WebPack = (function() { |
139 | 139 | module: { |
140 | 140 | loaders: [{ |
141 | 141 | test: /\.css$/, |
142 | | - loader: __dirname+"/node_modules/style-loader!"+__dirname+"/node_modules/css-loader?importLoaders=1" |
| 142 | + loader: __dirname+"/node_modules/style-loader!"+__dirname+"/node_modules/css-loader?importLoaders=true" |
143 | 143 | },{ |
144 | 144 | test: /\.(png|woff|woff2|eot|ttf|svg)$/, |
145 | 145 | loaders: [__dirname+"/node_modules/url-loader?limit=100000"] |
@@ -308,10 +308,9 @@ gulp.task("make-i86n-keys",function(callback) { |
308 | 308 | }); |
309 | 309 | Promise.all(promises) |
310 | 310 | .then(()=>{ |
311 | | - var stream = source('weh-i18n-keys.js'); |
312 | | - stream.end('module.exports = ' + stringify(keys,{ space: ' ' })); |
313 | | - stream |
314 | | - .pipe(buffer()) |
| 311 | + vinylString('module.exports = ' + stringify(keys,{ space: ' ' }),{ |
| 312 | + path: 'weh-i18n-keys.js' |
| 313 | + }) |
315 | 314 | .pipe(gulp.dest(buildTmpModDir)) |
316 | 315 | .on('end',callback); |
317 | 316 | }) |
@@ -361,22 +360,23 @@ gulp.task("watch-src",function(callback) { |
361 | 360 | ); |
362 | 361 | }); |
363 | 362 |
|
364 | | -gulp.task("watch", function() { |
365 | | - gulp.watch([srcDir+"/**/*",srcModDir+"/**/*","src/**/*",__dirname+"/src/**/*"],["watch-src"]); |
366 | | - gulp.watch(locDir+"/**/*",["watch-locales"]); |
| 363 | +gulp.task("watch", function(callback) { |
| 364 | + gulp.watch([srcDir+"/**/*",srcModDir+"/**/*","src/**/*",__dirname+"/src/**/*"],gulp.series("watch-src")); |
| 365 | + gulp.watch(locDir+"/**/*",gulp.series("watch-locales")); |
| 366 | + callback(); |
367 | 367 | }); |
368 | 368 |
|
369 | 369 | // list available templates |
370 | | -gulp.task("templates",function() { |
| 370 | +gulp.task("templates",function(callback) { |
371 | 371 | var templates = fs.readdirSync(path.join(__dirname,"templates")); |
372 | 372 | templates.forEach(function(template) { |
373 | 373 | var manifest = null; |
374 | 374 | try { |
375 | 375 | manifest = JSON.parse(fs.readFileSync(path.join(__dirname,"templates",template,"src/manifest.json"),"utf8")); |
376 | 376 | } catch(e) {} |
377 | 377 | console.info(template+":",manifest && manifest.description ? manifest.description : "no description found"); |
378 | | - }); |
379 | | - process.exit(0); |
| 378 | + }); |
| 379 | + callback(); |
380 | 380 | }); |
381 | 381 |
|
382 | 382 | gulp.task("default", function(callback) { |
@@ -416,7 +416,7 @@ gulp.task("init", function(callback) { |
416 | 416 | }); |
417 | 417 |
|
418 | 418 | // get some help |
419 | | -gulp.task("help", function() { |
| 419 | +gulp.task("help", function(callback) { |
420 | 420 | var help = [ |
421 | 421 | "weh version "+package.version, |
422 | 422 | "usage: gulp [<commands>] [<options>]", |
@@ -444,8 +444,8 @@ gulp.task("help", function() { |
444 | 444 | " --ejsdata <name=value>: define variable to be used in EJS preprocessing", |
445 | 445 | " --force-build-date <date>: force build date" |
446 | 446 | ]; |
447 | | - console.log(help.join("\n")); |
448 | | - process.exit(0); |
| 447 | + console.log(help.join("\n")); |
| 448 | + callback(); |
449 | 449 | }); |
450 | 450 |
|
451 | 451 | // copy template directory when creating new project |
|
0 commit comments