-
Notifications
You must be signed in to change notification settings - Fork 552
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #929 from snyk/feat/monitor-all-projects
feat: monitor support for --all-projects
- Loading branch information
Showing
20 changed files
with
1,368 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/lib/plugins/convert-multi-plugin-res-to-multi-custom.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { legacyPlugin as pluginApi } from '@snyk/cli-interface'; | ||
import { MultiProjectResultCustom } from './get-multi-plugin-result'; | ||
import { convertScannedProjectsToCustom } from './convert-scanned-projects-to-custom'; | ||
import { SupportedPackageManagers } from '../package-managers'; | ||
|
||
export function convertMultiResultToMultiCustom( | ||
inspectRes: pluginApi.MultiProjectResult, | ||
packageManager?: SupportedPackageManagers, | ||
targetFile?: string, | ||
): MultiProjectResultCustom { | ||
// convert all results from the same plugin to MultiProjectResultCustom | ||
// and annotate each scannedProject with packageManager | ||
return { | ||
plugin: inspectRes.plugin, | ||
scannedProjects: convertScannedProjectsToCustom( | ||
inspectRes.scannedProjects, | ||
(inspectRes.plugin.packageManager as SupportedPackageManagers) || | ||
packageManager, | ||
targetFile, | ||
), | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import * as cliInterface from '@snyk/cli-interface'; | ||
import { ScannedProjectCustom } from './get-multi-plugin-result'; | ||
import { SupportedPackageManagers } from '../package-managers'; | ||
|
||
export function convertScannedProjectsToCustom( | ||
scannedProjects: cliInterface.legacyCommon.ScannedProject[], | ||
packageManager?: SupportedPackageManagers, | ||
targetFile?: string, | ||
): ScannedProjectCustom[] { | ||
// annotate the package manager & targetFile to be used | ||
// for test & monitor | ||
return scannedProjects.map((a) => { | ||
(a as ScannedProjectCustom).targetFile = a.targetFile || targetFile; | ||
(a as ScannedProjectCustom).packageManager = (a as ScannedProjectCustom) | ||
.packageManager | ||
? (a as ScannedProjectCustom).packageManager | ||
: (packageManager as SupportedPackageManagers); | ||
return a as ScannedProjectCustom; | ||
}); | ||
} |
Oops, something went wrong.