diff --git a/src/index.js b/src/index.js index 420355b..a0c6ce1 100644 --- a/src/index.js +++ b/src/index.js @@ -33,7 +33,7 @@ const parseGitURL = url => { const getCurrentRepoInfo = () => shellOut(gitConfigCommand) .then(parseGitURL) - .then(x => {return {user: x[1], repo: x[2]}}) + .then(x => { return {user: x[1], repo: x[2]} }) // // CSV Output @@ -80,7 +80,7 @@ const repoContributors = ( if (dryRun) { return json } else { - return queries.cleanRepo(token, json.repository, before, after) + return queries.cleanRepo(token, json.repository, before, after, verbose) } }) @@ -102,7 +102,7 @@ const orgContributors = ({token, orgName, before, after, debug, dryRun, verbose} if (dryRun) { return data } else { - return queries.cleanOrgRepos(token, data, before, after) + return queries.cleanOrgRepos(token, data, before, after, verbose) } }) diff --git a/src/queries.js b/src/queries.js index 5de3d0d..df789d2 100644 --- a/src/queries.js +++ b/src/queries.js @@ -128,6 +128,10 @@ const continuationQuery = (id, parentType, childType, cursor, n, query) => // Data Filtering (co-queries if you will) /// // +// Yay globals. For one off script purposes this is fine, but if we're +// interleaving async calls to the main functions this will go awry. +let verboseCont = false + /** Recursive fetcher keeps grabbing the next page from the API until there are * none left. Returns the aggregate result of all fetches. */ @@ -136,7 +140,7 @@ const fetchAll = async ({token, acc, data, type, key, count, query, name}) => { const next = await graphql.executequery({ token, name, - verbose: true, + verbose: verboseCont, query: continuationQuery( data.id, type, key, data[key].pageInfo.endCursor, count, query) }) @@ -216,7 +220,8 @@ const depaginateAll = async (parent, {token, acc, type, key, query, name}) => })))) /** Parse repository query result and filter for date range. */ -const cleanRepo = async (token, result, before, after) => { +const cleanRepo = async (token, result, before, after, verbose) => { + verboseCont = verbose const tf = timeFilter(before, after) const process = x => mergeContributions(users(tf(x))) @@ -366,7 +371,9 @@ const mergeRepoResults = repos => return ret }) -const cleanOrgRepos = async (token, result, before, after) => { +const cleanOrgRepos = async (token, result, before, after, verbose) => { + verboseCont = verbose + const repos = await fetchAll({ token, name: 'org repos cont',