@gpc-cli/core 0.9.24 → 0.9.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +50 -37
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -3988,7 +3988,12 @@ async function loadStatusCache(packageName, ttlSeconds = DEFAULT_TTL_SECONDS) {
|
|
|
3988
3988
|
const entry = JSON.parse(raw);
|
|
3989
3989
|
const age = (Date.now() - new Date(entry.fetchedAt).getTime()) / 1e3;
|
|
3990
3990
|
if (age > (entry.ttl ?? ttlSeconds)) return null;
|
|
3991
|
-
|
|
3991
|
+
const data = entry.data;
|
|
3992
|
+
return {
|
|
3993
|
+
...data,
|
|
3994
|
+
sections: data.sections ?? ["releases", "vitals", "reviews"],
|
|
3995
|
+
cached: true
|
|
3996
|
+
};
|
|
3992
3997
|
} catch {
|
|
3993
3998
|
return null;
|
|
3994
3999
|
}
|
|
@@ -4134,6 +4139,7 @@ async function getAppStatus(client, reporting, packageName, options = {}) {
|
|
|
4134
4139
|
packageName,
|
|
4135
4140
|
fetchedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4136
4141
|
cached: false,
|
|
4142
|
+
sections: [...sections],
|
|
4137
4143
|
releases,
|
|
4138
4144
|
vitals: {
|
|
4139
4145
|
windowDays: days,
|
|
@@ -4188,48 +4194,55 @@ function allVitalsUnknown(vitals) {
|
|
|
4188
4194
|
}
|
|
4189
4195
|
function formatStatusTable(status) {
|
|
4190
4196
|
const lines = [];
|
|
4197
|
+
const sectionSet = new Set(status.sections);
|
|
4191
4198
|
const cachedLabel = status.cached ? ` (cached ${new Date(status.fetchedAt).toLocaleTimeString()})` : ` (fetched ${new Date(status.fetchedAt).toLocaleTimeString()})`;
|
|
4192
4199
|
lines.push(`App: ${status.packageName}${cachedLabel}`);
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4200
|
+
if (sectionSet.has("releases")) {
|
|
4201
|
+
lines.push("");
|
|
4202
|
+
lines.push("RELEASES");
|
|
4203
|
+
if (status.releases.length === 0) {
|
|
4204
|
+
lines.push(" No releases found.");
|
|
4205
|
+
} else {
|
|
4206
|
+
const trackW = Math.max(10, ...status.releases.map((r) => r.track.length));
|
|
4207
|
+
const versionW = Math.max(7, ...status.releases.map((r) => r.versionCode.length));
|
|
4208
|
+
const statusW = Math.max(8, ...status.releases.map((r) => r.status.length));
|
|
4209
|
+
for (const r of status.releases) {
|
|
4210
|
+
lines.push(
|
|
4211
|
+
` ${r.track.padEnd(trackW)} ${r.versionCode.padEnd(versionW)} ${r.status.padEnd(statusW)} ${formatFraction(r.userFraction)}`
|
|
4212
|
+
);
|
|
4213
|
+
}
|
|
4214
|
+
}
|
|
4215
|
+
}
|
|
4216
|
+
if (sectionSet.has("vitals")) {
|
|
4217
|
+
lines.push("");
|
|
4218
|
+
lines.push(`VITALS (last ${status.vitals.windowDays} days)`);
|
|
4219
|
+
if (allVitalsUnknown(status.vitals)) {
|
|
4220
|
+
lines.push(" No vitals data available for this period.");
|
|
4221
|
+
} else {
|
|
4222
|
+
const { crashes, anr, slowStarts, slowRender } = status.vitals;
|
|
4223
|
+
const crashVal = `${formatVitalValue(crashes)}${vitalTrendArrow(crashes)}`;
|
|
4224
|
+
const anrVal = `${formatVitalValue(anr)}${vitalTrendArrow(anr)}`;
|
|
4225
|
+
const slowStartVal = `${formatVitalValue(slowStarts)}${vitalTrendArrow(slowStarts)}`;
|
|
4226
|
+
const slowRenderVal = `${formatVitalValue(slowRender)}${vitalTrendArrow(slowRender)}`;
|
|
4202
4227
|
lines.push(
|
|
4203
|
-
` ${
|
|
4228
|
+
` crashes ${crashVal.padEnd(10)} ${vitalIndicator(crashes)} anr ${anrVal.padEnd(10)} ${vitalIndicator(anr)}`
|
|
4229
|
+
);
|
|
4230
|
+
lines.push(
|
|
4231
|
+
` slow starts ${slowStartVal.padEnd(10)} ${vitalIndicator(slowStarts)} slow render ${slowRenderVal.padEnd(10)} ${vitalIndicator(slowRender)}`
|
|
4204
4232
|
);
|
|
4205
4233
|
}
|
|
4206
4234
|
}
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
` crashes ${crashVal.padEnd(10)} ${vitalIndicator(crashes)} anr ${anrVal.padEnd(10)} ${vitalIndicator(anr)}`
|
|
4219
|
-
);
|
|
4220
|
-
lines.push(
|
|
4221
|
-
` slow starts ${slowStartVal.padEnd(10)} ${vitalIndicator(slowStarts)} slow render ${slowRenderVal.padEnd(10)} ${vitalIndicator(slowRender)}`
|
|
4222
|
-
);
|
|
4223
|
-
}
|
|
4224
|
-
lines.push("");
|
|
4225
|
-
lines.push(`REVIEWS (last ${status.reviews.windowDays} days)`);
|
|
4226
|
-
const { averageRating, previousAverageRating, totalNew, positivePercent } = status.reviews;
|
|
4227
|
-
if (totalNew === 0 && averageRating === void 0) {
|
|
4228
|
-
lines.push(" No reviews in this period.");
|
|
4229
|
-
} else {
|
|
4230
|
-
const trend = formatTrend(averageRating, previousAverageRating);
|
|
4231
|
-
const positiveStr = positivePercent !== void 0 ? ` ${positivePercent}% positive` : "";
|
|
4232
|
-
lines.push(` ${formatRating(averageRating)} ${totalNew} new${positiveStr}${trend}`);
|
|
4235
|
+
if (sectionSet.has("reviews")) {
|
|
4236
|
+
lines.push("");
|
|
4237
|
+
lines.push(`REVIEWS (last ${status.reviews.windowDays} days)`);
|
|
4238
|
+
const { averageRating, previousAverageRating, totalNew, positivePercent } = status.reviews;
|
|
4239
|
+
if (totalNew === 0 && averageRating === void 0) {
|
|
4240
|
+
lines.push(" No reviews in this period.");
|
|
4241
|
+
} else {
|
|
4242
|
+
const trend = formatTrend(averageRating, previousAverageRating);
|
|
4243
|
+
const positiveStr = positivePercent !== void 0 ? ` ${positivePercent}% positive` : "";
|
|
4244
|
+
lines.push(` ${formatRating(averageRating)} ${totalNew} new${positiveStr}${trend}`);
|
|
4245
|
+
}
|
|
4233
4246
|
}
|
|
4234
4247
|
return lines.join("\n");
|
|
4235
4248
|
}
|