@unfoldingword/door43-preview-renderers 1.5.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/LICENSE +21 -0
- package/README.md +493 -0
- package/dist/index.esm.js +94813 -0
- package/dist/index.js +94847 -0
- package/package.json +94 -0
- package/src/cli.js +300 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 unfoldingWord
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,493 @@
|
|
|
1
|
+
# Door43 Preview Renderers
|
|
2
|
+
|
|
3
|
+
A JavaScript library for gathering content from various repositories and rendering HTML snippets for web previews and PDFs of translation resources.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🔌 API client for fetching content from Door43 repositories
|
|
8
|
+
- 🎨 Multiple converters for different content formats
|
|
9
|
+
- 📝 HTML snippet generation for web previews
|
|
10
|
+
- 🧱 Subject-aware HTML packaging via `renderHtmlData()`
|
|
11
|
+
- 📄 PDF-ready rendering
|
|
12
|
+
- ⚡ Modular and extensible architecture
|
|
13
|
+
- 🖥️ Command-line interface (CLI) for easy data retrieval
|
|
14
|
+
- 🔍 Smart dependency resolution for translation resources
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
### As a Library
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# Using pnpm (recommended)
|
|
22
|
+
pnpm add door43-preview-renderers
|
|
23
|
+
|
|
24
|
+
# Using npm
|
|
25
|
+
npm install door43-preview-renderers
|
|
26
|
+
|
|
27
|
+
# Using yarn
|
|
28
|
+
yarn add door43-preview-renderers
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### CLI Tool
|
|
32
|
+
|
|
33
|
+
The package includes a CLI tool that can be used directly:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Install globally
|
|
37
|
+
npm install -g door43-preview-renderers
|
|
38
|
+
|
|
39
|
+
# Or use via npx (no installation required)
|
|
40
|
+
npx door43-preview-renderers getAllCatalogEntries --owner unfoldingWord --repo en_tn --ref v80 --book gen
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Usage
|
|
44
|
+
|
|
45
|
+
### Library Usage
|
|
46
|
+
|
|
47
|
+
The renderer is a **composable chain**: each stage takes the previous stage's
|
|
48
|
+
output, so you can run the whole thing or start from any cached intermediate.
|
|
49
|
+
|
|
50
|
+
```javascript
|
|
51
|
+
import {
|
|
52
|
+
getResourceData,
|
|
53
|
+
renderHtmlData,
|
|
54
|
+
renderHTML,
|
|
55
|
+
renderPdf,
|
|
56
|
+
} from 'door43-preview-renderers';
|
|
57
|
+
|
|
58
|
+
// 1. Fetch + parse a resource (and its dependencies) from DCS
|
|
59
|
+
const resourceData = await getResourceData('unfoldingWord', 'en_ult', 'v89', ['tit'], {
|
|
60
|
+
dcs_api_url: 'https://git.door43.org/api/v1',
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// 2. Render to reusable HTML sections (pure, no network).
|
|
64
|
+
// Already have cached resourceData? Skip step 1 and pass it straight in here.
|
|
65
|
+
const htmlData = renderHtmlData(resourceData, {
|
|
66
|
+
renderOptions: { includeRawUsfmView: false, editorMode: false },
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
console.log(htmlData.sections.body); // HTML body string
|
|
70
|
+
|
|
71
|
+
// 3. Compose a self-contained document — web or print
|
|
72
|
+
const webHtml = renderHTML(htmlData); // continuous web page
|
|
73
|
+
const printHtml = renderHTML(htmlData, { media: 'print', print: { pageSize: 'A4_PORTRAIT' } });
|
|
74
|
+
|
|
75
|
+
// 4. …or render a PDF (requires the `weasyprint` binary)
|
|
76
|
+
const pdf = await renderPdf(htmlData, { pageSize: 'A4_PORTRAIT', outputPath: 'titus.pdf' });
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
> **📖 All options are documented in [`docs/options.md`](docs/options.md)** — every
|
|
80
|
+
> argument for each function, with defaults, examples, and recipes.
|
|
81
|
+
|
|
82
|
+
### CLI Usage
|
|
83
|
+
|
|
84
|
+
The CLI provides two main commands: `getAllCatalogEntries` and `getResourceData`.
|
|
85
|
+
|
|
86
|
+
#### Get All Catalog Entries
|
|
87
|
+
|
|
88
|
+
Retrieve a catalog entry along with all its required dependencies:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# Basic usage
|
|
92
|
+
node src/cli.js getResourceData --owner unfoldingWord --repo en_tn --ref v80 --book gen
|
|
93
|
+
|
|
94
|
+
# Quiet mode (no logging, just JSON output) - perfect for piping to jq
|
|
95
|
+
node src/cli.js getAllCatalogEntries --owner BSOJ --repo ar_twl --ref v5 --book 1jn --quiet
|
|
96
|
+
|
|
97
|
+
# Pipe to jq for filtering
|
|
98
|
+
node src/cli.js getAllCatalogEntries --owner BSOJ --repo ar_twl --ref v5 --book 1jn --quiet | jq '.catalogEntries[] | {owner, repo: .name, subject}'
|
|
99
|
+
|
|
100
|
+
# Save to file
|
|
101
|
+
node src/cli.js getAllCatalogEntries --owner unfoldingWord --repo en_tn --ref v80 --book gen --output result.json
|
|
102
|
+
|
|
103
|
+
# Use custom DCS API URL
|
|
104
|
+
node src/cli.js getAllCatalogEntries --owner myorg --repo myrepo --ref main --dcs-api-url https://custom-dcs.example.com/api/v1
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
#### Get Resource Data
|
|
108
|
+
|
|
109
|
+
Retrieve just the resource data for a specific repository:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
node src/cli.js getResourceData --owner unfoldingWord --repo en_tn --ref v80 --book gen
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
#### CLI Options
|
|
116
|
+
|
|
117
|
+
- `--owner <owner>` - Repository owner (required)
|
|
118
|
+
- `--repo <repo>` - Repository name (required)
|
|
119
|
+
- `--ref <ref>` - Git reference (branch, tag, or commit)
|
|
120
|
+
- `--book <bookId>` - Book ID (e.g., gen, exo, mat, 1ti, 1jn)
|
|
121
|
+
- `--dcs-api-url <url>` - Custom DCS API URL (optional, defaults to https://git.door43.org/api/v1)
|
|
122
|
+
- `--output <file>` - Output file path (optional, defaults to stdout)
|
|
123
|
+
- `--quiet, -q` - Suppress logging output (perfect for piping to jq or other tools)
|
|
124
|
+
|
|
125
|
+
## API Reference
|
|
126
|
+
|
|
127
|
+
### `getAllCatalogEntries()`
|
|
128
|
+
|
|
129
|
+
Fetches the full book-package catalog (the blueprint) for a resource — the main
|
|
130
|
+
entry plus all its dependencies. Stage 1 of the pipeline.
|
|
131
|
+
|
|
132
|
+
#### Parameters
|
|
133
|
+
|
|
134
|
+
```javascript
|
|
135
|
+
getAllCatalogEntries(source, options?)
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
- `source` (object): one of
|
|
139
|
+
- a **descriptor** `{ owner, repo, ref, books? }`
|
|
140
|
+
- an existing **catalog entry** object (its `url` is used to infer the DCS API base)
|
|
141
|
+
- an existing **CatalogSet** (returned unchanged — passthrough)
|
|
142
|
+
- `options` (object, optional):
|
|
143
|
+
- `dcs_api_url` (string): DCS API base URL (default: `https://git.door43.org/api/v1`)
|
|
144
|
+
- `quiet` (boolean): Suppress logging output (default: `false`)
|
|
145
|
+
- `books` (array): Books, when using the catalog-entry source form
|
|
146
|
+
|
|
147
|
+
#### Returns
|
|
148
|
+
|
|
149
|
+
Returns a Promise that resolves to a **CatalogSet**:
|
|
150
|
+
|
|
151
|
+
```javascript
|
|
152
|
+
{
|
|
153
|
+
resourceVersion: "v89", // the resource's version (tag/branch)
|
|
154
|
+
libraryVersion: "1.4.1", // this renderer library's npm version
|
|
155
|
+
catalogEntries: [ // main entry first, then dependencies
|
|
156
|
+
{ /* main catalog entry */ },
|
|
157
|
+
{ /* dependency 1 */ },
|
|
158
|
+
...
|
|
159
|
+
],
|
|
160
|
+
source: { owner, repo, ref, books, dcsApiUrl }
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
#### Logic and Dependency Resolution
|
|
165
|
+
|
|
166
|
+
The function intelligently resolves dependencies based on the resource subject:
|
|
167
|
+
|
|
168
|
+
1. **Translation Notes/Words** (`TSV Translation Notes`, `TSV Translation Words Links`):
|
|
169
|
+
- Finds the associated Translation Academy (TA)
|
|
170
|
+
- Finds the associated Translation Words (TW)
|
|
171
|
+
- Finds the Aligned Bible for the language
|
|
172
|
+
- Finds the Original Language texts (Hebrew OT and/or Greek NT)
|
|
173
|
+
|
|
174
|
+
2. **Translation Questions** (`TSV Translation Questions`):
|
|
175
|
+
- Finds the associated Bible translation
|
|
176
|
+
- Finds the Original Language texts
|
|
177
|
+
|
|
178
|
+
3. **OBS (Open Bible Stories)**:
|
|
179
|
+
- Finds the associated OBS Translation Notes
|
|
180
|
+
- Finds the associated OBS Translation Questions
|
|
181
|
+
- Finds the associated Translation Words
|
|
182
|
+
|
|
183
|
+
4. **Testament Filtering**: When specific books are requested, it only fetches:
|
|
184
|
+
- Hebrew Old Testament if OT books are requested
|
|
185
|
+
- Greek New Testament if NT books are requested
|
|
186
|
+
|
|
187
|
+
5. **Book Validation**: For Bible-related resources, it validates that the dependency contains all requested books before including it
|
|
188
|
+
|
|
189
|
+
6. **Date-Based Matching**: When searching for dependencies, it looks for entries with release dates within 5 days of the main entry's release date
|
|
190
|
+
|
|
191
|
+
7. **Fallback Search**: For Aligned Bibles, if standard naming (`*_ult`, `*_ust`) doesn't find a match, it searches by subject and language to find alternative Aligned Bible resources
|
|
192
|
+
|
|
193
|
+
8. **Stage Matching**: Attempts to match the same stage (e.g., `prod`, `preprod`, `latest`) as the main entry
|
|
194
|
+
|
|
195
|
+
#### Example
|
|
196
|
+
|
|
197
|
+
```javascript
|
|
198
|
+
const result = await getAllCatalogEntries(
|
|
199
|
+
{ owner: 'unfoldingWord', repo: 'en_tn', ref: 'v80', books: ['tit'] },
|
|
200
|
+
{ quiet: true }
|
|
201
|
+
);
|
|
202
|
+
|
|
203
|
+
// result.catalogEntries contains:
|
|
204
|
+
// - en_tn (Translation Notes)
|
|
205
|
+
// - en_ult (Aligned Bible)
|
|
206
|
+
// - en_ta (Translation Academy)
|
|
207
|
+
// - en_tw (Translation Words)
|
|
208
|
+
// - el-x-koine_ugnt (Greek New Testament)
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### `getResourceData()`
|
|
212
|
+
|
|
213
|
+
Fetches the catalog entry for a specific resource without resolving dependencies.
|
|
214
|
+
|
|
215
|
+
#### Parameters
|
|
216
|
+
|
|
217
|
+
```javascript
|
|
218
|
+
getResourceData(owner, repo, ref, books?, options?, is_extra?)
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
- `owner` (string): Repository owner
|
|
222
|
+
- `repo` (string): Repository name
|
|
223
|
+
- `ref` (string): Git reference (branch, tag, or commit)
|
|
224
|
+
- `books` (array, optional): Array of book identifiers to filter (default: `[]`)
|
|
225
|
+
- `options` (object, optional):
|
|
226
|
+
- `dcs_api_url` (string): DCS API base URL (default: `https://git.door43.org/api/v1`)
|
|
227
|
+
- `quiet` (boolean): Suppress logging output (default: `false`)
|
|
228
|
+
- `is_extra` (boolean, optional): Whether to include extra data (default: `false`)
|
|
229
|
+
|
|
230
|
+
#### Returns
|
|
231
|
+
|
|
232
|
+
Returns a Promise that resolves to a catalog entry object with detailed information about the resource.
|
|
233
|
+
|
|
234
|
+
#### Example
|
|
235
|
+
|
|
236
|
+
```javascript
|
|
237
|
+
const catalogEntry = await getResourceData('unfoldingWord', 'en_ult', 'master', ['gen', 'exo'], {
|
|
238
|
+
quiet: true,
|
|
239
|
+
dcs_api_url: 'https://git.door43.org/api/v1',
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
console.log(catalogEntry.subject); // "Aligned Bible"
|
|
243
|
+
console.log(catalogEntry.language); // "en"
|
|
244
|
+
console.log(catalogEntry.ingredients); // Array of books/chapters
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### `renderHtmlData()`
|
|
248
|
+
|
|
249
|
+
Renders subject-specific HTML **sections** from parsed resource data. Pure and
|
|
250
|
+
synchronous — **no network**. Feed it the output of `getResourceData()` (or any
|
|
251
|
+
cached/hand-built resource data).
|
|
252
|
+
|
|
253
|
+
> **Full option reference:** [`docs/options.md`](docs/options.md).
|
|
254
|
+
|
|
255
|
+
#### Parameters
|
|
256
|
+
|
|
257
|
+
```javascript
|
|
258
|
+
renderHtmlData(resourceData, options?)
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
- `resourceData` (object): Output of `getResourceData()` — the parsed resource.
|
|
262
|
+
- `options` (object, optional):
|
|
263
|
+
- `renderOptions` (object): Renderer-specific options (e.g. `includeRawUsfmView`, `editorMode`, `showChaptersInToc`)
|
|
264
|
+
- `books` (array | object): Book ordering/selection. Array of ids, or `{ id: range }` for per-book reference ranges (range filtering is planned).
|
|
265
|
+
|
|
266
|
+
#### Current subject support
|
|
267
|
+
|
|
268
|
+
- `Aligned Bible`, `Bible`, `Greek New Testament`, `Hebrew Old Testament`
|
|
269
|
+
- `Translation Academy`, `Translation Words`
|
|
270
|
+
- `Open Bible Stories`
|
|
271
|
+
- `TSV Translation Notes` / `TSV OBS Translation Notes`
|
|
272
|
+
- `TSV Translation Questions` / `Study Questions` / `Study Notes` (+ OBS variants)
|
|
273
|
+
|
|
274
|
+
#### Returns
|
|
275
|
+
|
|
276
|
+
An `HtmlData` package (cover/identity fields promoted to the top level):
|
|
277
|
+
|
|
278
|
+
```javascript
|
|
279
|
+
{
|
|
280
|
+
subject: "Aligned Bible",
|
|
281
|
+
title: "unfoldingWord® Literal Text",
|
|
282
|
+
abbreviation: "ult",
|
|
283
|
+
version: "v89",
|
|
284
|
+
direction: "ltr",
|
|
285
|
+
sections: {
|
|
286
|
+
cover: "<h1 ...",
|
|
287
|
+
copyright: "<div ...",
|
|
288
|
+
body: "<div class=\"section bible-book\" ...",
|
|
289
|
+
toc: [{ id: "nav-tit", title: "Titus", book: "tit" }],
|
|
290
|
+
css: { web: "...", print: "..." },
|
|
291
|
+
webView: null
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
### `renderHTML()`
|
|
297
|
+
|
|
298
|
+
Composes an `HtmlData` package into **one self-contained HTML document** for the
|
|
299
|
+
screen or for print. Pure and synchronous; returns a string.
|
|
300
|
+
|
|
301
|
+
> **Full option reference:** [`docs/options.md`](docs/options.md).
|
|
302
|
+
|
|
303
|
+
#### Parameters
|
|
304
|
+
|
|
305
|
+
```javascript
|
|
306
|
+
renderHTML(htmlData, options?)
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
- `htmlData` (object): Output of `renderHtmlData()`.
|
|
310
|
+
- `options` (object, optional): `media` (`'screen'`|`'print'`), `show` (which
|
|
311
|
+
sections to include), `columns`, `direction`, `engine`, and `print.*`
|
|
312
|
+
(pageSize, footerHtml, …). Screen omits cover/copyright/toc by default; print
|
|
313
|
+
includes them.
|
|
314
|
+
|
|
315
|
+
```javascript
|
|
316
|
+
const webHtml = renderHTML(htmlData); // continuous web page
|
|
317
|
+
const printHtml = renderHTML(htmlData, { media: 'print' }); // PagedJS/WeasyPrint-ready
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
## Development
|
|
321
|
+
|
|
322
|
+
### Prerequisites
|
|
323
|
+
|
|
324
|
+
- Node.js >= 16.0.0
|
|
325
|
+
- pnpm >= 8.0.0
|
|
326
|
+
|
|
327
|
+
### Setup
|
|
328
|
+
|
|
329
|
+
```bash
|
|
330
|
+
# Clone the repository
|
|
331
|
+
git clone https://github.com/unfoldingWord/door43-preview-renderers.git
|
|
332
|
+
cd door43-preview-renderers
|
|
333
|
+
|
|
334
|
+
# Install dependencies
|
|
335
|
+
pnpm install
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
### Running in Development
|
|
339
|
+
|
|
340
|
+
#### Style Guide (Component Documentation)
|
|
341
|
+
|
|
342
|
+
The style guide provides interactive documentation and examples of all components:
|
|
343
|
+
|
|
344
|
+
```bash
|
|
345
|
+
# Start the style guide development server
|
|
346
|
+
pnpm run styleguide
|
|
347
|
+
|
|
348
|
+
# Or use the dev alias
|
|
349
|
+
pnpm run styleguide:dev
|
|
350
|
+
|
|
351
|
+
# The style guide will be available at http://localhost:6060
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
#### CLI Development
|
|
355
|
+
|
|
356
|
+
```bash
|
|
357
|
+
# Run the CLI directly from source
|
|
358
|
+
node src/cli.js getAllCatalogEntries --owner unfoldingWord --repo en_tn --ref v80 --book gen
|
|
359
|
+
|
|
360
|
+
# Or use the npm script
|
|
361
|
+
pnpm run cli getAllCatalogEntries --owner unfoldingWord --repo en_tn --ref v80 --book gen
|
|
362
|
+
|
|
363
|
+
# Run with quiet mode for clean JSON output
|
|
364
|
+
node src/cli.js getAllCatalogEntries --owner BSOJ --repo ar_twl --ref v5 --book 1jn --quiet | jq
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
#### Development Build
|
|
368
|
+
|
|
369
|
+
```bash
|
|
370
|
+
# Start the development build watcher
|
|
371
|
+
pnpm run dev
|
|
372
|
+
|
|
373
|
+
# This will watch for changes and rebuild automatically
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
### Building
|
|
377
|
+
|
|
378
|
+
```bash
|
|
379
|
+
# Build the library for production
|
|
380
|
+
pnpm run build
|
|
381
|
+
|
|
382
|
+
# Build the style guide for deployment
|
|
383
|
+
pnpm run styleguide:build
|
|
384
|
+
|
|
385
|
+
# The built files will be in:
|
|
386
|
+
# - dist/ (library)
|
|
387
|
+
# - styleguide/ (documentation)
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
### Testing
|
|
391
|
+
|
|
392
|
+
```bash
|
|
393
|
+
# Run tests
|
|
394
|
+
pnpm test
|
|
395
|
+
|
|
396
|
+
# Run tests in watch mode
|
|
397
|
+
pnpm run test:watch
|
|
398
|
+
|
|
399
|
+
# Run tests with coverage
|
|
400
|
+
pnpm run test:coverage
|
|
401
|
+
|
|
402
|
+
# Run linting
|
|
403
|
+
pnpm run lint
|
|
404
|
+
|
|
405
|
+
# Format code
|
|
406
|
+
pnpm run format
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
## Production Usage
|
|
410
|
+
|
|
411
|
+
### Using the Library
|
|
412
|
+
|
|
413
|
+
After installing the package, import the functions you need:
|
|
414
|
+
|
|
415
|
+
```javascript
|
|
416
|
+
import { getAllCatalogEntries, getResourceData, renderHtmlData, renderHTML } from 'door43-preview-renderers';
|
|
417
|
+
|
|
418
|
+
// Your code here
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
### Using the CLI
|
|
422
|
+
|
|
423
|
+
#### Global Installation
|
|
424
|
+
|
|
425
|
+
```bash
|
|
426
|
+
# Install globally
|
|
427
|
+
npm install -g door43-preview-renderers
|
|
428
|
+
|
|
429
|
+
# Use the CLI command
|
|
430
|
+
door43-renderers getAllCatalogEntries --owner unfoldingWord --repo en_tn --ref v80 --book gen
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
#### Using npx (No Installation)
|
|
434
|
+
|
|
435
|
+
```bash
|
|
436
|
+
# Run directly with npx
|
|
437
|
+
npx door43-preview-renderers getAllCatalogEntries --owner unfoldingWord --repo en_tn --ref v80 --book gen
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
#### In CI/CD Pipelines
|
|
441
|
+
|
|
442
|
+
```bash
|
|
443
|
+
# Install as a dev dependency
|
|
444
|
+
npm install --save-dev door43-preview-renderers
|
|
445
|
+
|
|
446
|
+
# Use in package.json scripts
|
|
447
|
+
{
|
|
448
|
+
"scripts": {
|
|
449
|
+
"fetch-data": "door43-renderers getAllCatalogEntries --owner myorg --repo myrepo --ref main --quiet"
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
# Or use directly in CI
|
|
454
|
+
node_modules/.bin/door43-renderers getAllCatalogEntries --owner myorg --repo myrepo --ref main --output data.json
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
## Project Structure
|
|
458
|
+
|
|
459
|
+
```
|
|
460
|
+
door43-preview-renderers/
|
|
461
|
+
├── src/
|
|
462
|
+
│ ├── index.js # Main entry point
|
|
463
|
+
│ ├── cli.js # Command-line interface
|
|
464
|
+
│ ├── constants.js # Bible books and resource constants
|
|
465
|
+
│ ├── getResourceData.js # Core resource data fetching
|
|
466
|
+
│ ├── getAllCatalogEntries.js # Book-package catalog (blueprint)
|
|
467
|
+
│ ├── api/ # API client modules
|
|
468
|
+
│ ├── renderers/ # HTML rendering components
|
|
469
|
+
│ └── converters/ # Content format converters
|
|
470
|
+
├── docs/ # Documentation markdown files
|
|
471
|
+
│ ├── introduction.md
|
|
472
|
+
│ ├── constants.md # Constants documentation
|
|
473
|
+
│ ├── get-resource-data.md
|
|
474
|
+
│ ├── get-all-catalog-entries-for-rendering.md
|
|
475
|
+
│ └── ...
|
|
476
|
+
├── dist/ # Built library files (generated)
|
|
477
|
+
├── styleguide/ # Built style guide (generated)
|
|
478
|
+
└── package.json
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
## Contributing
|
|
482
|
+
|
|
483
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
484
|
+
|
|
485
|
+
## License
|
|
486
|
+
|
|
487
|
+
MIT © [unfoldingWord](https://github.com/unfoldingWord)
|
|
488
|
+
|
|
489
|
+
## Links
|
|
490
|
+
|
|
491
|
+
- [GitHub Repository](https://github.com/unfoldingWord/door43-preview-renderers)
|
|
492
|
+
- [Documentation](https://door43-preview-renderers.netlify.app)
|
|
493
|
+
- [Issue Tracker](https://github.com/unfoldingWord/door43-preview-renderers/issues)
|