mirror of
https://github.com/LukeHagar/usage-statistics.git
synced 2025-12-06 04:21:55 +00:00
chore: bump version to 1.0.10 and build action
This commit is contained in:
32
dist/index.js
vendored
32
dist/index.js
vendored
@@ -64167,6 +64167,28 @@ var semver = __nccwpck_require__(2088);
|
|||||||
|
|
||||||
// Register all Chart.js controllers
|
// Register all Chart.js controllers
|
||||||
Chart.register(...registerables);
|
Chart.register(...registerables);
|
||||||
|
/**
|
||||||
|
* Safely compare two version strings using semver
|
||||||
|
* Falls back to string comparison if semver parsing fails
|
||||||
|
*/
|
||||||
|
function safeSemverCompare(a, b) {
|
||||||
|
try {
|
||||||
|
// Clean and validate versions
|
||||||
|
const cleanA = a.trim();
|
||||||
|
const cleanB = b.trim();
|
||||||
|
// Check if versions are valid semver
|
||||||
|
if (!semver.valid(cleanA) || !semver.valid(cleanB)) {
|
||||||
|
// Fall back to string comparison for invalid semver
|
||||||
|
return cleanA.localeCompare(cleanB);
|
||||||
|
}
|
||||||
|
return semver.compare(cleanA, cleanB);
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
console.warn(`Semver comparison failed for "${a}" vs "${b}":`, error);
|
||||||
|
// Fall back to string comparison
|
||||||
|
return a.trim().localeCompare(b.trim());
|
||||||
|
}
|
||||||
|
}
|
||||||
function formatGitHubSummary(summary, platformMetrics) {
|
function formatGitHubSummary(summary, platformMetrics) {
|
||||||
let totalStars = 0;
|
let totalStars = 0;
|
||||||
let totalForks = 0;
|
let totalForks = 0;
|
||||||
@@ -64244,7 +64266,7 @@ async function createGitHubReleaseChart(platformMetrics, outputPath) {
|
|||||||
function groupByReleaseCumulative(releaseRange) {
|
function groupByReleaseCumulative(releaseRange) {
|
||||||
const releases = {};
|
const releases = {};
|
||||||
for (const release of releaseRange.sort((a, b) => {
|
for (const release of releaseRange.sort((a, b) => {
|
||||||
return semver.compare((a.tagName || '0.0.0').trim(), (b.tagName || '0.0.0').trim());
|
return safeSemverCompare(a.tagName || '0.0.0', b.tagName || '0.0.0');
|
||||||
})) {
|
})) {
|
||||||
if (!release.tagName) {
|
if (!release.tagName) {
|
||||||
continue;
|
continue;
|
||||||
@@ -64258,7 +64280,7 @@ function groupByReleaseCumulative(releaseRange) {
|
|||||||
}
|
}
|
||||||
let cumulativeDownloads = 0;
|
let cumulativeDownloads = 0;
|
||||||
for (const release of Object.keys(releases).sort((a, b) => {
|
for (const release of Object.keys(releases).sort((a, b) => {
|
||||||
return semver.compare(a.trim(), b.trim());
|
return safeSemverCompare(a, b);
|
||||||
})) {
|
})) {
|
||||||
cumulativeDownloads += releases[release].downloads;
|
cumulativeDownloads += releases[release].downloads;
|
||||||
releases[release].downloads = cumulativeDownloads;
|
releases[release].downloads = cumulativeDownloads;
|
||||||
@@ -64269,7 +64291,7 @@ async function createDownloadsPerReleaseChart(metric, outputPath) {
|
|||||||
const downloadsRange = metric.metrics?.downloadRange || [];
|
const downloadsRange = metric.metrics?.downloadRange || [];
|
||||||
const svgOutputPath = `${outputPath}/${metric.name.replace('/', '-')}-release-downloads.svg`;
|
const svgOutputPath = `${outputPath}/${metric.name.replace('/', '-')}-release-downloads.svg`;
|
||||||
const sortedReleases = downloadsRange.sort((a, b) => {
|
const sortedReleases = downloadsRange.sort((a, b) => {
|
||||||
return semver.compare((a.tagName || '0.0.0').trim(), (b.tagName || '0.0.0').trim());
|
return safeSemverCompare(a.tagName || '0.0.0', b.tagName || '0.0.0');
|
||||||
});
|
});
|
||||||
const canvas = new Canvas(1000, 800);
|
const canvas = new Canvas(1000, 800);
|
||||||
const chart = new Chart(canvas, {
|
const chart = new Chart(canvas, {
|
||||||
@@ -64326,7 +64348,7 @@ async function createCumulativeDownloadsChart(metric, outputPath) {
|
|||||||
const groupedDownloads = groupByReleaseCumulative(downloadsRange);
|
const groupedDownloads = groupByReleaseCumulative(downloadsRange);
|
||||||
// Sort months chronologically
|
// Sort months chronologically
|
||||||
const semVerSortedReleases = Object.keys(groupedDownloads).sort((a, b) => {
|
const semVerSortedReleases = Object.keys(groupedDownloads).sort((a, b) => {
|
||||||
return semver.compare(a.trim(), b.trim());
|
return safeSemverCompare(a, b);
|
||||||
});
|
});
|
||||||
const canvas = new Canvas(1000, 800);
|
const canvas = new Canvas(1000, 800);
|
||||||
const chart = new Chart(canvas, {
|
const chart = new Chart(canvas, {
|
||||||
@@ -64387,7 +64409,7 @@ async function createReleaseDownloadsChart(metric, outputPath) {
|
|||||||
.filter((release) => release.tagName && release.downloads > 0)
|
.filter((release) => release.tagName && release.downloads > 0)
|
||||||
.sort((a, b) => b.downloads - a.downloads)
|
.sort((a, b) => b.downloads - a.downloads)
|
||||||
.slice(0, 10) // Show top 10 releases
|
.slice(0, 10) // Show top 10 releases
|
||||||
.sort((a, b) => semver.compare((a.tagName || '0.0.0').trim(), (b.tagName || '0.0.0').trim()));
|
.sort((a, b) => safeSemverCompare(a.tagName || '0.0.0', b.tagName || '0.0.0'));
|
||||||
if (sortedReleases.length === 0) {
|
if (sortedReleases.length === 0) {
|
||||||
// Return empty chart if no releases
|
// Return empty chart if no releases
|
||||||
return svgOutputPath;
|
return svgOutputPath;
|
||||||
|
|||||||
32
dist/summaries/github.js
vendored
32
dist/summaries/github.js
vendored
@@ -4,6 +4,28 @@ import { Canvas } from 'skia-canvas';
|
|||||||
import semver from "semver";
|
import semver from "semver";
|
||||||
// Register all Chart.js controllers
|
// Register all Chart.js controllers
|
||||||
Chart.register(...registerables);
|
Chart.register(...registerables);
|
||||||
|
/**
|
||||||
|
* Safely compare two version strings using semver
|
||||||
|
* Falls back to string comparison if semver parsing fails
|
||||||
|
*/
|
||||||
|
function safeSemverCompare(a, b) {
|
||||||
|
try {
|
||||||
|
// Clean and validate versions
|
||||||
|
const cleanA = a.trim();
|
||||||
|
const cleanB = b.trim();
|
||||||
|
// Check if versions are valid semver
|
||||||
|
if (!semver.valid(cleanA) || !semver.valid(cleanB)) {
|
||||||
|
// Fall back to string comparison for invalid semver
|
||||||
|
return cleanA.localeCompare(cleanB);
|
||||||
|
}
|
||||||
|
return semver.compare(cleanA, cleanB);
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
console.warn(`Semver comparison failed for "${a}" vs "${b}":`, error);
|
||||||
|
// Fall back to string comparison
|
||||||
|
return a.trim().localeCompare(b.trim());
|
||||||
|
}
|
||||||
|
}
|
||||||
export function formatGitHubSummary(summary, platformMetrics) {
|
export function formatGitHubSummary(summary, platformMetrics) {
|
||||||
let totalStars = 0;
|
let totalStars = 0;
|
||||||
let totalForks = 0;
|
let totalForks = 0;
|
||||||
@@ -81,7 +103,7 @@ export async function createGitHubReleaseChart(platformMetrics, outputPath) {
|
|||||||
function groupByReleaseCumulative(releaseRange) {
|
function groupByReleaseCumulative(releaseRange) {
|
||||||
const releases = {};
|
const releases = {};
|
||||||
for (const release of releaseRange.sort((a, b) => {
|
for (const release of releaseRange.sort((a, b) => {
|
||||||
return semver.compare((a.tagName || '0.0.0').trim(), (b.tagName || '0.0.0').trim());
|
return safeSemverCompare(a.tagName || '0.0.0', b.tagName || '0.0.0');
|
||||||
})) {
|
})) {
|
||||||
if (!release.tagName) {
|
if (!release.tagName) {
|
||||||
continue;
|
continue;
|
||||||
@@ -95,7 +117,7 @@ function groupByReleaseCumulative(releaseRange) {
|
|||||||
}
|
}
|
||||||
let cumulativeDownloads = 0;
|
let cumulativeDownloads = 0;
|
||||||
for (const release of Object.keys(releases).sort((a, b) => {
|
for (const release of Object.keys(releases).sort((a, b) => {
|
||||||
return semver.compare(a.trim(), b.trim());
|
return safeSemverCompare(a, b);
|
||||||
})) {
|
})) {
|
||||||
cumulativeDownloads += releases[release].downloads;
|
cumulativeDownloads += releases[release].downloads;
|
||||||
releases[release].downloads = cumulativeDownloads;
|
releases[release].downloads = cumulativeDownloads;
|
||||||
@@ -106,7 +128,7 @@ export async function createDownloadsPerReleaseChart(metric, outputPath) {
|
|||||||
const downloadsRange = metric.metrics?.downloadRange || [];
|
const downloadsRange = metric.metrics?.downloadRange || [];
|
||||||
const svgOutputPath = `${outputPath}/${metric.name.replace('/', '-')}-release-downloads.svg`;
|
const svgOutputPath = `${outputPath}/${metric.name.replace('/', '-')}-release-downloads.svg`;
|
||||||
const sortedReleases = downloadsRange.sort((a, b) => {
|
const sortedReleases = downloadsRange.sort((a, b) => {
|
||||||
return semver.compare((a.tagName || '0.0.0').trim(), (b.tagName || '0.0.0').trim());
|
return safeSemverCompare(a.tagName || '0.0.0', b.tagName || '0.0.0');
|
||||||
});
|
});
|
||||||
const canvas = new Canvas(1000, 800);
|
const canvas = new Canvas(1000, 800);
|
||||||
const chart = new Chart(canvas, {
|
const chart = new Chart(canvas, {
|
||||||
@@ -163,7 +185,7 @@ export async function createCumulativeDownloadsChart(metric, outputPath) {
|
|||||||
const groupedDownloads = groupByReleaseCumulative(downloadsRange);
|
const groupedDownloads = groupByReleaseCumulative(downloadsRange);
|
||||||
// Sort months chronologically
|
// Sort months chronologically
|
||||||
const semVerSortedReleases = Object.keys(groupedDownloads).sort((a, b) => {
|
const semVerSortedReleases = Object.keys(groupedDownloads).sort((a, b) => {
|
||||||
return semver.compare(a.trim(), b.trim());
|
return safeSemverCompare(a, b);
|
||||||
});
|
});
|
||||||
const canvas = new Canvas(1000, 800);
|
const canvas = new Canvas(1000, 800);
|
||||||
const chart = new Chart(canvas, {
|
const chart = new Chart(canvas, {
|
||||||
@@ -224,7 +246,7 @@ export async function createReleaseDownloadsChart(metric, outputPath) {
|
|||||||
.filter((release) => release.tagName && release.downloads > 0)
|
.filter((release) => release.tagName && release.downloads > 0)
|
||||||
.sort((a, b) => b.downloads - a.downloads)
|
.sort((a, b) => b.downloads - a.downloads)
|
||||||
.slice(0, 10) // Show top 10 releases
|
.slice(0, 10) // Show top 10 releases
|
||||||
.sort((a, b) => semver.compare((a.tagName || '0.0.0').trim(), (b.tagName || '0.0.0').trim()));
|
.sort((a, b) => safeSemverCompare(a.tagName || '0.0.0', b.tagName || '0.0.0'));
|
||||||
if (sortedReleases.length === 0) {
|
if (sortedReleases.length === 0) {
|
||||||
// Return empty chart if no releases
|
// Return empty chart if no releases
|
||||||
return svgOutputPath;
|
return svgOutputPath;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "usage-statistics",
|
"name": "usage-statistics",
|
||||||
"version": "1.0.9",
|
"version": "1.0.10",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"description": "A comprehensive GitHub Action for tracking download statistics across multiple platforms",
|
"description": "A comprehensive GitHub Action for tracking download statistics across multiple platforms",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
Reference in New Issue
Block a user