Skip to content

Commit

Permalink
modify
Browse files Browse the repository at this point in the history
  • Loading branch information
rachfop committed May 2, 2024
1 parent 8535c2a commit 7a15a43
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/Sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,10 @@ class Sync {
}
// getRepos is the method that downloads all of the Github repos
async getRepos() {
const repositories = [];
const reposData = {
repositories: [],
usedRepos: new Set(),
};
this.progress.updateOperation("retrieving source files");
this.progress.updateTotal(this.origins.length);
await Promise.all(
Expand All @@ -237,13 +240,14 @@ class Sync {
const filePaths = glob.sync(pattern).map((f) => ({
name: basename(f), directory: dirname(f),
}));
repositories.push({
reposData.repositories.push({
rtype: 'local',
owner: origin.files.owner,
repo: origin.files.repo,
ref: origin.files.ref,
filePaths: filePaths,
});
reposData.usedRepos.add(`${origin.files.owner}/${origin.files.repo}`);
return;
}
if (!("owner" in origin && "repo" in origin)) {
Expand All @@ -256,11 +260,12 @@ class Sync {
const buffer = arrayBuffToBuff(byteArray);
await writeAsync(fileName, buffer);
repository.filePaths = await this.unzip(fileName);
repositories.push(repository);
reposData.repositories.push(repository);
reposData.usedRepos.add(`${owner}/${repo}`);
this.progress.increment();
})
);
return repositories;
return reposData;
}
// unzip unzips the Github repo archive
async unzip(filename) {
Expand Down

0 comments on commit 7a15a43

Please sign in to comment.