-
Notifications
You must be signed in to change notification settings - Fork 178
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(yarn lockfile fallback) add yarn lockfile reading fallback #293
Conversation
analyzers/nodejs/nodejs.go
Outdated
Dir: a.Module.Dir, | ||
}) | ||
if ok, err := files.Exists(a.Module.Dir, "yarn.lock"); err == nil && ok && a.YarnTool.Exists() { | ||
a.YarnTool.Install(a.Module.Dir) |
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.
Error return value of a.YarnTool.Install
is not checked
analyzers/nodejs/nodejs.go
Outdated
log.Warnf("NPM had non-zero exit code: %s", err.Error()) | ||
log.Debug("Using fallback of node_modules") | ||
pkgs, err := a.NPMTool.List(filepath.Dir(a.Module.BuildTarget)) | ||
if err == nil { |
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.
restructuring checks for err == nil
allows this func to avoid a level of nesting every time we use a fallback
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.
LGTM, small comments. Please address and then ready to merge.
analyzers/nodejs/nodejs.go
Outdated
|
||
YarnCmd string | ||
YarnVersion string | ||
NPMTool npm.NPM |
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.
We can probably just call these NPM
and Yarn
.
analyzers/nodejs/nodejs.go
Outdated
@@ -33,10 +34,8 @@ type Analyzer struct { | |||
NodeCmd string |
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.
Do we still need this now that we have the tools?
analyzers/nodejs/nodejs.go
Outdated
YarnCmd: yarnCmd, | ||
YarnVersion: yarnVersion, | ||
NPMTool: npmTool, | ||
YarnTool: yarn.New(), |
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.
We might want to move the os.Getenv
checking logic into here, unless anything else uses yarn.New()
or npm.New()
.
… releaseGroupRelease (#293)
also implemented
YarnTool
in a similar manner toNPMTool