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) add yarn lockfile parsing #283

Merged
merged 15 commits into from
Sep 25, 2018
Merged

feat(yarn) add yarn lockfile parsing #283

merged 15 commits into from
Sep 25, 2018

Conversation

microsoftly
Copy link
Contributor

No description provided.

@coveralls
Copy link

coveralls commented Sep 24, 2018

Coverage Status

Coverage remained the same at 35.631% when pulling 4e12749 on feat/yarnLockfile into 6d8b99d on master.

assert.NotEmpty(t, lockfile)
}

var chaiDirectDep = pkg.Import{

Choose a reason for hiding this comment

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

chaiDirectDep is unused

return graph.Deps{}, nil
}

func readLockfile(pathElems ...string) (YarnLockfile, error) {

Choose a reason for hiding this comment

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

readLockfile is unused

@microsoftly microsoftly changed the title WIP feat(yarn) add yarn lockfile parsing feat(yarn) add yarn lockfile parsing Sep 25, 2018
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.

Just one minor nit to fix, then ready to merge. Great work!

)

// FromLockfile builds a dependency graph based on the the lockfile found in the provided path
func FromLockfile(pathElems ...string) (graph.Deps, error) {
Copy link
Contributor

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.

}

// To know which deps are direct, we need the manifest def
manifestPath := filepath.Join(filepath.Dir(filePath), "package.json")
Copy link
Contributor

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)
Copy link
Contributor

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.

@microsoftly microsoftly merged commit 6e77c5b into master Sep 25, 2018
@microsoftly microsoftly deleted the feat/yarnLockfile branch September 25, 2018 22:38
meghfossa pushed a commit that referenced this pull request Nov 12, 2021
* releasegroup support

* bump ghc
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