From 87301c61a23151d13dac8bff53deeebb4ace8fb5 Mon Sep 17 00:00:00 2001 From: imfunny <36105478+imfunniee@users.noreply.github.com> Date: Sun, 12 May 2019 19:16:12 +0530 Subject: [PATCH] changed repos to update --- repos.js | 45 --------------------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 repos.js diff --git a/repos.js b/repos.js deleted file mode 100644 index 58faa31..0000000 --- a/repos.js +++ /dev/null @@ -1,45 +0,0 @@ -const program = require('commander'); -const fs = require('fs'); -const got = require('got'); -options = { - resources: "usable" -}; - -program - .version('0.1.0') - .option('-n, --name [username]', 'get username') - .parse(process.argv); - -function PopulateRepos(username){ - var repoData = []; - (async () => { - try { - var repos = await got(`https://api.github.com/users/${username}/repos?sort=created`); - repos = JSON.parse(repos.body); - for(var i = 0;i < repos.length;i++){ - if(repos[i].fork == false){ - repoData.push({ - "html_url": repos[i].html_url, - "name": repos[i].name, - "description": repos[i].description, - "language": repos[i].language, - "stargazers_count": repos[i].stargazers_count, - "forks_count" :repos[i].forks_count - }); - } - - } - fs.writeFile('./repos/repos.json', JSON.stringify(repoData), function(err){ - if (err) throw err; - console.log('Repos Created Successfully in repos folder.'); - }); - } catch (error) { - console.log(error); - } -})(); -} -if (program.name) { - PopulateRepos(('%s', program.name)); -} else { - console.log("provide a name to scrape repos"); -} \ No newline at end of file