tschaub / gulp-newer

Pass through newer source files only
https://npmjs.org/package/gulp-newer
226 stars 24 forks source link

gulp-newer fail silent in some case #22

Closed zjjott closed 8 years ago

zjjott commented 8 years ago

I write my gulpfile like this:

handleUglify=function(src=null)->
    if(typeof src !='string'){
        src = source.js
    }
    var manifest_path = dest.js+"rev-manifest.json"
    var newerOption = {dest:dest.js}
    var stat = fs.existsSync(manifest_path)
    if(stat){
        var map=JSON.parse(fs.readFileSync(manifest_path, 'utf8'));
        mapfunc=function(file_path){
            return map[file_path]
        }
        newerOption.map=mapfunc
    }
    gulp.src(src,{"base":source.jsdir})
        .pipe(newer(newerOption))
        .pipe(uglify({bare: true}))
        .pipe(rev())
        .pipe(gulp.dest(dest.js))
        .pipe(rev.manifest())
        .pipe(gulp.dest(dest.js))

and some time,gulp fail silent:

$ gulp
[00:44:42] Requiring external module coffee-script/register
[00:44:44] Using gulpfile ~/work/python/crm/gulpfile.coffee
[00:44:44] Starting 'coffee'...
[00:44:44] Starting 'jsx'...
[00:44:45] Starting 'cssmin'...
[00:44:47] Finished 'jsx' after 3.71 s
[00:44:48] Finished 'coffee' after 4.35 s
[00:44:48] Starting 'uglify'...
[00:44:48] Finished 'cssmin' after 3.3 s
(.env)

there are not Finished 'uglify' like other task. I add on('error',logError) on newer and get details:

[00:45:13] TypeError: Arguments to path.join must be strings
  at Object.posix.join (path.js:488:13)
  at Promise._successFn (/Users/zhutou/work/python/crm/node_modules/gulp-newer/index.js:100:37)
  at Promise._call (/Users/zhutou/work/python/crm/node_modules/gulp-newer/node_modules/kew/kew.js:373:13)

in here:https://github.com/tschaub/gulp-newer/blob/master/index.js#L98 Should it add some code like

if(!destFileRelative){
    //raise error?
}

to judge the map function return value should not be undefined?

tschaub commented 8 years ago

Please reopen if this is not addressed by the changes in #23 (published as gulp-newer@0.5.2).