Skip to content

Commit da64976

Browse files
committed
report diff to MS for MTD in 2 weeks and month as well
1 parent fd52c22 commit da64976

File tree

3 files changed

+23
-10
lines changed

3 files changed

+23
-10
lines changed

publish-extensions.js

+3-6
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ const flags = [
9393
timeoutDelay = 5;
9494
}
9595
try {
96-
/** @type {[PromiseSettledResult<PublishedExtension | undefined>]} */
96+
/** @type {[PromiseSettledResult<PublishedExtension | undefined>]} */
9797
let [msExtension] = await Promise.allSettled([msGalleryApi.getExtension(extension.id, flags)]);
9898
if (msExtension.status === 'fulfilled') {
9999
context.msVersion = msExtension.value?.versions[0]?.version;
@@ -106,7 +106,7 @@ const flags = [
106106
}
107107

108108
async function updateStat() {
109-
/** @type {[PromiseSettledResult<PublishedExtension | undefined>]} */
109+
/** @type {[PromiseSettledResult<PublishedExtension | undefined>]} */
110110
const [ovsxExtension] = await Promise.allSettled([openGalleryApi.getExtension(extension.id, flags)]);
111111
if (ovsxExtension.status === 'fulfilled') {
112112
context.ovsxVersion = ovsxExtension.value?.versions[0]?.version;
@@ -138,10 +138,7 @@ const flags = [
138138
}
139139

140140
if (context.msVersion && context.msLastUpdated && monthAgo.getTime() <= context.msLastUpdated.getTime()) {
141-
stat.hitMiss[extension.id] = {
142-
...extStat,
143-
hit: typeof daysInBetween === 'number' && 0 < daysInBetween && daysInBetween <= 2
144-
}
141+
stat.hitMiss[extension.id] = extStat;
145142
}
146143
}
147144

report-extensions.js

+19-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,18 @@ function sortedKeys(s) {
3737
const notInMS = stat.notInMS.length;
3838
const total = upToDate + notInOpen + outdated + unstable + notInMS;
3939
const updatedInMTD = Object.keys(stat.hitMiss).length;
40-
const updatedInOpen = Object.keys(stat.hitMiss).filter(id => stat.hitMiss[id].hit).length;
40+
const updatedInOpenIn2Days = new Set(Object.keys(stat.hitMiss).filter(id => {
41+
const { daysInBetween } = stat.hitMiss[id];
42+
return typeof daysInBetween === 'number' && 0 <= daysInBetween && daysInBetween <= 2;
43+
}));
44+
const updatedInOpenIn2Weeks = new Set(Object.keys(stat.hitMiss).filter(id => {
45+
const { daysInBetween } = stat.hitMiss[id];
46+
return typeof daysInBetween === 'number' && 0 <= daysInBetween && daysInBetween <= 14;
47+
}));
48+
const updatedInOpenInMonth = new Set(Object.keys(stat.hitMiss).filter(id => {
49+
const { daysInBetween } = stat.hitMiss[id];
50+
return typeof daysInBetween === 'number' && 0 <= daysInBetween && daysInBetween <= 30;
51+
}));
4152
const msPublished = Object.keys(stat.msPublished).length;
4253

4354
const totalResolutions = Object.keys(stat.resolutions).length;
@@ -71,7 +82,9 @@ function sortedKeys(s) {
7182
summary += `Total resolved: ${totalResolved} (${(totalResolved / totalResolutions * 100).toFixed(0)}%)\r\n`;
7283
summary += `\r\n`;
7384
summary += `Updated in MS marketplace in month-to-date: ${updatedInMTD}\r\n`;
74-
summary += `Of which updated in Open VSX within 2 days: ${updatedInOpen} (${(updatedInOpen / updatedInMTD * 100).toFixed(0)}%)\r\n`;
85+
summary += `Of which updated in Open VSX within 2 days: ${updatedInOpenIn2Days.size} (${(updatedInOpenIn2Days.size / updatedInMTD * 100).toFixed(0)}%)\r\n`;
86+
summary += `Of which updated in Open VSX within 2 weeks: ${updatedInOpenIn2Weeks.size} (${(updatedInOpenIn2Weeks.size / updatedInMTD * 100).toFixed(0)}%)\r\n`;
87+
summary += `Of which updated in Open VSX within a month: ${updatedInOpenInMonth.size} (${(updatedInOpenInMonth.size / updatedInMTD * 100).toFixed(0)}%)\r\n`;
7588
summary += '-------------------\r\n';
7689
console.log(summary);
7790

@@ -139,7 +152,10 @@ function sortedKeys(s) {
139152
content += '\r\n----- Updated in Open VSX within 2 days after in MS marketplace in MTD -----\r\n';
140153
for (const id of sortedKeys(stat.hitMiss)) {
141154
const r = stat.hitMiss[id];
142-
content += `${r.hit ? '+' : '-'} ${id}: installs: ${r.msInstalls}; daysInBetween: ${r.daysInBetween?.toFixed(0)}; MS marketplace: ${r.msVersion}; Open VSX: ${r.openVersion}\r\n`;
155+
const in2Days = updatedInOpenIn2Days.has(id) ? '+' : '-';
156+
const in2Weeks = updatedInOpenIn2Weeks.has(id) ? '+' : '-';
157+
const inMonth = updatedInOpenInMonth.has(id) ? '+' : '-';
158+
content += `${inMonth}${in2Weeks}${in2Days} ${id}: installs: ${r.msInstalls}; daysInBetween: ${r.daysInBetween?.toFixed(0)}; MS marketplace: ${r.msVersion}; Open VSX: ${r.openVersion}\r\n`;
143159
}
144160
content += '-------------------\r\n';
145161
}

types.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export interface PublishStat {
4444
[id: string]: MSExtensionStat
4545
}
4646
hitMiss: {
47-
[id: string]: (ExtensionStat | ExtensionStat) & { hit: boolean }
47+
[id: string]: (ExtensionStat | ExtensionStat)
4848
}
4949
}
5050

0 commit comments

Comments
 (0)