|
1 | 1 | import { Readable } from "stream";
|
2 | 2 |
|
| 3 | +import { AggregateFileContributorsDashboard } from "./dashboard/aggregate-file-contributors-dashboard.js"; |
| 4 | +import { SummaryDashboard } from "./dashboard/summary-dashboard.js"; |
3 | 5 | import { GitRepository } from "./git-reader/git-repository.js";
|
4 | 6 | import { ExpandedCommit } from "./interfaces.js";
|
5 | 7 | import { ListOfContributorsPerFileAggregate } from "./stats/aggregate/list-of-contributors-per-file-aggregate.js";
|
@@ -28,17 +30,6 @@ export function timeLog(timerName: string) {
|
28 | 30 | console.timeLog(timerName);
|
29 | 31 | }
|
30 | 32 | }
|
31 |
| -function clearConsole() { |
32 |
| - process.stdout.write("\u001b[3J\u001b[2J\u001b[1J"); |
33 |
| - // eslint-disable-next-line no-console |
34 |
| - console.clear(); |
35 |
| -} |
36 |
| - |
37 |
| -async function collectCommitsByAuthor(repo: GitRepository) { |
38 |
| - const commits = await repo.getListOfCommits(); |
39 |
| - const commitsByAuthor = getNumberOfCommitsByAuthor(commits); |
40 |
| - log("commitsByAuthor", commitsByAuthor); |
41 |
| -} |
42 | 33 |
|
43 | 34 | async function collectHotFiles(commitsWithChangedFiles: ExpandedCommit[]) {
|
44 | 35 | const commitsPerFile = getNumberOfChangesPerFile(commitsWithChangedFiles);
|
@@ -97,28 +88,34 @@ async function main() {
|
97 | 88 | );
|
98 | 89 |
|
99 | 90 | commitsStream.on("data", (commit) => {
|
100 |
| - log("Commit", commit); |
| 91 | + debug("Commit", commit); |
101 | 92 | intermediateAggregateMonthly.addCommit(commit);
|
102 | 93 | intermediateAggregateQuarterly.addCommit(commit);
|
103 | 94 |
|
104 |
| - clearConsole(); |
105 |
| - |
106 | 95 | // log("monthly data: ", intermediateAggregateMonthly.getData());
|
107 |
| - log("quarterly data: ", { |
108 |
| - data: JSON.stringify(intermediateAggregateQuarterly.displayReport()), |
109 |
| - }); |
| 96 | + const quarterlyDashboard = new AggregateFileContributorsDashboard( |
| 97 | + intermediateAggregateQuarterly.getData() |
| 98 | + ); |
| 99 | + log(quarterlyDashboard.displayDashboard(), {}); |
110 | 100 | });
|
111 | 101 | commitsStream.on("end", () => {
|
112 | 102 | log("done reading commits", {});
|
113 | 103 | });
|
114 | 104 |
|
| 105 | + // initialize dashboard |
| 106 | + const summaryDashboard = new SummaryDashboard(); |
| 107 | + |
| 108 | + // number of commits by author: |
| 109 | + const commits = await repo.getListOfCommits(); |
| 110 | + const commitsByAuthor = getNumberOfCommitsByAuthor(commits); |
| 111 | + summaryDashboard.setNumberOfCommitsPerAuthor(commitsByAuthor); |
| 112 | + |
115 | 113 | const commitsWithChangedFiles = await repo.getListOfCommitsWithChangedFiles({
|
116 | 114 | stream: commitsStream,
|
117 | 115 | });
|
118 | 116 | log("Finished fetching a list of changed files", {
|
119 | 117 | numberOfFiles: commitsWithChangedFiles.length,
|
120 | 118 | });
|
121 |
| - await collectCommitsByAuthor(repo); |
122 | 119 | await collectHotFiles(commitsWithChangedFiles);
|
123 | 120 | await collectKnowledgeGaps(commitsWithChangedFiles);
|
124 | 121 | await collectDetailedContributorsPerFile(commitsWithChangedFiles);
|
|
0 commit comments