Skip to content

Commit

Permalink
get dependency tree of provides
Browse files Browse the repository at this point in the history
  • Loading branch information
adamburgess committed Nov 1, 2021
1 parent b20cd2c commit 2844445
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 1.1.0

Allow getting dependency trees of provides as well as packages.
For example, this fixes `openssh-client` which is no longer a package but openssh-client-common and openssh-client-default.

# 1.0.0

Upgrade to node-fetch v3.
Expand Down
4 changes: 3 additions & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ export class AlpineApk {
const seen = new Set<AlpinePackage>();
let tree = '';
for (const name of names) {
tree += getDependencyTreeInternal(name, this.pkgNames[name], seen, this.pkgs);
const pkg = this.pkgNames[name] ?? this.pkgs[name];
if (pkg === undefined) continue;
tree += getDependencyTreeInternal(name, this.pkgNames[name] ?? this.pkgs[name], seen, this.pkgs);
}
return tree;
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "alpine-apk",
"version": "1.0.0",
"version": "1.1.0",
"description": "access to alpine package manager",
"module": "index.js",
"scripts": {
Expand Down
3 changes: 2 additions & 1 deletion test/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe('alpine-apk', function () {
it('can be imported', async function () {
const { default: AlpineApk } = await import('../index.js');
expect(AlpineApk).to.be.a('function');
let alpineApk = new AlpineApk();
const alpineApk = new AlpineApk();
expect(alpineApk.update).to.be.a('function');
});

Expand All @@ -25,6 +25,7 @@ describe('alpine-apk', function () {
expect(nodeJsCurrent).to.not.be.undefined;
expect(alpineApk.getDependencyTree('nodejs-current')).to.include('musl');
expect(alpineApk.getDependencyTree('nodejs-current', 'build-base')).to.include('musl');
expect(alpineApk.getDependencyTree('openssh-client')).to.not.be.undefined;
});

});

0 comments on commit 2844445

Please sign in to comment.