npmLateset(packageName, function (err, result) { if (err) { if (err.error === 'not_found') { console.log('') console.log(" Package '%s' not found in NPM.", colors.blue(packageName)) console.log('') } else { console.log('ERROR') console.log(err.reason) } return } console.log('') console.log(' ' + colors.blue(packageName + ': ')) console.log(' latest: ' + result.version) console.log(' last updated: ' + result.time) if (result.author && result.author.name) { console.log(' author: ' + result.author.name) } if (result.repository && result.repository.url) { console.log(' repo: ' + vcsurl(result.repository.url)) } if (result.description) { console.log(' description: ' + result.description) } console.log('') })
module.exports = function GithubDownload (params, dir) { if (typeof params === 'string') { var pieces = params.split('#'); var ref = pieces[1]; var url = (vcsurl(pieces[0]) || pieces[0]).split('/') params = {user: url[url.length - 2], repo: url[url.length - 1], ref: ref} } if (typeof params !== 'object') throw new Error('Invalid parameter type. Should be repo URL string or object containing repo and user.') //console.dir(params) dir = dir || process.cwd() var gh = new GithubDownloader(params.user, params.repo, params.ref, dir) return gh.start() }