tasks/publish.js
function isValidDir(filepath) {
      if (grunt.file.isDir(filepath)) {
        return grunt.file.exists(path.resolve(filepath, 'package.json'));
      }
      return false;
    }
function isValidDir(filepath) {
      if (grunt.file.isDir(filepath)) {
        return grunt.file.exists(path.resolve(filepath, 'package.json'));
      }
      return false;
    }
Tells whether or not, the given path is a valid directory (directory which contains a package.json)
@param filepath
@returns {*}