@code-pushup/utils 0.8.25 → 0.10.0

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/index.js CHANGED
@@ -457,7 +457,8 @@ var uploadConfigSchema = z10.object({
457
457
  description: "API key with write access to portal (use `process.env` for security)"
458
458
  }),
459
459
  organization: slugSchema("Organization slug from Code PushUp portal"),
460
- project: slugSchema("Project slug from Code PushUp portal")
460
+ project: slugSchema("Project slug from Code PushUp portal"),
461
+ timeout: z10.number({ description: "Request timeout in minutes (default is 5)" }).positive().int().optional()
461
462
  });
462
463
 
463
464
  // packages/models/src/lib/core-config.ts
@@ -585,6 +586,18 @@ function formatDuration(duration) {
585
586
  }
586
587
  return `${(duration / 1e3).toFixed(2)} s`;
587
588
  }
589
+ function formatDate(date) {
590
+ const locale = "en-US";
591
+ return date.toLocaleString(locale, {
592
+ weekday: "short",
593
+ month: "short",
594
+ day: "numeric",
595
+ year: "numeric",
596
+ hour: "numeric",
597
+ minute: "2-digit",
598
+ timeZoneName: "short"
599
+ }).replace(/\u202F/g, " ");
600
+ }
588
601
  function truncateText(text, maxChars) {
589
602
  if (text.length <= maxChars) {
590
603
  return text;
@@ -1263,7 +1276,7 @@ function reportToDetailsSection(audit) {
1263
1276
  return details(detailsTitle, detailsTable);
1264
1277
  }
1265
1278
  function reportToAboutSection(report, commitData) {
1266
- const date = (/* @__PURE__ */ new Date()).toString();
1279
+ const date = formatDate(/* @__PURE__ */ new Date());
1267
1280
  const { duration, version, plugins, categories } = report;
1268
1281
  const commitInfo = commitData ? `${commitData.message} (${commitData.hash.slice(0, 7)})` : "N/A";
1269
1282
  const reportMetaTable = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-pushup/utils",
3
- "version": "0.8.25",
3
+ "version": "0.10.0",
4
4
  "dependencies": {
5
5
  "@code-pushup/models": "*",
6
6
  "bundle-require": "^4.0.1",
@@ -3,6 +3,7 @@ export declare function pluralize(text: string): string;
3
3
  export declare function formatBytes(bytes: number, decimals?: number): string;
4
4
  export declare function pluralizeToken(token: string, times?: number): string;
5
5
  export declare function formatDuration(duration: number): string;
6
+ export declare function formatDate(date: Date): string;
6
7
  export declare function truncateText(text: string, maxChars: number): string;
7
8
  export declare function truncateTitle(text: string): string;
8
9
  export declare function truncateDescription(text: string): string;