commands/check.js
function(args, done) {
  var dir = path.resolve(args['<directory>']);
  var pkg = require(path.join(dir, 'package.json'));
  var schema = Joi.object().keys({
    name: Joi.string().min(1).max(30).regex(/^[a-zA-Z0-9][a-zA-Z0-9\.\-_]*$/).required(),
    version: Joi.string().regex(/^[0-9]+\.[0-9]+[0-9+a-zA-Z\.\-]+$/).required(),
    description: Joi.string().max(80).required(),
    license: Joi.string().max(20).required(),
    homepage: Joi.string().uri({
      scheme: ['http', 'https']
    }).required(),
    main: Joi.string().optional(),
    repository: Joi.object().keys({
      type: Joi.string().valid('git').required(),
      url: Joi.string().uri({
        scheme: ['git', 'https']
      }).regex(/mongodb-js\/[a-zA-Z0-9\.\-_]+/).required()
    }),
    bin: Joi.object().optional(),
    scripts: Joi.object().optional(),
    bugs: Joi.alternatives().try(Joi.string(), Joi.object()).required(),
    author: Joi.string().required(),
    dependencies: Joi.object().required(),
    devDependencies: Joi.object().required()
  });
  Joi.validate(pkg, schema, {
    abortEarly: false,
    allowUnknown: true
  }, done);
}
function(args, done) {
  var dir = path.resolve(args['<directory>']);
  var pkg = require(path.join(dir, 'package.json'));
  var schema = Joi.object().keys({
    name: Joi.string().min(1).max(30).regex(/^[a-zA-Z0-9][a-zA-Z0-9\.\-_]*$/).required(),
    version: Joi.string().regex(/^[0-9]+\.[0-9]+[0-9+a-zA-Z\.\-]+$/).required(),
    description: Joi.string().max(80).required(),
    license: Joi.string().max(20).required(),
    homepage: Joi.string().uri({
      scheme: ['http', 'https']
    }).required(),
    main: Joi.string().optional(),
    repository: Joi.object().keys({
      type: Joi.string().valid('git').required(),
      url: Joi.string().uri({
        scheme: ['git', 'https']
      }).regex(/mongodb-js\/[a-zA-Z0-9\.\-_]+/).required()
    }),
    bin: Joi.object().optional(),
    scripts: Joi.object().optional(),
    bugs: Joi.alternatives().try(Joi.string(), Joi.object()).required(),
    author: Joi.string().required(),
    dependencies: Joi.object().required(),
    devDependencies: Joi.object().required()
  });
  Joi.validate(pkg, schema, {
    abortEarly: false,
    allowUnknown: true
  }, done);
}
function ( args , done ) { var dir = path . resolve ( args [ '<directory>' ] ) ; var pkg = require ( path . join ( dir , 'package.json' ) ) ; var schema = Joi . object ( ) . keys ( { name : Joi . string ( ) . min ( 1 ) . max ( 30 ) . regex ( / ^[a-zA-Z0-9][a-zA-Z0-9\.\-_]*$ / ) . required ( ) , version : Joi . string ( ) . regex ( / ^[0-9]+\.[0-9]+[0-9+a-zA-Z\.\-]+$ / ) . required ( ) , description : Joi . string ( ) . max ( 80 ) . required ( ) , license : Joi . string ( ) . max ( 20 ) . required ( ) , homepage : Joi . string ( ) . uri ( { scheme : [ 'http' , 'https' ] } ) . required ( ) , main : Joi . string ( ) . optional ( ) , repository : Joi . object ( ) . keys ( { type : Joi . string ( ) . valid ( 'git' ) . required ( ) , url : Joi . string ( ) . uri ( { scheme : [ 'git' , 'https' ] } ) . regex ( / mongodb-js\/[a-zA-Z0-9\.\-_]+ / ) . required ( ) } ) , bin : Joi . object ( ) . optional ( ) , scripts : Joi . object ( ) . optional ( ) , bugs : Joi . alternatives ( ) . try ( Joi . string ( ) , Joi . object ( ) ) . required ( ) , author : Joi . string ( ) . required ( ) , dependencies : Joi . object ( ) . required ( ) , devDependencies : Joi . object ( ) . required ( ) } ) ; Joi . validate ( pkg , schema , { abortEarly : false , allowUnknown : true } , done ) ; }
Check package.json conforms
Check package . json conforms