@tandem-language-exchange/content-store 1.0.15 → 1.0.16
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/README.md +52 -52
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -219,58 +219,6 @@ Query options are applied in this order:
|
|
|
219
219
|
3. **`include`** — trim nested depth
|
|
220
220
|
4. **`select`** — pick output properties
|
|
221
221
|
|
|
222
|
-
## CLI
|
|
223
|
-
|
|
224
|
-
The package ships two CLI entry points that can be called from npm scripts in a consuming application.
|
|
225
|
-
|
|
226
|
-
### `fetch-content-bundles` — download bundles from S3
|
|
227
|
-
|
|
228
|
-
Downloads the latest version of each requested content type bundle from S3 and writes them as JSON files to a local directory. Reads S3 credentials from environment variables (see [S3 config via environment variables](#s3-config-via-environment-variables)).
|
|
229
|
-
|
|
230
|
-
```bash
|
|
231
|
-
npx fetch-content-bundles --cms contentful --types gridLayout,page
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
| Flag | Required | Default | Description |
|
|
235
|
-
| --- | --- | --- | --- |
|
|
236
|
-
| `--cms <provider>` | Yes | | `contentful` or `sanity` |
|
|
237
|
-
| `--types <types>` | Yes | | Comma-separated content types |
|
|
238
|
-
| `--output <dir>` | No | `./content-cache` | Local directory to write bundle files to |
|
|
239
|
-
|
|
240
|
-
Files are written as `{cms}-{contentType}.json` inside the output directory.
|
|
241
|
-
|
|
242
|
-
**Typical use in a host app's `package.json`:**
|
|
243
|
-
|
|
244
|
-
```json
|
|
245
|
-
"scripts": {
|
|
246
|
-
"fetch-content": "fetch-content-bundles --cms contentful --types gridLayout,iconWithText,page --output ./content-cache"
|
|
247
|
-
}
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
### `content-store query` — query a local bundle
|
|
251
|
-
|
|
252
|
-
Reads a previously fetched bundle from disk and prints filtered results as JSON. Invoke via `npx` or as a local script using `node`:
|
|
253
|
-
|
|
254
|
-
```bash
|
|
255
|
-
npx @tandem-language-exchange/content-store query \
|
|
256
|
-
--cms contentful --type gridLayout \
|
|
257
|
-
--fields '{"columns":"2"}' \
|
|
258
|
-
--select title,bodyBefore \
|
|
259
|
-
--limit 5 \
|
|
260
|
-
--include 2
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
| Flag | Required | Default | Description |
|
|
264
|
-
| --- | --- | --- | --- |
|
|
265
|
-
| `--cms <provider>` | Yes | | `contentful` or `sanity` |
|
|
266
|
-
| `--type <type>` | Yes | | Content type to query |
|
|
267
|
-
| `--output <dir>` | No | `./content-cache` | Directory where bundles are stored |
|
|
268
|
-
| `--fields <json>` | No | | JSON filter object (e.g. `'{"columns":"2"}'`) |
|
|
269
|
-
| `--select <props>` | No | | Comma-separated properties to include in results |
|
|
270
|
-
| `--limit <n>` | No | | Maximum number of results |
|
|
271
|
-
| `--include <n>` | No | | Depth of nested references to include |
|
|
272
|
-
|
|
273
|
-
---
|
|
274
222
|
|
|
275
223
|
## Standalone functions
|
|
276
224
|
|
|
@@ -328,3 +276,55 @@ const grids = await sdk.queryBundle('contentful', 'gridLayout', {
|
|
|
328
276
|
|
|
329
277
|
console.log(grids);
|
|
330
278
|
```
|
|
279
|
+
## CLI
|
|
280
|
+
|
|
281
|
+
The package ships two CLI entry points that can be called from npm scripts in a consuming application.
|
|
282
|
+
|
|
283
|
+
### `fetch-content-bundles` — download bundles from S3
|
|
284
|
+
|
|
285
|
+
Downloads the latest version of each requested content type bundle from S3 and writes them as JSON files to a local directory. Reads S3 credentials from environment variables (see [S3 config via environment variables](#s3-config-via-environment-variables)).
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
npx fetch-content-bundles --cms contentful --types gridLayout,page
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
| Flag | Required | Default | Description |
|
|
292
|
+
| --- | --- | --- | --- |
|
|
293
|
+
| `--cms <provider>` | Yes | | `contentful` or `sanity` |
|
|
294
|
+
| `--types <types>` | Yes | | Comma-separated content types |
|
|
295
|
+
| `--output <dir>` | No | `./content-cache` | Local directory to write bundle files to |
|
|
296
|
+
|
|
297
|
+
Files are written as `{cms}-{contentType}.json` inside the output directory.
|
|
298
|
+
|
|
299
|
+
**Typical use in a host app's `package.json`:**
|
|
300
|
+
|
|
301
|
+
```json
|
|
302
|
+
"scripts": {
|
|
303
|
+
"fetch-content": "fetch-content-bundles --cms contentful --types gridLayout,iconWithText,page --output ./content-cache"
|
|
304
|
+
}
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
### `content-store query` — query a local bundle
|
|
308
|
+
|
|
309
|
+
Reads a previously fetched bundle from disk and prints filtered results as JSON. Invoke via `npx` or as a local script using `node`:
|
|
310
|
+
|
|
311
|
+
```bash
|
|
312
|
+
npx @tandem-language-exchange/content-store query \
|
|
313
|
+
--cms contentful --type gridLayout \
|
|
314
|
+
--fields '{"columns":"2"}' \
|
|
315
|
+
--select title,bodyBefore \
|
|
316
|
+
--limit 5 \
|
|
317
|
+
--include 2
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
| Flag | Required | Default | Description |
|
|
321
|
+
| --- | --- | --- | --- |
|
|
322
|
+
| `--cms <provider>` | Yes | | `contentful` or `sanity` |
|
|
323
|
+
| `--type <type>` | Yes | | Content type to query |
|
|
324
|
+
| `--output <dir>` | No | `./content-cache` | Directory where bundles are stored |
|
|
325
|
+
| `--fields <json>` | No | | JSON filter object (e.g. `'{"columns":"2"}'`) |
|
|
326
|
+
| `--select <props>` | No | | Comma-separated properties to include in results |
|
|
327
|
+
| `--limit <n>` | No | | Maximum number of results |
|
|
328
|
+
| `--include <n>` | No | | Depth of nested references to include |
|
|
329
|
+
|
|
330
|
+
---
|