Skip to content

Commit

Permalink
feat: extract converting multi to single result
Browse files Browse the repository at this point in the history
  • Loading branch information
lili2311 committed Nov 1, 2019
1 parent 781a516 commit 2fe0961
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/cli/commands/monitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,7 @@ async function monitor(...args0: MethodArgs): Promise<any> {
let perProjectResult: pluginApi.SinglePackageResult[] = [];
let advertiseSubprojectsCount: number | null = null;
if (pluginApi.isMultiResult(inspectResult)) {
perProjectResult = inspectResult.scannedProjects.map(
(scannedProject) => ({
plugin: inspectResult.plugin,
package: scannedProject.depTree,
}),
);
perProjectResult = convertMultiPluginResultToSingle(inspectResult);
} else {
if (packageManager === 'gradle') {
advertiseSubprojectsCount = getSubProjectCountForGradle(
Expand Down Expand Up @@ -269,6 +264,15 @@ async function monitor(...args0: MethodArgs): Promise<any> {
throw new Error(output);
}

function convertMultiPluginResultToSingle(
result: pluginApi.MultiProjectResult,
): pluginApi.SinglePackageResult[] {
return result.scannedProjects.map((scannedProject) => ({
plugin: result.plugin,
package: scannedProject.depTree,
}));
}

function getSubProjectCountForGradle(
inspectResult,
calledForSingleSubProject,
Expand Down

0 comments on commit 2fe0961

Please sign in to comment.