commands/check.js
function(args, done) {
  debug('checking required files with args', args);
  var dir = path.resolve(args['<directory>']);

  var tasks = [
    'README*',
    'LICENSE',
    '.travis.yml',
    '.gitignore'
  ].map(function requireFileExists(pattern) {
    return function(cb) {
      glob(pattern, {
        cwd: dir
      }, function(err, files) {
        debug('resolved %s for `%s`', files, pattern);
        if (err) {
          return cb(err);
        }
        if (files.length === 0) {
          return done(new Error('missing required file matching ' + pattern));
        }
        if (files.length > 1) {
          return done(new Error('more than one file matched ' + pattern));
        }

        fs.exists(files[0], function(exists) {
          if (!exists) {
            return done(new Error('missing required file matching ' + files[0]));
          }
          return cb(null, files[0]);
        });
      });
    };
  });
  async.parallel(tasks, done);
}
function(args, done) {
  debug('checking required files with args', args);
  var dir = path.resolve(args['<directory>']);

  var tasks = [
    'README*',
    'LICENSE',
    '.travis.yml',
    '.gitignore'
  ].map(function requireFileExists(pattern) {
    return function(cb) {
      glob(pattern, {
        cwd: dir
      }, function(err, files) {
        debug('resolved %s for `%s`', files, pattern);
        if (err) {
          return cb(err);
        }
        if (files.length === 0) {
          return done(new Error('missing required file matching ' + pattern));
        }
        if (files.length > 1) {
          return done(new Error('more than one file matched ' + pattern));
        }

        fs.exists(files[0], function(exists) {
          if (!exists) {
            return done(new Error('missing required file matching ' + files[0]));
          }
          return cb(null, files[0]);
        });
      });
    };
  });
  async.parallel(tasks, done);
}
function ( args , done ) { debug ( 'checking required files with args' , args ) ; var dir = path . resolve ( args [ '<directory>' ] ) ; var tasks = [ 'README*' , 'LICENSE' , '.travis.yml' , '.gitignore' ] . map ( function requireFileExists ( pattern ) { return function ( cb ) { glob ( pattern , { cwd : dir } , function ( err , files ) { debug ( 'resolved %s for `%s`' , files , pattern ) ; if ( err ) { return cb ( err ) ; } if ( files . length === 0 ) { return done ( new Error ( 'missing required file matching ' + pattern ) ) ; } if ( files . length > 1 ) { return done ( new Error ( 'more than one file matched ' + pattern ) ) ; } fs . exists ( files [ 0 ] , function ( exists ) { if ( ! exists ) { return done ( new Error ( 'missing required file matching ' + files [ 0 ] ) ) ; } return cb ( null , files [ 0 ] ) ; } ) ; } ) ; } ; } ) ; async . parallel ( tasks , done ) ; }
Checks for required files
Checks for required files