-
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) add yarn lockfile parsing #283
Conversation
buildtools/yarn/parse_test.go
Outdated
assert.NotEmpty(t, lockfile) | ||
} | ||
|
||
var chaiDirectDep = pkg.Import{ |
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.
chaiDirectDep
is unused
buildtools/yarn/parse.go
Outdated
return graph.Deps{}, nil | ||
} | ||
|
||
func readLockfile(pathElems ...string) (YarnLockfile, error) { |
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.
readLockfile
is unused
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.
Just one minor nit to fix, then ready to merge. Great work!
buildtools/yarn/parse.go
Outdated
) | ||
|
||
// FromLockfile builds a dependency graph based on the the lockfile found in the provided path | ||
func FromLockfile(pathElems ...string) (graph.Deps, error) { |
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'd rather this take both a lockfile path and a manifest path (we probably want to subsequently change the name to something like FromProject
).
@zlav has been working on something similar for the Go analyser.
buildtools/yarn/parse.go
Outdated
} | ||
|
||
// To know which deps are direct, we need the manifest def | ||
manifestPath := filepath.Join(filepath.Dir(filePath), "package.json") |
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'd rather take the manifest path as an argument. This function will generally be called on projects (not dependencies) anyway, where it's much more likely that the manifest has a weird name.
yamlCompatLockfile := r.ReplaceAll(fileContent, []byte(": \"")) | ||
println(string(fileContent)) | ||
|
||
err = yaml.Unmarshal(yamlCompatLockfile, &lockfile) |
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.
Neat! I can't believe you actually used this trick and it works. This is great.
* releasegroup support * bump ghc
No description provided.