@byline/cli 1.6.2 → 1.7.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.
@@ -47,19 +47,6 @@ function formatNumber(n: number, decimalPlaces: number): string {
47
47
  })
48
48
  }
49
49
 
50
- // ---------------------------------------------------------------------------
51
- // Helpers
52
- // ---------------------------------------------------------------------------
53
-
54
- /**
55
- * Derive the avif thumbnail URL from the original storageUrl using the same
56
- * convention as MediaThumbnailCell / the Sharp upload processor.
57
- * `/uploads/media/2026/02/img.jpg` → `/uploads/media/2026/02/img-thumbnail.avif`
58
- */
59
- function deriveThumbnailUrl(storageUrl: string): string {
60
- return storageUrl.replace(/\.[^.]+$/, '-thumbnail.avif')
61
- }
62
-
63
50
  // ---------------------------------------------------------------------------
64
51
  // Order-by config
65
52
  // ---------------------------------------------------------------------------
@@ -261,11 +248,8 @@ export function MediaListView({
261
248
  {(data.docs as any[]).map((doc) => {
262
249
  const fields = doc.fields ?? {}
263
250
  const img = fields.image as StoredFileValue | null | undefined
264
- const thumbUrl = img?.storageUrl
265
- ? img.thumbnailGenerated
266
- ? deriveThumbnailUrl(img.storageUrl)
267
- : img.storageUrl
268
- : null
251
+ const thumbVariant = img?.variants?.find((v) => v.name === 'thumbnail')
252
+ const thumbUrl = thumbVariant?.storageUrl ?? img?.storageUrl ?? null
269
253
 
270
254
  const updatedAt = doc.updatedAt ?? null
271
255
 
@@ -8,18 +8,6 @@
8
8
 
9
9
  import type { FormatterProps, StoredFileValue } from '@byline/core'
10
10
 
11
- /**
12
- * Derive the thumbnail URL from the original storageUrl.
13
- *
14
- * Sharp writes variants as siblings of the original file using the naming
15
- * convention `<basename>-<variantName>.<outputExt>`:
16
- * `/uploads/media/2026/02/abc-photo.jpg`
17
- * → `/uploads/media/2026/02/abc-photo-thumbnail.avif`
18
- */
19
- function deriveThumbnailUrl(storageUrl: string): string {
20
- return storageUrl.replace(/\.[^.]+$/, '-thumbnail.avif')
21
- }
22
-
23
11
  /**
24
12
  * FormatBadge renders a muted pill showing the image format (e.g. JPEG, PNG, SVG).
25
13
  * Intended for use alongside the status badge in list-view card meta.
@@ -34,7 +22,7 @@ export function FormatBadge({ format }: { format: string }) {
34
22
 
35
23
  /**
36
24
  * MediaThumbnailCell renders a small preview image in the Media list view.
37
- * When the `thumbnail` variant has been generated, the smaller avif is used;
25
+ * When a `thumbnail` variant has been generated its `storageUrl` is used;
38
26
  * otherwise the original storage URL is shown.
39
27
  */
40
28
  export function MediaThumbnail({ record }: FormatterProps) {
@@ -50,7 +38,8 @@ export function MediaThumbnail({ record }: FormatterProps) {
50
38
  )
51
39
  }
52
40
 
53
- const thumbUrl = img.thumbnailGenerated ? deriveThumbnailUrl(img.storageUrl) : img.storageUrl
41
+ const thumbVariant = img.variants?.find((v) => v.name === 'thumbnail')
42
+ const thumbUrl = thumbVariant?.storageUrl ?? img.storageUrl
54
43
 
55
44
  return (
56
45
  <img
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@byline/cli",
3
3
  "private": false,
4
4
  "license": "MPL-2.0",
5
- "version": "1.6.2",
5
+ "version": "1.7.0",
6
6
  "engines": {
7
7
  "node": ">=20.9.0"
8
8
  },