MCPcopy Index your code
hub / github.com/code-pushup/cli / runInMonorepoMode

Function runInMonorepoMode

packages/ci/src/lib/run-monorepo.ts:50–92  ·  view source on GitHub ↗
(
  env: RunEnv,
)

Source from the content-addressed store, hash-verified

48} from './run-utils.js';
49
50export async function runInMonorepoMode(
51 env: RunEnv,
52): Promise<MonorepoRunResult> {
53 const { api, settings } = env;
54
55 logInfo('Running Code PushUp in monorepo mode');
56
57 const { projects, runManyCommand } = await listMonorepoProjects(settings);
58 const projectResults = runManyCommand
59 ? await runProjectsInBulk(projects, runManyCommand, env)
60 : await runProjectsIndividually(projects, env);
61
62 const diffJsonPaths = projectResults
63 .map(({ files }) => files.comparison?.json)
64 .filter((file): file is string => file != null);
65
66 if (diffJsonPaths.length === 0) {
67 return { mode: 'monorepo', projects: projectResults };
68 }
69
70 const tmpDiffPath = await runMergeDiffs(
71 diffJsonPaths,
72 createCommandContext(settings, projects[0]),
73 );
74 logDebug(`Merged ${diffJsonPaths.length} diffs into ${tmpDiffPath}`);
75 const { md: diffPath } = await saveOutputFiles({
76 project: null,
77 type: 'comparison',
78 files: { md: tmpDiffPath },
79 settings,
80 });
81
82 const commentId = settings.skipComment
83 ? null
84 : await commentOnPR(diffPath, api, settings);
85
86 return {
87 mode: 'monorepo',
88 projects: projectResults,
89 files: { comparison: { md: diffPath } },
90 ...(commentId != null && { commentId }),
91 };
92}
93
94type ProjectEnv = {
95 project: ProjectConfig;

Callers 1

runInCIFunction · 0.85

Calls 9

logInfoFunction · 0.85
listMonorepoProjectsFunction · 0.85
runProjectsInBulkFunction · 0.85
runProjectsIndividuallyFunction · 0.85
runMergeDiffsFunction · 0.85
createCommandContextFunction · 0.85
logDebugFunction · 0.85
saveOutputFilesFunction · 0.85
commentOnPRFunction · 0.85

Tested by

no test coverage detected