@byline/cli 1.2.1 → 1.4.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.
@@ -74,10 +74,34 @@ async function buildBylineCore(): Promise<BylineCore<AdminStore>> {
74
74
  collections,
75
75
  db,
76
76
  adminStore,
77
+ // Local filesystem — suitable for development and self-hosted
78
+ // deployments. For cloud/production, swap to `@byline/storage-s3`
79
+ // (see the commented example below).
77
80
  storage: localStorageProvider({
78
81
  uploadDir: './public/uploads',
79
82
  baseUrl: '/uploads',
80
83
  }),
84
+ // S3-compatible alternative (AWS S3 / Cloudflare R2 / MinIO). Replace
85
+ // the `localStorageProvider` block above with the call below and add
86
+ // the matching `BYLINE_STORAGE_S3_*` entries to your `.env`.
87
+ //
88
+ // On AWS with an IAM role / instance profile, omit `accessKeyId` and
89
+ // `secretAccessKey` — the SDK resolves credentials via its default
90
+ // provider chain. Never bake long-lived keys into a deployed image.
91
+ //
92
+ // import { s3StorageProvider } from '@byline/storage-s3'
93
+ //
94
+ // storage: s3StorageProvider({
95
+ // bucket: process.env.BYLINE_STORAGE_S3_BUCKET!,
96
+ // region: process.env.BYLINE_STORAGE_S3_REGION!,
97
+ // accessKeyId: process.env.BYLINE_STORAGE_S3_ACCESS_KEY_ID,
98
+ // secretAccessKey: process.env.BYLINE_STORAGE_S3_SECRET_ACCESS_KEY,
99
+ // publicUrl: process.env.BYLINE_STORAGE_S3_PUBLIC_URL,
100
+ // endpoint: process.env.BYLINE_STORAGE_S3_ENDPOINT,
101
+ // forcePathStyle: process.env.BYLINE_STORAGE_S3_FORCE_PATH_STYLE === 'true',
102
+ // pathPrefix: process.env.BYLINE_STORAGE_S3_PATH_PREFIX,
103
+ // cacheControl: 'public, max-age=31536000, immutable',
104
+ // }),
81
105
  sessionProvider,
82
106
  fields: {
83
107
  richText: { populate: lexicalEditorServer({ getClient: getAdminBylineClient }) },
@@ -40,8 +40,10 @@
40
40
  * `current_published_documents` returns to public readers.
41
41
  *
42
42
  * Currently requires the local storage provider — pulls bytes back via
43
- * the provider's `uploadDir`. An S3-capable variant would add a
44
- * `download(storagePath)` to `IStorageProvider` and route through that.
43
+ * the provider's `uploadDir`. Variant generation itself is provider-
44
+ * agnostic; the local-only piece is reading the *original* bytes back
45
+ * from disk. An S3-capable variant would add a `download(storagePath)`
46
+ * primitive to `IStorageProvider` and route through that.
45
47
  */
46
48
 
47
49
  import 'dotenv/config'
@@ -143,18 +145,15 @@ async function run(): Promise<void> {
143
145
  imageProcessor: {
144
146
  extractMeta: extractImageMeta,
145
147
  isBypassMimeType,
146
- generateVariants: async ({ buffer, mimeType, storedFile, storage, upload, logger }) => {
147
- const dir = (storage as { uploadDir?: unknown }).uploadDir as string
148
- const absoluteOriginalPath = path.join(dir, storedFile.storagePath)
149
- return generateImageVariants(
148
+ generateVariants: ({ buffer, mimeType, storedFile, storage, upload, logger }) =>
149
+ generateImageVariants(
150
150
  buffer,
151
151
  mimeType,
152
- absoluteOriginalPath,
153
- dir,
152
+ storedFile,
153
+ storage,
154
154
  upload.sizes ?? [],
155
155
  logger
156
- )
157
- },
156
+ ),
158
157
  },
159
158
  }
160
159
 
@@ -119,13 +119,34 @@ async function buildBylineCore(): Promise<BylineCore<AdminStore>> {
119
119
  // addition to) this site-wide default.
120
120
  //
121
121
  // Local filesystem is suitable for development and self-hosted
122
- // deployments. Swap for '@byline/storage-s3' (s3StorageProvider) for
123
- // cloud/production. The `uploadDir` is served as a static path at
124
- // `baseUrl` by your web server.
122
+ // deployments. The `uploadDir` is served as a static path at `baseUrl`
123
+ // by your web server. For cloud/production deployments, swap to
124
+ // `@byline/storage-s3` see the commented example below.
125
125
  storage: localStorageProvider({
126
126
  uploadDir: './public/uploads',
127
127
  baseUrl: '/uploads',
128
128
  }),
129
+ // S3-compatible alternative (AWS S3 / Cloudflare R2 / MinIO). Replace
130
+ // the `localStorageProvider` block above with the call below and add
131
+ // the corresponding `BYLINE_STORAGE_S3_*` entries to your `.env`.
132
+ //
133
+ // On AWS with an IAM role / instance profile, omit `accessKeyId` and
134
+ // `secretAccessKey` so the SDK resolves credentials via its default
135
+ // provider chain — never bake long-lived keys into a deployed image.
136
+ //
137
+ // import { s3StorageProvider } from '@byline/storage-s3'
138
+ //
139
+ // storage: s3StorageProvider({
140
+ // bucket: process.env.BYLINE_STORAGE_S3_BUCKET!,
141
+ // region: process.env.BYLINE_STORAGE_S3_REGION!,
142
+ // accessKeyId: process.env.BYLINE_STORAGE_S3_ACCESS_KEY_ID,
143
+ // secretAccessKey: process.env.BYLINE_STORAGE_S3_SECRET_ACCESS_KEY,
144
+ // publicUrl: process.env.BYLINE_STORAGE_S3_PUBLIC_URL,
145
+ // endpoint: process.env.BYLINE_STORAGE_S3_ENDPOINT,
146
+ // forcePathStyle: process.env.BYLINE_STORAGE_S3_FORCE_PATH_STYLE === 'true',
147
+ // pathPrefix: process.env.BYLINE_STORAGE_S3_PATH_PREFIX,
148
+ // cacheControl: 'public, max-age=31536000, immutable',
149
+ // }),
129
150
  sessionProvider,
130
151
  fields: {
131
152
  // Server-side richtext adapter — refreshes embedded relation
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.2.1",
5
+ "version": "1.4.0",
6
6
  "engines": {
7
7
  "node": ">=20.9.0"
8
8
  },