docula 1.8.0 → 1.9.1
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/dist/docula.d.ts +189 -173
- package/dist/docula.js +3158 -2514
- package/package.json +5 -1
- package/templates/classic/api.hbs +1 -0
- package/templates/classic/changelog-entry.hbs +2 -1
- package/templates/classic/changelog.hbs +2 -1
- package/templates/classic/css/multipage.css +18 -0
- package/templates/classic/docs.hbs +1 -0
- package/templates/classic/home.hbs +1 -0
- package/templates/classic/includes/header.hbs +1 -0
- package/templates/classic/includes/multipage/doc.hbs +6 -0
- package/templates/classic/includes/multipage/home.hbs +1 -1
- package/templates/classic/includes/opengraph.hbs +18 -0
- package/templates/classic/includes/singlepage/content.hbs +1 -1
- package/templates/modern/api.hbs +1 -0
- package/templates/modern/changelog-entry.hbs +1 -0
- package/templates/modern/changelog.hbs +2 -1
- package/templates/modern/css/styles.css +17 -0
- package/templates/modern/docs.hbs +1 -0
- package/templates/modern/home.hbs +1 -0
- package/templates/modern/includes/doc.hbs +6 -0
- package/templates/modern/includes/header-bar.hbs +2 -2
- package/templates/modern/includes/header.hbs +4 -1
- package/templates/modern/includes/home.hbs +1 -1
- package/templates/modern/includes/opengraph.hbs +18 -0
package/dist/docula.d.ts
CHANGED
|
@@ -2,6 +2,48 @@ import fs from 'node:fs';
|
|
|
2
2
|
import http from 'node:http';
|
|
3
3
|
export { Writr } from 'writr';
|
|
4
4
|
|
|
5
|
+
declare class DoculaConsole {
|
|
6
|
+
quiet: boolean;
|
|
7
|
+
log(message: string): void;
|
|
8
|
+
error(message: string): void;
|
|
9
|
+
warn(message: string): void;
|
|
10
|
+
success(message: string): void;
|
|
11
|
+
info(message: string): void;
|
|
12
|
+
step(message: string): void;
|
|
13
|
+
fileBuilt(filePath: string): void;
|
|
14
|
+
fileCopied(filePath: string): void;
|
|
15
|
+
serverLog(method: string, url: string, statusCode: number, durationMs?: number): void;
|
|
16
|
+
banner(message: string): void;
|
|
17
|
+
printHelp(): void;
|
|
18
|
+
parseProcessArgv(argv: string[]): DoculaConsoleProcess;
|
|
19
|
+
getCommand(argv: string[]): string | undefined;
|
|
20
|
+
getArguments(argv: string[]): DoculaConsoleArguments;
|
|
21
|
+
}
|
|
22
|
+
type DoculaConsoleProcess = {
|
|
23
|
+
argv: string[];
|
|
24
|
+
command: string | undefined;
|
|
25
|
+
args: DoculaConsoleArguments;
|
|
26
|
+
};
|
|
27
|
+
type DoculaConsoleArguments = {
|
|
28
|
+
sitePath: string | undefined;
|
|
29
|
+
templatePath: string | undefined;
|
|
30
|
+
template: string | undefined;
|
|
31
|
+
output: string | undefined;
|
|
32
|
+
watch: boolean;
|
|
33
|
+
clean: boolean;
|
|
34
|
+
build: boolean;
|
|
35
|
+
port: number | undefined;
|
|
36
|
+
typescript: boolean;
|
|
37
|
+
javascript: boolean;
|
|
38
|
+
overwrite: boolean;
|
|
39
|
+
downloadTarget: string;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
type GithubData = {
|
|
43
|
+
releases: Record<string, unknown>;
|
|
44
|
+
contributors: Record<string, unknown>;
|
|
45
|
+
};
|
|
46
|
+
|
|
5
47
|
type ApiSchemaProperty = {
|
|
6
48
|
name: string;
|
|
7
49
|
type: string;
|
|
@@ -87,45 +129,97 @@ type ApiSpecData = {
|
|
|
87
129
|
securitySchemes: ApiSecurityScheme[];
|
|
88
130
|
};
|
|
89
131
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
getCommand(argv: string[]): string | undefined;
|
|
104
|
-
getArguments(argv: string[]): DoculaConsoleArguments;
|
|
105
|
-
}
|
|
106
|
-
type DoculaConsoleProcess = {
|
|
107
|
-
argv: string[];
|
|
108
|
-
command: string | undefined;
|
|
109
|
-
args: DoculaConsoleArguments;
|
|
132
|
+
type DoculaChangelogEntry = {
|
|
133
|
+
title: string;
|
|
134
|
+
date: string;
|
|
135
|
+
formattedDate: string;
|
|
136
|
+
tag?: string;
|
|
137
|
+
tagClass?: string;
|
|
138
|
+
slug: string;
|
|
139
|
+
content: string;
|
|
140
|
+
generatedHtml: string;
|
|
141
|
+
preview: string;
|
|
142
|
+
previewImage?: string;
|
|
143
|
+
urlPath: string;
|
|
144
|
+
lastModified: string;
|
|
110
145
|
};
|
|
111
|
-
type
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
146
|
+
type DoculaData = {
|
|
147
|
+
siteUrl: string;
|
|
148
|
+
siteTitle: string;
|
|
149
|
+
siteDescription: string;
|
|
150
|
+
sitePath: string;
|
|
151
|
+
templatePath: string;
|
|
152
|
+
output: string;
|
|
153
|
+
githubPath?: string;
|
|
154
|
+
github?: GithubData;
|
|
155
|
+
templates?: DoculaTemplates;
|
|
156
|
+
hasDocuments?: boolean;
|
|
157
|
+
hasChangelog?: boolean;
|
|
158
|
+
sections?: DoculaSection[];
|
|
159
|
+
documents?: DoculaDocument[];
|
|
160
|
+
sidebarItems?: DoculaSection[];
|
|
161
|
+
announcement?: string;
|
|
162
|
+
openApiUrl?: string;
|
|
163
|
+
hasApi?: boolean;
|
|
164
|
+
apiSpec?: ApiSpecData;
|
|
165
|
+
changelogEntries?: DoculaChangelogEntry[];
|
|
166
|
+
hasReadme?: boolean;
|
|
167
|
+
themeMode?: string;
|
|
168
|
+
cookieAuth?: {
|
|
169
|
+
loginUrl: string;
|
|
170
|
+
logoutUrl?: string;
|
|
171
|
+
authCheckUrl?: string;
|
|
172
|
+
authCheckMethod?: string;
|
|
173
|
+
authCheckUserPath?: string;
|
|
174
|
+
};
|
|
175
|
+
headerLinks?: Array<{
|
|
176
|
+
label: string;
|
|
177
|
+
url: string;
|
|
178
|
+
icon?: string;
|
|
179
|
+
}>;
|
|
180
|
+
enableLlmsTxt?: boolean;
|
|
181
|
+
hasFeed?: boolean;
|
|
182
|
+
lastModified?: string;
|
|
183
|
+
baseUrl: string;
|
|
184
|
+
docsPath: string;
|
|
185
|
+
apiPath: string;
|
|
186
|
+
changelogPath: string;
|
|
187
|
+
docsUrl: string;
|
|
188
|
+
apiUrl: string;
|
|
189
|
+
changelogUrl: string;
|
|
190
|
+
editPageUrl?: string;
|
|
191
|
+
openGraph?: DoculaOpenGraph;
|
|
124
192
|
};
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
193
|
+
type DoculaTemplates = {
|
|
194
|
+
home: string;
|
|
195
|
+
docPage?: string;
|
|
196
|
+
api?: string;
|
|
197
|
+
changelog?: string;
|
|
198
|
+
changelogEntry?: string;
|
|
199
|
+
};
|
|
200
|
+
type DoculaSection = {
|
|
201
|
+
name: string;
|
|
202
|
+
order?: number;
|
|
203
|
+
path: string;
|
|
204
|
+
children?: DoculaSection[];
|
|
205
|
+
};
|
|
206
|
+
type DoculaDocument = {
|
|
207
|
+
title: string;
|
|
208
|
+
navTitle: string;
|
|
209
|
+
description: string;
|
|
210
|
+
order?: number;
|
|
211
|
+
section?: string;
|
|
212
|
+
keywords: string[];
|
|
213
|
+
content: string;
|
|
214
|
+
markdown: string;
|
|
215
|
+
generatedHtml: string;
|
|
216
|
+
documentPath: string;
|
|
217
|
+
urlPath: string;
|
|
218
|
+
isRoot: boolean;
|
|
219
|
+
lastModified: string;
|
|
220
|
+
ogTitle?: string;
|
|
221
|
+
ogDescription?: string;
|
|
222
|
+
ogImage?: string;
|
|
129
223
|
};
|
|
130
224
|
|
|
131
225
|
type DoculaCookieAuth = {
|
|
@@ -140,11 +234,25 @@ type DoculaHeaderLink = {
|
|
|
140
234
|
url: string;
|
|
141
235
|
icon?: string;
|
|
142
236
|
};
|
|
237
|
+
type DoculaOpenGraph = {
|
|
238
|
+
title?: string;
|
|
239
|
+
description?: string;
|
|
240
|
+
image?: string;
|
|
241
|
+
url?: string;
|
|
242
|
+
type?: string;
|
|
243
|
+
siteName?: string;
|
|
244
|
+
twitterCard?: string;
|
|
245
|
+
};
|
|
143
246
|
type DoculaCacheOptions = {
|
|
144
247
|
github: {
|
|
145
248
|
ttl: number;
|
|
146
249
|
};
|
|
147
250
|
};
|
|
251
|
+
type DoculaAIOptions = {
|
|
252
|
+
provider: string;
|
|
253
|
+
model?: string;
|
|
254
|
+
apiKey: string;
|
|
255
|
+
};
|
|
148
256
|
declare class DoculaOptions {
|
|
149
257
|
/**
|
|
150
258
|
* Name of the built-in template to use (e.g., "modern", "classic")
|
|
@@ -216,6 +324,16 @@ declare class DoculaOptions {
|
|
|
216
324
|
* site directory's .gitignore file if not already present.
|
|
217
325
|
*/
|
|
218
326
|
autoUpdateIgnores: boolean;
|
|
327
|
+
/**
|
|
328
|
+
* When true, automatically copies the project root README.md into the site
|
|
329
|
+
* directory if one does not already exist. The package.json name field is
|
|
330
|
+
* used to prepend a title heading when the README lacks one.
|
|
331
|
+
*/
|
|
332
|
+
autoReadme: boolean;
|
|
333
|
+
/**
|
|
334
|
+
* When true, suppresses all non-error console output during the build.
|
|
335
|
+
*/
|
|
336
|
+
quiet: boolean;
|
|
219
337
|
/**
|
|
220
338
|
* Base URL path prefix for all generated paths (e.g., "/docs").
|
|
221
339
|
* When set, all asset and navigation URLs are prefixed with this path.
|
|
@@ -234,6 +352,19 @@ declare class DoculaOptions {
|
|
|
234
352
|
* Output subdirectory and URL segment for changelog pages.
|
|
235
353
|
*/
|
|
236
354
|
changelogPath: string;
|
|
355
|
+
/**
|
|
356
|
+
* Base URL for "Edit this page" links on documentation pages.
|
|
357
|
+
* When set, an edit link is shown at the bottom of each doc page.
|
|
358
|
+
* The document's relative path is appended to this URL.
|
|
359
|
+
* Example: "https://github.com/owner/repo/edit/main/site/docs"
|
|
360
|
+
*/
|
|
361
|
+
editPageUrl?: string;
|
|
362
|
+
/**
|
|
363
|
+
* OpenGraph meta tags for social sharing. When set, og: and twitter:
|
|
364
|
+
* meta tags are rendered in the page head. Fields fall back to
|
|
365
|
+
* siteTitle / siteDescription / siteUrl when omitted.
|
|
366
|
+
*/
|
|
367
|
+
openGraph?: DoculaOpenGraph;
|
|
237
368
|
/**
|
|
238
369
|
* Cookie-based authentication. When set, shows a Login/Logout button
|
|
239
370
|
* in the header based on whether a JWT cookie is present.
|
|
@@ -245,9 +376,11 @@ declare class DoculaOptions {
|
|
|
245
376
|
*/
|
|
246
377
|
headerLinks?: DoculaHeaderLink[];
|
|
247
378
|
/**
|
|
248
|
-
*
|
|
249
|
-
*
|
|
379
|
+
* AI-powered metadata enrichment configuration. When set, uses AI to fill
|
|
380
|
+
* missing OpenGraph and HTML meta tag fields during the build.
|
|
381
|
+
* Requires provider name and API key. Omit to disable AI enrichment.
|
|
250
382
|
*/
|
|
383
|
+
ai?: DoculaAIOptions;
|
|
251
384
|
/**
|
|
252
385
|
* Cache settings. Controls caching of external data (e.g., GitHub API responses)
|
|
253
386
|
* in the .cache directory within the site path.
|
|
@@ -262,103 +395,21 @@ declare class DoculaOptions {
|
|
|
262
395
|
parseOptions(options: Record<string, any>): void;
|
|
263
396
|
}
|
|
264
397
|
|
|
265
|
-
type
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
formattedDate: string;
|
|
269
|
-
tag?: string;
|
|
270
|
-
tagClass?: string;
|
|
271
|
-
slug: string;
|
|
272
|
-
content: string;
|
|
273
|
-
generatedHtml: string;
|
|
274
|
-
preview: string;
|
|
275
|
-
previewImage?: string;
|
|
276
|
-
urlPath: string;
|
|
277
|
-
lastModified: string;
|
|
278
|
-
};
|
|
279
|
-
type DoculaData = {
|
|
280
|
-
siteUrl: string;
|
|
281
|
-
siteTitle: string;
|
|
282
|
-
siteDescription: string;
|
|
283
|
-
sitePath: string;
|
|
284
|
-
templatePath: string;
|
|
285
|
-
output: string;
|
|
286
|
-
githubPath?: string;
|
|
287
|
-
github?: GithubData;
|
|
288
|
-
templates?: DoculaTemplates;
|
|
289
|
-
hasDocuments?: boolean;
|
|
290
|
-
hasChangelog?: boolean;
|
|
291
|
-
sections?: DoculaSection[];
|
|
292
|
-
documents?: DoculaDocument[];
|
|
293
|
-
sidebarItems?: DoculaSection[];
|
|
294
|
-
announcement?: string;
|
|
295
|
-
openApiUrl?: string;
|
|
296
|
-
hasApi?: boolean;
|
|
297
|
-
apiSpec?: ApiSpecData;
|
|
298
|
-
changelogEntries?: DoculaChangelogEntry[];
|
|
299
|
-
hasReadme?: boolean;
|
|
300
|
-
themeMode?: string;
|
|
301
|
-
cookieAuth?: {
|
|
302
|
-
loginUrl: string;
|
|
303
|
-
logoutUrl?: string;
|
|
304
|
-
authCheckUrl?: string;
|
|
305
|
-
authCheckMethod?: string;
|
|
306
|
-
authCheckUserPath?: string;
|
|
307
|
-
};
|
|
308
|
-
headerLinks?: Array<{
|
|
309
|
-
label: string;
|
|
310
|
-
url: string;
|
|
311
|
-
icon?: string;
|
|
312
|
-
}>;
|
|
313
|
-
enableLlmsTxt?: boolean;
|
|
314
|
-
hasFeed?: boolean;
|
|
315
|
-
lastModified?: string;
|
|
316
|
-
baseUrl: string;
|
|
317
|
-
docsPath: string;
|
|
318
|
-
apiPath: string;
|
|
319
|
-
changelogPath: string;
|
|
320
|
-
docsUrl: string;
|
|
321
|
-
apiUrl: string;
|
|
322
|
-
changelogUrl: string;
|
|
323
|
-
};
|
|
324
|
-
type DoculaTemplates = {
|
|
325
|
-
home: string;
|
|
326
|
-
docPage?: string;
|
|
327
|
-
api?: string;
|
|
328
|
-
changelog?: string;
|
|
329
|
-
changelogEntry?: string;
|
|
330
|
-
};
|
|
331
|
-
type DoculaSection = {
|
|
332
|
-
name: string;
|
|
333
|
-
order?: number;
|
|
334
|
-
path: string;
|
|
335
|
-
children?: DoculaSection[];
|
|
336
|
-
};
|
|
337
|
-
type DoculaDocument = {
|
|
338
|
-
title: string;
|
|
339
|
-
navTitle: string;
|
|
340
|
-
description: string;
|
|
341
|
-
order?: number;
|
|
342
|
-
section?: string;
|
|
343
|
-
keywords: string[];
|
|
344
|
-
content: string;
|
|
345
|
-
markdown: string;
|
|
346
|
-
generatedHtml: string;
|
|
347
|
-
documentPath: string;
|
|
348
|
-
urlPath: string;
|
|
349
|
-
isRoot: boolean;
|
|
350
|
-
lastModified: string;
|
|
351
|
-
};
|
|
398
|
+
type DoculaBuilderOptions = {
|
|
399
|
+
console?: DoculaConsole;
|
|
400
|
+
} & DoculaOptions;
|
|
352
401
|
declare class DoculaBuilder {
|
|
353
402
|
private readonly _options;
|
|
354
403
|
private readonly _ecto;
|
|
355
404
|
private readonly _console;
|
|
356
405
|
private readonly _hash;
|
|
357
406
|
onReleaseChangelog?: (entries: DoculaChangelogEntry[], console: DoculaConsole) => Promise<DoculaChangelogEntry[]> | DoculaChangelogEntry[];
|
|
358
|
-
|
|
407
|
+
get console(): DoculaConsole;
|
|
408
|
+
constructor(options?: DoculaBuilderOptions, engineOptions?: any);
|
|
359
409
|
get options(): DoculaOptions;
|
|
360
410
|
build(): Promise<void>;
|
|
361
411
|
validateOptions(options: DoculaOptions): void;
|
|
412
|
+
autoReadme(): Promise<void>;
|
|
362
413
|
getGithubData(githubPath: string): Promise<GithubData>;
|
|
363
414
|
getTemplates(templatePath: string, hasDocuments: boolean, hasChangelog?: boolean): Promise<DoculaTemplates>;
|
|
364
415
|
getTemplateFile(path: string, name: string): Promise<string | undefined>;
|
|
@@ -367,22 +418,16 @@ declare class DoculaBuilder {
|
|
|
367
418
|
buildFeedPage(data: DoculaData): Promise<void>;
|
|
368
419
|
buildChangelogFeedJson(data: DoculaData): Promise<void>;
|
|
369
420
|
buildChangelogLatestFeedJson(data: DoculaData): Promise<void>;
|
|
370
|
-
private writeChangelogFeedJson;
|
|
371
421
|
buildLlmsFiles(data: DoculaData): Promise<void>;
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
private resolveLocalOpenApiPath;
|
|
382
|
-
private getSafeSiteOverrideFileContent;
|
|
383
|
-
private getSafeLocalOpenApiSpec;
|
|
384
|
-
private isPathWithinBasePath;
|
|
385
|
-
private toPosixPath;
|
|
422
|
+
resolveOpenGraphData(data: DoculaData, pageUrl: string, pageData?: Partial<DoculaDocument> & {
|
|
423
|
+
previewImage?: string;
|
|
424
|
+
preview?: string;
|
|
425
|
+
}): Record<string, string | undefined>;
|
|
426
|
+
resolveJsonLd(pageType: "home" | "docs" | "api" | "changelog" | "changelog-entry", data: DoculaData, pageUrl: string, pageData?: Partial<DoculaDocument> & {
|
|
427
|
+
date?: string;
|
|
428
|
+
preview?: string;
|
|
429
|
+
previewImage?: string;
|
|
430
|
+
}): string;
|
|
386
431
|
buildIndexPage(data: DoculaData): Promise<void>;
|
|
387
432
|
buildDocsHomePage(data: DoculaData): Promise<void>;
|
|
388
433
|
buildReadmeSection(data: DoculaData): Promise<string>;
|
|
@@ -404,36 +449,6 @@ declare class DoculaBuilder {
|
|
|
404
449
|
getSections(sitePath: string, doculaOptions: DoculaOptions): DoculaSection[];
|
|
405
450
|
mergeSectionWithOptions(section: DoculaSection, options: DoculaOptions): DoculaSection;
|
|
406
451
|
parseDocumentData(documentPath: string): DoculaDocument;
|
|
407
|
-
private hasTableOfContents;
|
|
408
|
-
private directoryContainsMarkdown;
|
|
409
|
-
private mergeTemplateOverrides;
|
|
410
|
-
private ensureCacheInGitignore;
|
|
411
|
-
private getChangedOverrides;
|
|
412
|
-
private hashFile;
|
|
413
|
-
private listFilesRecursive;
|
|
414
|
-
private copyDirectory;
|
|
415
|
-
private copyPublicFolder;
|
|
416
|
-
private copyPublicDirectory;
|
|
417
|
-
private copyDocumentSiblingAssets;
|
|
418
|
-
private listContentAssets;
|
|
419
|
-
private loadBuildManifest;
|
|
420
|
-
private saveBuildManifest;
|
|
421
|
-
private hashOptions;
|
|
422
|
-
private hashTemplateDirectory;
|
|
423
|
-
private loadCachedDocuments;
|
|
424
|
-
private saveCachedDocuments;
|
|
425
|
-
private loadCachedChangelog;
|
|
426
|
-
private saveCachedChangelog;
|
|
427
|
-
private hashSourceFiles;
|
|
428
|
-
private recordsEqual;
|
|
429
|
-
private hasAssetsChanged;
|
|
430
|
-
/**
|
|
431
|
-
* Hashes the source file, records it in currentAssets, and returns
|
|
432
|
-
* whether the copy can be skipped (unchanged from previous build).
|
|
433
|
-
*/
|
|
434
|
-
private hashAssetAndCheckSkip;
|
|
435
|
-
private copyDirectoryWithHashing;
|
|
436
|
-
private copyContentAssets;
|
|
437
452
|
}
|
|
438
453
|
|
|
439
454
|
declare class Docula {
|
|
@@ -442,6 +457,7 @@ declare class Docula {
|
|
|
442
457
|
private _configFileModule;
|
|
443
458
|
private _server;
|
|
444
459
|
private _watcher;
|
|
460
|
+
get console(): DoculaConsole;
|
|
445
461
|
/**
|
|
446
462
|
* Initialize the Docula class
|
|
447
463
|
* @param {DoculaOptions} options
|
|
@@ -552,4 +568,4 @@ declare class Docula {
|
|
|
552
568
|
serve(options: DoculaOptions): Promise<http.Server>;
|
|
553
569
|
}
|
|
554
570
|
|
|
555
|
-
export { type DoculaCacheOptions, type DoculaChangelogEntry, DoculaConsole, type DoculaCookieAuth, type DoculaHeaderLink, DoculaOptions, Docula as default };
|
|
571
|
+
export { type DoculaAIOptions, type DoculaCacheOptions, type DoculaChangelogEntry, DoculaConsole, type DoculaCookieAuth, type DoculaHeaderLink, DoculaOptions, Docula as default };
|