Skip to content

Commit 50cda4b

Browse files
committed
feat: flatten default support info out
- flatten default support info output so that it fits on one line. This allows the package hierarchy to be seen in the show command Signed-off-by: Michael Dawson <[email protected]>
1 parent 7472892 commit 50cda4b

File tree

6 files changed

+10
-135
lines changed

6 files changed

+10
-135
lines changed

lib/cli/commands/show.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ async function printModule (module, depth, argv) {
1313
argv['base-path'],
1414
argv.fetch)
1515
if (supportInfo.resolved) {
16-
console.log(`${' '.repeat(2 * (depth + 1))}${moduleInfo} - ${supportInfo.contents}`)
16+
const flattenedSupportInfo = supportInfo.contents.toString().replace(/\n/g, '').replace(/\s+/g, ' ')
17+
console.log(`${' '.repeat(2 * (depth + 1))}${moduleInfo} - ${flattenedSupportInfo}`)
1718
} else if (supportInfo.error) {
1819
console.log(`${' '.repeat(2 * (depth + 1))}${moduleInfo} - failed to fetch - ${supportInfo.url}`)
1920
} else {
Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1 @@
1-
@pkgjs/support-show-local-escape-ok(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-
1+
@pkgjs/support-show-local-escape-ok(0.0.1) - { "versions": [ { "version": "*", "target": { "node": "supported" }, "response": { "type": "best-effort" }, "backing": { "hobby": "https://github.com/pkgjs/support" } } ] }

test/cli/show-local-path1/expected

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1 @@
1-
@pkgjs/support-show-local-path1(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-
1+
@pkgjs/support-show-local-path1(0.0.1) - { "versions": [ { "version": "*", "target": { "node": "supported" }, "response": { "type": "best-effort" }, "backing": { "hobby": "https://github.com/pkgjs/support" } } ] }

test/cli/show-local-tree/expected

Lines changed: 4 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,4 @@
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-
1+
@pkgjs/support-show-local(0.0.1) - { "versions": [ { "version": "*", "target": { "node": "supported" }, "response": { "type": "best-effort" }, "backing": { "hobby": "https://github.com/pkgjs/support" } } ] }
2+
dep1(0.0.1) - { "versions": [ { "version": "*", "target": { "node": "supported" }, "response": { "type": "best-effort" }, "backing": { "hobby": "https://github.com/pkgjs/support" } } ] }
3+
dep2(0.0.1) - { "versions": [ { "version": "*", "target": { "node": "supported" }, "response": { "type": "best-effort" }, "backing": { "hobby": "https://github.com/pkgjs/support" } } ] }
4+
dep3(0.0.1) - { "versions": [ { "version": "*", "target": { "node": "supported" }, "response": { "type": "best-effort" }, "backing": { "hobby": "https://github.com/pkgjs/support" } } ] }

test/cli/show-local/expected

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1 @@
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-
1+
@pkgjs/support-show-local(0.0.1) - { "versions": [ { "version": "*", "target": { "node": "supported" }, "response": { "type": "best-effort" }, "backing": { "hobby": "https://github.com/pkgjs/support" } } ] }
Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1 @@
1-
@pkgjs/support-separate-repo(0.0.1) - {
2-
"versions": [{
3-
"version": "*",
4-
"target": {
5-
"node": "lts"
6-
},
7-
"response": {
8-
"type": "best-effort"
9-
},
10-
"backing": {
11-
"hobby": "https://github.com/pkgjs/support"
12-
}
13-
}]
14-
}
15-
1+
@pkgjs/support-separate-repo(0.0.1) - { "versions": [{ "version": "*", "target": { "node": "lts" }, "response": { "type": "best-effort" }, "backing": { "hobby": "https://github.com/pkgjs/support" } }]}

0 commit comments

Comments
 (0)