Skip to content

Commit

Permalink
Create an index with the pulse and drift of all repositories.
Browse files Browse the repository at this point in the history
  • Loading branch information
francois2metz committed Nov 27, 2023
1 parent ad215a4 commit 4850318
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,15 @@ export async function main() {
packageManager,
};
}));
const indexResult = {};
for await (const { repository, path, packagePath, packageManager } of installResult) {
const line = `${repository}#${path}`;
const result = await calculateRepository(packagePath, packageManager);
const summary = createSummary(result);
await saveResult(basePath, `${repository}#${path}`, summary, result);
indexResult[line] = summary;
await saveResult(basePath, line, summary, result);
}
await saveIndexFile(basePath, indexResult);
}

async function cloneRepositories(lines) {
Expand Down Expand Up @@ -132,3 +136,8 @@ export function createSummary(result) {
return memo;
}, { drift: 0, pulse: 0, date: new Date() });
}

async function saveIndexFile(basePath, indexResult) {
const filePath = join(basePath, 'data', 'index.json');
await writeFile(filePath, JSON.stringify(indexResult));
}

0 comments on commit 4850318

Please sign in to comment.