Skip to content

Commit 7472892

Browse files
committed
fix: fix show tree display
- fix show tree display which was broken by earlier refactoring to make functions async - add test to validate multilevel tree Signed-off-by: Michael Dawson <[email protected]>
1 parent 3623ff5 commit 7472892

File tree

6 files changed

+102
-3
lines changed

6 files changed

+102
-3
lines changed

lib/cli/commands/show.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ async function printModule (module, depth, argv) {
2121
}
2222

2323
// print info for all of the child modules
24-
module.children.forEach((child, name, map) => {
25-
printModule(child, depth + 1)
26-
})
24+
for (const child of module.children.values()) {
25+
await printModule(child, depth + 1, argv)
26+
}
2727
};
2828

2929
module.exports = function (opts) {

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "0.0.2",
44
"description": "Package support information (see: https://github.com/nodejs/package-maintenance/pull/220)",
55
"author": "Wes Todd <[email protected]>",
6+
"support": true,
67
"keywords": [
78
"support",
89
"pacakge maintenence",

test/cli/show-local-tree/command

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
show

test/cli/show-local-tree/expected

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
@pkgjs/support-show-local(0.0.1) - {
2+
"versions": [
3+
{
4+
"version": "*",
5+
"target": {
6+
"node": "supported"
7+
},
8+
"response": {
9+
"type": "best-effort"
10+
},
11+
"backing": {
12+
"hobby": "https://github.com/pkgjs/support"
13+
}
14+
}
15+
]
16+
}
17+
18+
dep1(0.0.1) - {
19+
"versions": [
20+
{
21+
"version": "*",
22+
"target": {
23+
"node": "supported"
24+
},
25+
"response": {
26+
"type": "best-effort"
27+
},
28+
"backing": {
29+
"hobby": "https://github.com/pkgjs/support"
30+
}
31+
}
32+
]
33+
}
34+
35+
dep2(0.0.1) - {
36+
"versions": [
37+
{
38+
"version": "*",
39+
"target": {
40+
"node": "supported"
41+
},
42+
"response": {
43+
"type": "best-effort"
44+
},
45+
"backing": {
46+
"hobby": "https://github.com/pkgjs/support"
47+
}
48+
}
49+
]
50+
}
51+
52+
dep3(0.0.1) - {
53+
"versions": [
54+
{
55+
"version": "*",
56+
"target": {
57+
"node": "supported"
58+
},
59+
"response": {
60+
"type": "best-effort"
61+
},
62+
"backing": {
63+
"hobby": "https://github.com/pkgjs/support"
64+
}
65+
}
66+
]
67+
}
68+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"versions": [
3+
{
4+
"version": "*",
5+
"target": {
6+
"node": "supported"
7+
},
8+
"response": {
9+
"type": "best-effort"
10+
},
11+
"backing": {
12+
"hobby": "https://github.com/pkgjs/support"
13+
}
14+
}
15+
]
16+
}

test/cli/show-local-tree/package.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "@pkgjs/support-show-local",
3+
"version": "0.0.1",
4+
"support": true,
5+
"repository": {
6+
"type": "git",
7+
"url": "https://github.com/pkgjs/support.git"
8+
},
9+
"dependencies": {
10+
"dep1": "^0.0.1",
11+
"dep2": "^0.0.1"
12+
}
13+
}

0 commit comments

Comments
 (0)