-
Notifications
You must be signed in to change notification settings - Fork 12
Convert to legacy format #14
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
Conversation
7e3b5c6
to
a4c6dcd
Compare
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.
Nothing jumping out at me, looks sane. Minor stylistic comments and one small concern, but happy for them to be ignored if not relevant.
May also be worth adding a cyclic fixture and expecting it to throw, then changing the assertion later on so you can tdd it a bit. Again, may be beyond the scope here.
src/legacy/index.ts
Outdated
if (depGraph.pkgManager.repositories | ||
&& depGraph.pkgManager.repositories.length | ||
&& ['apk', 'apt', 'deb', 'rpm'].indexOf(depGraph.pkgManager.name) >= 0) { | ||
const [name, version] = depGraph.pkgManager.repositories[0].alias.split(':'); |
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.
Does alias
always exist? I don't have the context around it, but looks like something that could throw some funny errors.
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.
Good call, adding tests and refactoring slightly to error out if we can't construct targetOS on a linux "pkgManager" (cc @darscan @michael-go)
a4c6dcd
to
50f9fb0
Compare
Exposes a way to convert dep-graph's to the legacy tree format. "Package manager" and "package type" must be handled out of band by the consumer, as "package manager" exists only on dep-graphs and "package type" exists only on legacy trees. Given legacy tree's have a very ill-defined structure, the conversion can be lossy. This commit adds test fixtures that cover all of the data that is preserved in conversion. If something is not in a fixture, then it is not guaranteed to be preserved (e.g. package licence metadata). It is expected that future releases of this library will formalise and preserve more of the semi-structured data that exists on legacy trees, as needed.
50f9fb0
to
caef817
Compare
🎉 This PR is included in version 1.3.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
What does this PR do?
Exposes a way to convert dep-graph's to the legacy tree format.
"Package manager" and "package type" must be handled out of band by the
consumer, as "package manager" exists only on dep-graphs and "package
type" exists only on legacy trees.
Given legacy tree's have a very ill-defined structure, the conversion
can be lossy. This commit adds test fixtures that cover all of the data
that is preserved in conversion. If something is not in a fixture, then
it is not guaranteed to be preserved (e.g. package licence metadata).
It is expected that future releases of this library will formalise and
preserve more of the semi-structured data that exists on legacy trees, as
needed.