This uses a script to add the new `stargazers_count` and `updated_at` to the scenario files. This is done by using the GitHub API to get the information for each repo and then updating the scenario file. The `updated_at` values are not completely representative since they are the `updated_at` at time of running the script, rather than at the time the variant analysis was run. However, this should not really matter in practice. An alternative for scanned repositories might be getting the creation time of the `database_commit_sha` commit.
16 lines
424 B
TypeScript
16 lines
424 B
TypeScript
import * as fs from 'fs-extra';
|
|
import * as path from 'path';
|
|
|
|
// https://stackoverflow.com/a/45130990
|
|
export async function* getFiles(dir: string): AsyncGenerator<string> {
|
|
const dirents = await fs.readdir(dir, { withFileTypes: true });
|
|
for (const dirent of dirents) {
|
|
const res = path.resolve(dir, dirent.name);
|
|
if (dirent.isDirectory()) {
|
|
yield* getFiles(res);
|
|
} else {
|
|
yield res;
|
|
}
|
|
}
|
|
}
|