Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'TypeError: Path must be a string.' error occur when revisioner.files is empty. #149

Open
loo2k opened this issue Jun 17, 2016 · 0 comments

Comments

@loo2k
Copy link

loo2k commented Jun 17, 2016

When revisioner.files is empty, we run RevAll.manifestFile() or RevAll.versionFile() will occur the 'TypeError...' below:

path.js:8
    throw new TypeError('Path must be a string. Received ' +
    ^

TypeError: Path must be a string. Received undefined
    at assertPath (path.js:8:11)
    at Object.posix.join (path.js:479:5)
    at Revisioner.versionFile (/project/node_modules/gulp-rev-all/revisioner.js:87:24)
    at Transform._flush (/project/node_modules/gulp-rev-all/index.js:58:34)
    at Transform.<anonymous> (/project/node_modules/gulp-rev-all/node_modules/readable-stream/lib/_stream_transform.js:135:12)
    at Transform.g (events.js:260:16)
    at emitNone (events.js:67:13)
    at Transform.emit (events.js:166:7)
    at finishMaybe (/project/node_modules/gulp-rev-all/node_modules/readable-stream/lib/_stream_writable.js:371:12)
    at endWritable (/project/node_modules/gulp-rev-all/node_modules/readable-stream/lib/_stream_writable.js:378:3)

The way to fix this problem is detect whether or not revisioner.files is empty when call and RevAll.manifestFile() or RevAll.versionFile().

    RevAll.prototype.versionFile = function () {

        var revisioner = this.revisioner;

        // Drop any existing files off the stream, push the generated version file
        return Through.obj(function (file, enc, callback) {

            // Drop any existing files off the stream
            callback();

        }, function (callback) {
            if (revisioner.files.length > 0)
                this.push(revisioner.versionFile());
            callback();

        });

    };

    RevAll.prototype.manifestFile = function () {

        var revisioner = this.revisioner;

        // Drop any existing files off the stream, push the generated manifest file
        return Through.obj(function (file, enc, callback) {

            callback();

        }, function (callback) {
            if (revisioner.files.length > 0)
                this.push(revisioner.manifestFile());
            callback();

        });
    };
loo2k added a commit to loo2k/gulp-rev-all that referenced this issue Jun 17, 2016
loo2k added a commit to loo2k/gulp-rev-all that referenced this issue Jul 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant