Skip to content
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

Merged
merged 2 commits into from
Oct 7, 2019

Conversation

lili2311
Copy link
Contributor

@lili2311 lili2311 commented Sep 22, 2019

  • Ready for review
  • Follows CONTRIBUTING rules
  • Reviewed by Snyk internal team

What does this PR do?

Convert the nodejs plugin code to use the new multi result format in preparation for auto detections and handling of multiple file results.

@lili2311 lili2311 requested a review from a team as a code owner September 22, 2019 15:04
@lili2311 lili2311 self-assigned this Sep 22, 2019
@ghost ghost requested review from miiila and orsagie September 22, 2019 15:04
@lili2311 lili2311 force-pushed the feat/node-js-mutli-project-format branch 2 times, most recently from 1783fb2 to 01aef00 Compare September 22, 2019 19:15
@lili2311 lili2311 changed the title feat: convert nodejs to use multi format feat: convert nodejs plugin response to use multi format Sep 24, 2019
@@ -190,18 +190,18 @@ async function monitor(...args0: MethodArgs): Promise<any> {
const manageUrl = url.format(endpoint);

endpoint.pathname = leader + '/monitor/' + res.id;
const subProjectName = pluginApi.isMultiResult(inspectResult)
const projectName = (pluginApi.isMultiResult(inspectResult))
? subProjDeps.package.name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's consistently rename subProj as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated @miiila

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,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't see an issue there

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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

@lili2311 lili2311 force-pushed the feat/node-js-mutli-project-format branch from 1e8eec8 to 9dbfb79 Compare October 2, 2019 10:40
@lili2311 lili2311 force-pushed the feat/node-js-mutli-project-format branch from 9dbfb79 to fb43699 Compare October 2, 2019 17:29
@lili2311
Copy link
Contributor Author

lili2311 commented Oct 3, 2019

Manually tested, works as expected 🎉

@@ -28,7 +28,7 @@ interface GoodResult {
ok: true;
data: string;
path: string;
subProjectName?: string;
projectName?: string;
Copy link
Contributor

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 to projectName. We don't really have a concept of sub project, as we monitor each sub project as separate project.

Copy link
Contributor

@orsagie orsagie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lili2311 lili2311 merged commit 54169eb into master Oct 7, 2019
@lili2311 lili2311 deleted the feat/node-js-mutli-project-format branch October 7, 2019 13:28
@snyksec
Copy link

snyksec commented Oct 7, 2019

🎉 This PR is included in version 1.232.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants