Skip to content

Commit 4df2693

Browse files
authored
show pre-release data in show command (#921)
fixes #899
1 parent b18c620 commit 4df2693

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

src/show.ts

+18-5
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export function show(extensionId: string, json: boolean = false): Promise<any> {
2121
ExtensionQueryFlags.IncludeMetadata,
2222
ExtensionQueryFlags.IncludeStatistics,
2323
ExtensionQueryFlags.IncludeVersions,
24+
ExtensionQueryFlags.IncludeVersionProperties,
2425
];
2526
return getPublicGalleryAPI()
2627
.getExtension(extensionId, flags)
@@ -74,9 +75,22 @@ function showOverview({
7475
const [{ version = 'unknown' } = {}] = versions;
7576

7677
// Create formatted table list of versions
77-
const versionList = <ViewTable>(
78-
versions.slice(0, limitVersions).map(({ version, lastUpdated }) => [version, formatDate(lastUpdated!)])
79-
);
78+
const versionList = versions
79+
.slice(0, limitVersions)
80+
.map(({ version, lastUpdated, properties }) => [version, formatDate(lastUpdated!), properties?.some(p => p.key === 'Microsoft.VisualStudio.Code.PreRelease')]);
81+
82+
// Only show pre-release column if there are any pre-releases
83+
if (versionList.every(v => !v[2])) {
84+
for (const version of versionList) {
85+
version.pop();
86+
}
87+
versionList.unshift(['Version', 'Last Updated']);
88+
} else {
89+
for (const version of versionList) {
90+
version[2] = version[2] ? `✔️` : '';
91+
}
92+
versionList.unshift(['Version', 'Last Updated', 'Pre-release']);
93+
}
8094

8195
const { install: installs = 0, averagerating = 0, ratingcount = 0 } = statistics.reduce(
8296
(map, { statisticName, value }) => ({ ...map, [statisticName!]: value }),
@@ -93,8 +107,7 @@ function showOverview({
93107
'',
94108
`${shortDescription}`,
95109
'',
96-
'Recent versions:',
97-
...(versionList.length ? tableView(versionList).map(indentRow) : ['no versions found']),
110+
...(versionList.length ? tableView(<ViewTable>versionList).map(indentRow) : ['no versions found']),
98111
'',
99112
'Categories:',
100113
` ${categories.join(', ')}`,

0 commit comments

Comments
 (0)