🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

github-repositories

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github-repositories - npm Package Compare versions

Comparing version
2.1.2
to
3.0.0
+25
-25
cli.js
#!/usr/bin/env node
'use strict';
var chalk = require('chalk');
var meow = require('meow');
var githubRepos = require('./');
const chalk = require('chalk');
const meow = require('meow');
const githubRepos = require('./');
var cli = meow([
'Usage',
' $ github-repositories kevva',
' $ github-repositories kevva --token 523ef69119eadg12',
'',
'Options',
' -f, --forks Only list forks',
' -r, --repos Only display repository names',
' -s, --sources Only list sources',
' -t, --token GitHub authentication token',
' -u, --urls Only display URLs'
], {
const cli = meow(`
Usage
$ github-repositories kevva
$ github-repositories kevva --token 523ef69119eadg12
Options
-f, --forks Only list forks
-r, --repos Only display repository names
-s, --sources Only list sources
-t, --token GitHub authentication token
-u, --urls Only display URL
`, {
boolean: [

@@ -37,3 +37,3 @@ 'forks',

if (!cli.input[0]) {
if (cli.input.length === 0) {
console.error('User required');

@@ -43,18 +43,18 @@ process.exit(1);

githubRepos(cli.input[0], cli.flags).then(function (data) {
data.forEach(function (repo) {
if (cli.flags.forks && !repo.fork) {
githubRepos(cli.input[0], cli.flags).then(data => {
data.forEach(x => {
if (cli.flags.forks && !x.fork) {
return;
}
if (cli.flags.sources && repo.fork) {
if (cli.flags.sources && x.fork) {
return;
}
if (!cli.flags.forks && !cli.flags.sources && repo.fork) {
repo.name += chalk.dim(' (fork)');
if (!cli.flags.forks && !cli.flags.sources && x.fork) {
x.name += chalk.dim(' (fork)');
}
if (cli.flags.repos) {
console.log(repo.name);
console.log(x.name);
return;

@@ -64,8 +64,8 @@ }

if (cli.flags.urls) {
console.log(repo.html_url);
console.log(x.html_url);
return;
}
console.log(repo.name + ' ' + chalk.dim(repo.html_url));
console.log(`${x.name} ${chalk.dim(x.html_url)}`);
});
});
'use strict';
var ghGot = require('gh-got');
var Promise = require('pinkie-promise');
const ghGot = require('gh-got');
module.exports = function (user, opts) {
module.exports = (user, opts) => {
opts = opts || {};
var page = 1;
var ret = [];
let page = 1;
let ret = [];

@@ -16,5 +15,5 @@ if (typeof user !== 'string') {

return (function loop() {
var url = 'users/' + user + '/repos?&per_page=100&page=' + page;
const url = `users/${user}/repos?&per_page=100&page=${page}`;
return ghGot(url, opts).then(function (res) {
return ghGot(url, opts).then(res => {
ret = ret.concat(res.body);

@@ -21,0 +20,0 @@

{
"name": "github-repositories",
"version": "2.1.2",
"version": "3.0.0",
"description": "Get all Github repos from a user",

@@ -13,3 +13,3 @@ "license": "MIT",

"engines": {
"node": ">=0.10.0"
"node": ">=4"
},

@@ -34,5 +34,4 @@ "bin": "cli.js",

"chalk": "^1.0.0",
"gh-got": "^2.1.0",
"meow": "^3.3.0",
"pinkie-promise": "^1.0.0"
"gh-got": "^3.0.0",
"meow": "^3.3.0"
},

@@ -44,6 +43,4 @@ "devDependencies": {

"xo": {
"ignores": [
"test.js"
]
"esnext": true
}
}