chore: ChangeReporter minor refactor

This commit is contained in:
ryan-0324 2024-07-10 17:47:38 -04:00
parent 1fbde89e3a
commit bf930b15b7
3 changed files with 5 additions and 5 deletions

View file

@ -8,7 +8,7 @@ import { join } from "path";
import type { CR } from "./types.mts"; import type { CR } from "./types.mts";
export const config: CR.ReporterConfig = { export default {
rootDir: join(import.meta.dirname, "../../src"), rootDir: join(import.meta.dirname, "../../src"),
deps: { deps: {
"../package.json": { "../package.json": {
@ -717,4 +717,4 @@ export const config: CR.ReporterConfig = {
}, },
}, },
}, },
}; } satisfies CR.ReporterConfig;

View file

@ -12,11 +12,10 @@ import type { Page } from "puppeteer-core";
import { satisfies, subset, valid, validRange } from "semver"; import { satisfies, subset, valid, validRange } from "semver";
import type { JsonObject, JsonValue } from "type-fest"; import type { JsonObject, JsonValue } from "type-fest";
import { config } from "./config.mjs";
import type { autoFindClass, autoFindEnum, autoFindStore } from "./finds.mts"; import type { autoFindClass, autoFindEnum, autoFindStore } from "./finds.mts";
import type { CR } from "./types.mts"; import type { CR } from "./types.mts";
export async function getChangeReport(page: Page): Promise<CR.ChangeReport> { export async function getChangeReport(page: Page, config: CR.ReporterConfig): Promise<CR.ChangeReport> {
const { rootDir, deps, src } = config; const { rootDir, deps, src } = config;
const depsReports: Promise<CR.DependenciesReport>[] = []; const depsReports: Promise<CR.DependenciesReport>[] = [];

View file

@ -11,6 +11,7 @@ import { join } from "path";
import puppeteer from "puppeteer-core"; import puppeteer from "puppeteer-core";
import { assertEnvValidity } from "../utils.mjs"; import { assertEnvValidity } from "../utils.mjs";
import config from "./config.mjs";
import { autoFindClass, autoFindEnum, autoFindStore, getClassChanges, getEnumChanges, isValidClass, isValidEnum } from "./finds.mjs"; import { autoFindClass, autoFindEnum, autoFindStore, getClassChanges, getEnumChanges, isValidClass, isValidEnum } from "./finds.mjs";
import { getChangeReport } from "./getChangeReport.mjs"; import { getChangeReport } from "./getChangeReport.mjs";
import { getSummary } from "./getSummary.mjs"; import { getSummary } from "./getSummary.mjs";
@ -71,7 +72,7 @@ await page.evaluate(`(async () => {
})(); })();
`); `);
const report = await getChangeReport(page); const report = await getChangeReport(page, config);
browser.close(); browser.close();
const summary = getSummary(report, CHANNEL); const summary = getSummary(report, CHANNEL);