-
Notifications
You must be signed in to change notification settings - Fork 567
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: convert nodejs plugin response to use multi format #773
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,12 +2,13 @@ import * as modulesParser from './npm-modules-parser'; | |
import * as lockParser from './npm-lock-parser'; | ||
import * as types from '../types'; | ||
import { MissingTargetFileError } from '../../errors/missing-targetfile-error'; | ||
import { MultiProjectResult } from '@snyk/cli-interface/legacy/plugin'; | ||
|
||
export async function inspect( | ||
root: string, | ||
targetFile: string, | ||
options: types.Options = {}, | ||
): Promise<types.InspectResult> { | ||
): Promise<MultiProjectResult> { | ||
if (!targetFile) { | ||
throw MissingTargetFileError(root); | ||
} | ||
|
@@ -16,13 +17,15 @@ export async function inspect( | |
targetFile.endsWith('yarn.lock'); | ||
|
||
const getLockFileDeps = isLockFileBased && !options.traverseNodeModules; | ||
const depTree: any = getLockFileDeps | ||
? await lockParser.parse(root, targetFile, options) | ||
: await modulesParser.parse(root, targetFile, options); | ||
|
||
return { | ||
plugin: { | ||
name: 'snyk-nodejs-lockfile-parser', | ||
runtime: process.version, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This may be contradicting this change: https://github.com/snyk/snyk-cli-interface/pull/21/files#diff-b2d5ac8d1346936f02713d534de45340R93 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't see an issue there There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the issue will be that different projects will be scanned soon and they will not share always the exact same version of gradle or maven or sbt for example. Or node in this example. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But we can fix that easily I think but adding meta inside each result not on a top level response |
||
}, | ||
package: getLockFileDeps | ||
? await lockParser.parse(root, targetFile, options) | ||
: await modulesParser.parse(root, targetFile, options), | ||
scannedProjects: [{ depTree }], | ||
}; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this change of renaming this from
subProjectName
toprojectName
. We don't really have a concept of sub project, as we monitor each sub project as separate project.