From 2b621287a61fe9721f1c8ec11c458ae5a037aa2b Mon Sep 17 00:00:00 2001 From: Cheton Wu Date: Thu, 10 Dec 2015 18:13:00 +0800 Subject: [PATCH 1/2] Fixed a bug that the callback if the 'end' event will be never called while using vinyl-fs v1.x and above --- tasks/index.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/tasks/index.js b/tasks/index.js index c64554b..4fefb2a 100644 --- a/tasks/index.js +++ b/tasks/index.js @@ -1,9 +1,19 @@ 'use strict'; -module.exports = function(grunt) { - var i18next = require('..'); - var vfs = require('vinyl-fs'); +var i18next = require('..'); +var through2 = require('through2'); +var vfs = require('vinyl-fs'); +var tap = function(callback) { + return through2.obj(function(file, enc, done) { + if (typeof callback === 'function') { + callback(); + } + done(); + }); +}; + +module.exports = function(grunt) { grunt.registerMultiTask('i18next', 'A grunt task for i18next-scanner', function() { var done = this.async(); var options = this.options() || {}; @@ -13,9 +23,9 @@ module.exports = function(grunt) { vfs.src(target.files || target.src, {base: target.base || '.'}) .pipe(i18next(options, target.customTransform, target.customFlush)) .pipe(vfs.dest(target.dest || '.')) - .on('end', function() { + .pipe(tap(function() { done(); - }); + })); }); }); }; From 7187c5b74b83c7ff457b68a8a9ac4ba9f48c08e9 Mon Sep 17 00:00:00 2001 From: Cheton Wu Date: Thu, 10 Dec 2015 18:13:24 +0800 Subject: [PATCH 2/2] Update package.json --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index c7bdad8..4affea7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "i18next-scanner", - "version": "0.5.7", + "version": "0.5.8", "description": "i18next-scanner is a transfrom stream that can scan your code, extract translation keys/values, and merge them into i18n resource files.", "homepage": "https://github.com/i18next/i18next-scanner", "author": "Cheton Wu ", @@ -35,7 +35,7 @@ "lodash": "^3.10.1", "through2": "^2.0.0", "vinyl": "^1.1.0", - "vinyl-fs": "^0.3.14" + "vinyl-fs": "^2.2.1" }, "devDependencies": { "coveralls": "^2.11.4",