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(yarn lockfile fallback) add yarn lockfile reading fallback #293

Merged
merged 21 commits into from
Sep 27, 2018

Conversation

microsoftly
Copy link
Contributor

also implemented YarnTool in a similar manner to NPMTool

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)

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

@coveralls
Copy link

coveralls commented Sep 26, 2018

Coverage Status

Coverage remained the same at 35.631% when pulling 5459d9f on feat/yarnLockfileFallback into c94e175 on master.

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

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

Copy link
Contributor

@elldritch elldritch left a 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.


YarnCmd string
YarnVersion string
NPMTool npm.NPM
Copy link
Contributor

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.

@@ -33,10 +34,8 @@ type Analyzer struct {
NodeCmd string
Copy link
Contributor

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?

buildtools/yarn/yarn.go Show resolved Hide resolved
YarnCmd: yarnCmd,
YarnVersion: yarnVersion,
NPMTool: npmTool,
YarnTool: yarn.New(),
Copy link
Contributor

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().

@microsoftly microsoftly merged commit 48afaf4 into master Sep 27, 2018
@microsoftly microsoftly deleted the feat/yarnLockfileFallback branch September 27, 2018 23:14
meghfossa pushed a commit that referenced this pull request Nov 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants