Skip to content

Commit

Permalink
fix: separate log data with \\n
Browse files Browse the repository at this point in the history
  • Loading branch information
gr2m committed Feb 25, 2021
1 parent 455e429 commit d1c3868
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,16 @@ export async function octoherd(
);
},
onLogData(data) {
appendFileSync(tmpLogFile, JSON.stringify(data));
appendFileSync(tmpLogFile, JSON.stringify(data) + "\n");
},
},
});

let userScript;
const path = resolve(process.cwd(), octoherdScript);

octokit.log.info("Loading script at %s", octoherdScript);

try {
userScript = (await import(path)).script;
} catch (error) {
Expand All @@ -86,6 +88,7 @@ export async function octoherd(
};

try {
octokit.log.info("Loading repositories ...");
const repositories = await resolveRepositories(state, octoherdRepos);

for (const repository of repositories) {
Expand Down
8 changes: 4 additions & 4 deletions lib/resolve-repositories.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export async function resolveRepositories(state, repositories) {
repo,
});
resolvedRepositories.push(data);
process.stdout.write(".");
}

for (const name of repositoriesWithStars) {
Expand All @@ -51,6 +52,7 @@ export async function resolveRepositories(state, repositories) {
}
)) {
resolvedRepositories.push(...response.data);
process.stdout.write(".");
}
}

Expand All @@ -62,13 +64,11 @@ export async function resolveRepositories(state, repositories) {
}
)) {
resolvedRepositories.push(...response.data);
process.stdout.write(".");
}
}

console.log(`resolvedRepositories`);
console.log(resolvedRepositories);

process.exit();
process.stdout.write("\n");

// return unique array (https://www.samanthaming.com/tidbits/43-3-ways-to-remove-array-duplicates/)
return [...new Set(resolvedRepositories)];
Expand Down

0 comments on commit d1c3868

Please sign in to comment.