@mcptoolshop/registry-stats 1.2.2 → 1.2.3

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/cli.js CHANGED
@@ -326,17 +326,42 @@ var ghcr = {
326
326
  { headers }
327
327
  );
328
328
  if (!versions || !Array.isArray(versions)) return null;
329
- const totalPulls = versions.reduce((sum, v) => sum + (v.download_count ?? 0), 0);
329
+ const now = Date.now();
330
+ const DAY = 864e5;
331
+ let activity7d = 0;
332
+ let activity30d = 0;
333
+ let lastPublished = null;
334
+ for (const v of versions) {
335
+ const created = v.created_at ? new Date(v.created_at).getTime() : 0;
336
+ if (created > 0) {
337
+ const age = now - created;
338
+ if (age <= 7 * DAY) activity7d++;
339
+ if (age <= 30 * DAY) activity30d++;
340
+ if (!lastPublished || v.created_at > lastPublished) {
341
+ lastPublished = v.created_at;
342
+ }
343
+ }
344
+ }
330
345
  const tags = versions.flatMap((v) => v.metadata?.container?.tags ?? []);
331
346
  return {
332
347
  registry: "ghcr",
333
348
  package: pkg,
334
349
  downloads: {
335
- total: totalPulls
350
+ total: versions.length,
351
+ // versionCount as primary number
352
+ lastWeek: activity7d,
353
+ // new versions in 7d
354
+ lastMonth: activity30d
355
+ // new versions in 30d
336
356
  },
337
357
  extra: {
358
+ metricType: "versions",
359
+ // signals this is version activity, not downloads
338
360
  tags: tags.slice(0, 10),
339
- versionCount: versions.length
361
+ versionCount: versions.length,
362
+ activity7d,
363
+ activity30d,
364
+ lastPublished
340
365
  },
341
366
  fetchedAt: (/* @__PURE__ */ new Date()).toISOString()
342
367
  };
package/dist/index.cjs CHANGED
@@ -355,17 +355,42 @@ var ghcr = {
355
355
  { headers }
356
356
  );
357
357
  if (!versions || !Array.isArray(versions)) return null;
358
- const totalPulls = versions.reduce((sum, v) => sum + (v.download_count ?? 0), 0);
358
+ const now = Date.now();
359
+ const DAY = 864e5;
360
+ let activity7d = 0;
361
+ let activity30d = 0;
362
+ let lastPublished = null;
363
+ for (const v of versions) {
364
+ const created = v.created_at ? new Date(v.created_at).getTime() : 0;
365
+ if (created > 0) {
366
+ const age = now - created;
367
+ if (age <= 7 * DAY) activity7d++;
368
+ if (age <= 30 * DAY) activity30d++;
369
+ if (!lastPublished || v.created_at > lastPublished) {
370
+ lastPublished = v.created_at;
371
+ }
372
+ }
373
+ }
359
374
  const tags = versions.flatMap((v) => v.metadata?.container?.tags ?? []);
360
375
  return {
361
376
  registry: "ghcr",
362
377
  package: pkg,
363
378
  downloads: {
364
- total: totalPulls
379
+ total: versions.length,
380
+ // versionCount as primary number
381
+ lastWeek: activity7d,
382
+ // new versions in 7d
383
+ lastMonth: activity30d
384
+ // new versions in 30d
365
385
  },
366
386
  extra: {
387
+ metricType: "versions",
388
+ // signals this is version activity, not downloads
367
389
  tags: tags.slice(0, 10),
368
- versionCount: versions.length
390
+ versionCount: versions.length,
391
+ activity7d,
392
+ activity30d,
393
+ lastPublished
369
394
  },
370
395
  fetchedAt: (/* @__PURE__ */ new Date()).toISOString()
371
396
  };
package/dist/index.js CHANGED
@@ -320,17 +320,42 @@ var ghcr = {
320
320
  { headers }
321
321
  );
322
322
  if (!versions || !Array.isArray(versions)) return null;
323
- const totalPulls = versions.reduce((sum, v) => sum + (v.download_count ?? 0), 0);
323
+ const now = Date.now();
324
+ const DAY = 864e5;
325
+ let activity7d = 0;
326
+ let activity30d = 0;
327
+ let lastPublished = null;
328
+ for (const v of versions) {
329
+ const created = v.created_at ? new Date(v.created_at).getTime() : 0;
330
+ if (created > 0) {
331
+ const age = now - created;
332
+ if (age <= 7 * DAY) activity7d++;
333
+ if (age <= 30 * DAY) activity30d++;
334
+ if (!lastPublished || v.created_at > lastPublished) {
335
+ lastPublished = v.created_at;
336
+ }
337
+ }
338
+ }
324
339
  const tags = versions.flatMap((v) => v.metadata?.container?.tags ?? []);
325
340
  return {
326
341
  registry: "ghcr",
327
342
  package: pkg,
328
343
  downloads: {
329
- total: totalPulls
344
+ total: versions.length,
345
+ // versionCount as primary number
346
+ lastWeek: activity7d,
347
+ // new versions in 7d
348
+ lastMonth: activity30d
349
+ // new versions in 30d
330
350
  },
331
351
  extra: {
352
+ metricType: "versions",
353
+ // signals this is version activity, not downloads
332
354
  tags: tags.slice(0, 10),
333
- versionCount: versions.length
355
+ versionCount: versions.length,
356
+ activity7d,
357
+ activity30d,
358
+ lastPublished
334
359
  },
335
360
  fetchedAt: (/* @__PURE__ */ new Date()).toISOString()
336
361
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcptoolshop/registry-stats",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "Multi-registry download stats for npm, PyPI, NuGet, VS Code Marketplace, and Docker Hub",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",