docula 0.9.0 → 0.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 +35 -4
- package/dist/docula.js +822 -129
- package/package.json +22 -14
- package/dist/builder.d.ts +0 -70
- package/dist/builder.js +0 -405
- package/dist/builder.js.map +0 -1
- package/dist/console.d.ts +0 -22
- package/dist/console.js +0 -120
- package/dist/console.js.map +0 -1
- package/dist/docula.js.map +0 -1
- package/dist/github.d.ts +0 -22
- package/dist/github.js +0 -74
- package/dist/github.js.map +0 -1
- package/dist/helpers.d.ts +0 -7
- package/dist/helpers.js +0 -58
- package/dist/helpers.js.map +0 -1
- package/dist/options.d.ts +0 -15
- package/dist/options.js +0 -55
- package/dist/options.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docula",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "Beautiful Website for Your Projects",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
6
|
+
"main": "./dist/docula.cjs",
|
|
7
|
+
"module": "./dist/docula.js",
|
|
8
|
+
"types": "./dist/docula.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"require": "./dist/docula.cjs",
|
|
12
|
+
"import": "./dist/docula.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
8
15
|
"repository": "https://github.com/jaredwray/docula.git",
|
|
9
16
|
"author": "Jared Wray <me@jaredwray.com>",
|
|
10
17
|
"engines": {
|
|
@@ -29,7 +36,7 @@
|
|
|
29
36
|
],
|
|
30
37
|
"scripts": {
|
|
31
38
|
"clean": "rimraf ./dist ./coverage ./node_modules ./package-lock.json ./yarn.lock ./pnpm-lock.yaml ./site/README.md ./site/dist",
|
|
32
|
-
"build": "rimraf ./dist &&
|
|
39
|
+
"build": "rimraf ./dist && tsup src/docula.ts --format esm --dts --clean",
|
|
33
40
|
"build-site": "rimraf ./site/README.md && node bin/docula.mjs build -s ./site -o ./site/dist",
|
|
34
41
|
"serve-mega": "rimraf ./test/fixtures/mega-page-site/dist && node bin/docula.mjs serve -s ./test/fixtures/mega-page-site",
|
|
35
42
|
"test": "xo --fix && vitest run --coverage",
|
|
@@ -40,28 +47,29 @@
|
|
|
40
47
|
"docula": "./bin/docula.mjs"
|
|
41
48
|
},
|
|
42
49
|
"dependencies": {
|
|
43
|
-
"axios": "^1.7.
|
|
50
|
+
"axios": "^1.7.7",
|
|
44
51
|
"cheerio": "^1.0.0",
|
|
45
|
-
"ecto": "^
|
|
46
|
-
"express": "^4.
|
|
52
|
+
"ecto": "^4.0.0",
|
|
53
|
+
"express": "^4.21.0",
|
|
47
54
|
"feed": "^4.2.2",
|
|
48
55
|
"gray-matter": "^4.0.3",
|
|
49
56
|
"he": "^1.2.0",
|
|
50
57
|
"js-yaml": "^4.1.0",
|
|
51
|
-
"keyv": "^
|
|
52
|
-
"update-notifier": "^7.
|
|
58
|
+
"keyv": "^5.0.1",
|
|
59
|
+
"update-notifier": "^7.3.1"
|
|
53
60
|
},
|
|
54
61
|
"devDependencies": {
|
|
55
62
|
"@types/express": "^4.17.21",
|
|
56
63
|
"@types/he": "^1.2.3",
|
|
57
64
|
"@types/js-yaml": "^4.0.9",
|
|
58
|
-
"@types/node": "^22.
|
|
65
|
+
"@types/node": "^22.5.5",
|
|
59
66
|
"@types/update-notifier": "^6.0.8",
|
|
60
|
-
"@vitest/coverage-v8": "^2.
|
|
67
|
+
"@vitest/coverage-v8": "^2.1.1",
|
|
61
68
|
"rimraf": "^6.0.1",
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
69
|
+
"tsup": "^8.3.0",
|
|
70
|
+
"typescript": "^5.6.2",
|
|
71
|
+
"vitest": "^2.1.1",
|
|
72
|
+
"webpack": "^5.94.0",
|
|
65
73
|
"xo": "^0.59.3"
|
|
66
74
|
},
|
|
67
75
|
"xo": {
|
package/dist/builder.d.ts
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { DoculaOptions } from './options.js';
|
|
2
|
-
import { type GithubData } from './github.js';
|
|
3
|
-
export type DoculaData = {
|
|
4
|
-
siteUrl: string;
|
|
5
|
-
siteTitle: string;
|
|
6
|
-
siteDescription: string;
|
|
7
|
-
sitePath: string;
|
|
8
|
-
templatePath: string;
|
|
9
|
-
outputPath: string;
|
|
10
|
-
githubPath?: string;
|
|
11
|
-
github?: GithubData;
|
|
12
|
-
templates?: DoculaTemplates;
|
|
13
|
-
hasDocuments?: boolean;
|
|
14
|
-
sections?: DoculaSection[];
|
|
15
|
-
documents?: DoculaDocument[];
|
|
16
|
-
sidebarItems?: DoculaSection[];
|
|
17
|
-
};
|
|
18
|
-
export type DoculaTemplates = {
|
|
19
|
-
index: string;
|
|
20
|
-
releases: string;
|
|
21
|
-
docPage?: string;
|
|
22
|
-
};
|
|
23
|
-
export type DoculaSection = {
|
|
24
|
-
name: string;
|
|
25
|
-
order?: number;
|
|
26
|
-
path: string;
|
|
27
|
-
children?: DoculaSection[];
|
|
28
|
-
};
|
|
29
|
-
export type DoculaDocument = {
|
|
30
|
-
title: string;
|
|
31
|
-
navTitle: string;
|
|
32
|
-
description: string;
|
|
33
|
-
order?: number;
|
|
34
|
-
section?: string;
|
|
35
|
-
keywords: string[];
|
|
36
|
-
content: string;
|
|
37
|
-
markdown: string;
|
|
38
|
-
generatedHtml: string;
|
|
39
|
-
tableOfContents?: string;
|
|
40
|
-
documentPath: string;
|
|
41
|
-
urlPath: string;
|
|
42
|
-
isRoot: boolean;
|
|
43
|
-
};
|
|
44
|
-
export declare class DoculaBuilder {
|
|
45
|
-
private readonly _options;
|
|
46
|
-
private readonly _ecto;
|
|
47
|
-
private readonly _console;
|
|
48
|
-
constructor(options?: DoculaOptions, engineOptions?: any);
|
|
49
|
-
get options(): DoculaOptions;
|
|
50
|
-
build(): Promise<void>;
|
|
51
|
-
validateOptions(options: DoculaOptions): void;
|
|
52
|
-
getGithubData(githubPath: string): Promise<GithubData>;
|
|
53
|
-
getTemplates(options: DoculaOptions, hasDocuments: boolean): Promise<DoculaTemplates>;
|
|
54
|
-
getTemplateFile(path: string, name: string): Promise<string | undefined>;
|
|
55
|
-
buildRobotsPage(options: DoculaOptions): Promise<void>;
|
|
56
|
-
buildSiteMapPage(data: DoculaData): Promise<void>;
|
|
57
|
-
buildIndexPage(data: DoculaData): Promise<void>;
|
|
58
|
-
buildReleasePage(data: DoculaData): Promise<void>;
|
|
59
|
-
buildReadmeSection(data: DoculaData): Promise<string>;
|
|
60
|
-
buildDocsPages(data: DoculaData): Promise<void>;
|
|
61
|
-
generateSidebarItems(data: DoculaData): DoculaSection[];
|
|
62
|
-
getDocuments(sitePath: string, doculaData: DoculaData): DoculaDocument[];
|
|
63
|
-
getDocumentInDirectory(sitePath: string): DoculaDocument[];
|
|
64
|
-
getSections(sitePath: string, doculaOptions: DoculaOptions): DoculaSection[];
|
|
65
|
-
mergeSectionWithOptions(section: DoculaSection, options: DoculaOptions): DoculaSection;
|
|
66
|
-
parseDocumentData(documentPath: string): DoculaDocument;
|
|
67
|
-
private removeFrontmatter;
|
|
68
|
-
private getTableOfContents;
|
|
69
|
-
private copyDirectory;
|
|
70
|
-
}
|
package/dist/builder.js
DELETED
|
@@ -1,405 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import { Ecto } from 'ecto';
|
|
3
|
-
import * as matter from 'gray-matter';
|
|
4
|
-
import he from 'he';
|
|
5
|
-
import * as cheerio from 'cheerio';
|
|
6
|
-
import { DoculaOptions } from './options.js';
|
|
7
|
-
import { DoculaConsole } from './console.js';
|
|
8
|
-
import { Github } from './github.js';
|
|
9
|
-
export class DoculaBuilder {
|
|
10
|
-
_options = new DoculaOptions();
|
|
11
|
-
_ecto;
|
|
12
|
-
_console = new DoculaConsole();
|
|
13
|
-
constructor(options, engineOptions) {
|
|
14
|
-
if (options) {
|
|
15
|
-
this._options = options;
|
|
16
|
-
}
|
|
17
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
18
|
-
this._ecto = new Ecto(engineOptions);
|
|
19
|
-
}
|
|
20
|
-
get options() {
|
|
21
|
-
return this._options;
|
|
22
|
-
}
|
|
23
|
-
async build() {
|
|
24
|
-
const startTime = Date.now();
|
|
25
|
-
// Validate the options
|
|
26
|
-
this.validateOptions(this.options);
|
|
27
|
-
// Set the site options
|
|
28
|
-
const doculaData = {
|
|
29
|
-
siteUrl: this.options.siteUrl,
|
|
30
|
-
siteTitle: this.options.siteTitle,
|
|
31
|
-
siteDescription: this.options.siteDescription,
|
|
32
|
-
sitePath: this.options.sitePath,
|
|
33
|
-
templatePath: this.options.templatePath,
|
|
34
|
-
outputPath: this.options.outputPath,
|
|
35
|
-
githubPath: this.options.githubPath,
|
|
36
|
-
sections: this.options.sections,
|
|
37
|
-
};
|
|
38
|
-
// Get data from github
|
|
39
|
-
doculaData.github = await this.getGithubData(this.options.githubPath);
|
|
40
|
-
// Get the documents
|
|
41
|
-
doculaData.documents = this.getDocuments(`${doculaData.sitePath}/docs`, doculaData);
|
|
42
|
-
// Get the sections
|
|
43
|
-
doculaData.sections = this.getSections(`${doculaData.sitePath}/docs`, this.options);
|
|
44
|
-
doculaData.hasDocuments = doculaData.documents?.length > 0;
|
|
45
|
-
// Get the templates to use
|
|
46
|
-
doculaData.templates = await this.getTemplates(this.options, doculaData.hasDocuments);
|
|
47
|
-
// Build the home page (index.html)
|
|
48
|
-
await this.buildIndexPage(doculaData);
|
|
49
|
-
// Build the releases page (/releases/index.html)
|
|
50
|
-
await this.buildReleasePage(doculaData);
|
|
51
|
-
// Build the sitemap (/sitemap.xml)
|
|
52
|
-
await this.buildSiteMapPage(doculaData);
|
|
53
|
-
// Build the robots.txt (/robots.txt)
|
|
54
|
-
await this.buildRobotsPage(this.options);
|
|
55
|
-
if (doculaData.hasDocuments) {
|
|
56
|
-
await this.buildDocsPages(doculaData);
|
|
57
|
-
}
|
|
58
|
-
const siteRelativePath = this.options.sitePath;
|
|
59
|
-
// Copy over favicon
|
|
60
|
-
if (fs.existsSync(`${siteRelativePath}/favicon.ico`)) {
|
|
61
|
-
await fs.promises.copyFile(`${siteRelativePath}/favicon.ico`, `${this.options.outputPath}/favicon.ico`);
|
|
62
|
-
}
|
|
63
|
-
// Copy over logo
|
|
64
|
-
if (fs.existsSync(`${siteRelativePath}/logo.svg`)) {
|
|
65
|
-
await fs.promises.copyFile(`${siteRelativePath}/logo.svg`, `${this.options.outputPath}/logo.svg`);
|
|
66
|
-
}
|
|
67
|
-
// Copy over logo_horizontal
|
|
68
|
-
if (fs.existsSync(`${siteRelativePath}/logo_horizontal.png`)) {
|
|
69
|
-
await fs.promises.copyFile(`${siteRelativePath}/logo_horizontal.png`, `${this.options.outputPath}/logo_horizontal.png`);
|
|
70
|
-
}
|
|
71
|
-
// Copy over css
|
|
72
|
-
if (fs.existsSync(`${this.options.templatePath}/css`)) {
|
|
73
|
-
this.copyDirectory(`${this.options.templatePath}/css`, `${this.options.outputPath}/css`);
|
|
74
|
-
}
|
|
75
|
-
// Copy over variables
|
|
76
|
-
if (fs.existsSync(`${siteRelativePath}/variables.css`)) {
|
|
77
|
-
await fs.promises.copyFile(`${siteRelativePath}/variables.css`, `${this.options.outputPath}/css/variables.css`);
|
|
78
|
-
}
|
|
79
|
-
const endTime = Date.now();
|
|
80
|
-
const executionTime = endTime - startTime;
|
|
81
|
-
this._console.log(`Build completed in ${executionTime}ms`);
|
|
82
|
-
}
|
|
83
|
-
validateOptions(options) {
|
|
84
|
-
if (options.githubPath.length < 3) {
|
|
85
|
-
throw new Error('No github options provided');
|
|
86
|
-
}
|
|
87
|
-
if (options.siteDescription.length < 3) {
|
|
88
|
-
throw new Error('No site description options provided');
|
|
89
|
-
}
|
|
90
|
-
if (!options.siteTitle) {
|
|
91
|
-
throw new Error('No site title options provided');
|
|
92
|
-
}
|
|
93
|
-
if (!options.siteUrl) {
|
|
94
|
-
throw new Error('No site url options provided');
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
async getGithubData(githubPath) {
|
|
98
|
-
const paths = githubPath.split('/');
|
|
99
|
-
const options = {
|
|
100
|
-
author: paths[0],
|
|
101
|
-
repo: paths[1],
|
|
102
|
-
};
|
|
103
|
-
const github = new Github(options);
|
|
104
|
-
return github.getData();
|
|
105
|
-
}
|
|
106
|
-
async getTemplates(options, hasDocuments) {
|
|
107
|
-
const templates = {
|
|
108
|
-
index: '',
|
|
109
|
-
releases: '',
|
|
110
|
-
};
|
|
111
|
-
if (fs.existsSync(options.templatePath)) {
|
|
112
|
-
const index = await this.getTemplateFile(options.templatePath, 'index');
|
|
113
|
-
if (index) {
|
|
114
|
-
templates.index = index;
|
|
115
|
-
}
|
|
116
|
-
const releases = await this.getTemplateFile(options.templatePath, 'releases');
|
|
117
|
-
if (releases) {
|
|
118
|
-
templates.releases = releases;
|
|
119
|
-
}
|
|
120
|
-
const documentPage = hasDocuments ? await this.getTemplateFile(options.templatePath, 'docs') : undefined;
|
|
121
|
-
if (documentPage) {
|
|
122
|
-
templates.docPage = documentPage;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
throw new Error(`No template path found at ${options.templatePath}`);
|
|
127
|
-
}
|
|
128
|
-
return templates;
|
|
129
|
-
}
|
|
130
|
-
async getTemplateFile(path, name) {
|
|
131
|
-
let result;
|
|
132
|
-
const files = await fs.promises.readdir(path);
|
|
133
|
-
for (const file of files) {
|
|
134
|
-
const fileName = file.split('.');
|
|
135
|
-
if (fileName[0].toString().toLowerCase() === name.toLowerCase()) {
|
|
136
|
-
result = file.toString();
|
|
137
|
-
break;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
return result;
|
|
141
|
-
}
|
|
142
|
-
async buildRobotsPage(options) {
|
|
143
|
-
const { sitePath } = options;
|
|
144
|
-
const { outputPath } = options;
|
|
145
|
-
const robotsPath = `${outputPath}/robots.txt`;
|
|
146
|
-
await fs.promises.mkdir(outputPath, { recursive: true });
|
|
147
|
-
await ((fs.existsSync(`${sitePath}/robots.txt`))
|
|
148
|
-
? fs.promises.copyFile(`${sitePath}/robots.txt`, robotsPath)
|
|
149
|
-
: fs.promises.writeFile(robotsPath, 'User-agent: *\nDisallow:'));
|
|
150
|
-
}
|
|
151
|
-
async buildSiteMapPage(data) {
|
|
152
|
-
const sitemapPath = `${data.outputPath}/sitemap.xml`;
|
|
153
|
-
const urls = [{ url: data.siteUrl }, { url: `${data.siteUrl}/releases` }];
|
|
154
|
-
// Add all the document urls
|
|
155
|
-
for (const document of data.documents ?? []) {
|
|
156
|
-
let { urlPath } = document;
|
|
157
|
-
if (urlPath.endsWith('index.html')) {
|
|
158
|
-
urlPath = urlPath.slice(0, -10);
|
|
159
|
-
}
|
|
160
|
-
urls.push({ url: `${data.siteUrl}${urlPath}` });
|
|
161
|
-
}
|
|
162
|
-
let xml = '<?xml version="1.0" encoding="UTF-8"?>';
|
|
163
|
-
xml += '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
|
|
164
|
-
for (const { url } of urls) {
|
|
165
|
-
xml += '<url>';
|
|
166
|
-
xml += `<loc>${url}</loc>`;
|
|
167
|
-
xml += '</url>';
|
|
168
|
-
}
|
|
169
|
-
xml += '</urlset>';
|
|
170
|
-
await fs.promises.mkdir(data.outputPath, { recursive: true });
|
|
171
|
-
await fs.promises.writeFile(sitemapPath, xml, 'utf8');
|
|
172
|
-
}
|
|
173
|
-
async buildIndexPage(data) {
|
|
174
|
-
if (data.templates) {
|
|
175
|
-
const indexPath = `${data.outputPath}/index.html`;
|
|
176
|
-
await fs.promises.mkdir(data.outputPath, { recursive: true });
|
|
177
|
-
const indexTemplate = `${data.templatePath}/${data.templates.index}`;
|
|
178
|
-
let content;
|
|
179
|
-
if (!data.hasDocuments) {
|
|
180
|
-
content = await this.buildReadmeSection(data);
|
|
181
|
-
}
|
|
182
|
-
const indexContent = await this._ecto.renderFromFile(indexTemplate, { ...data, content }, data.templatePath);
|
|
183
|
-
await fs.promises.writeFile(indexPath, indexContent, 'utf8');
|
|
184
|
-
}
|
|
185
|
-
else {
|
|
186
|
-
throw new Error('No templates found');
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
async buildReleasePage(data) {
|
|
190
|
-
if (data.github && data.templates) {
|
|
191
|
-
const releasesPath = `${data.outputPath}/releases/index.html`;
|
|
192
|
-
const releaseOutputPath = `${data.outputPath}/releases`;
|
|
193
|
-
await fs.promises.mkdir(releaseOutputPath, { recursive: true });
|
|
194
|
-
const releasesTemplate = `${data.templatePath}/${data.templates.releases}`;
|
|
195
|
-
const releasesContent = await this._ecto.renderFromFile(releasesTemplate, data, data.templatePath);
|
|
196
|
-
await fs.promises.writeFile(releasesPath, releasesContent, 'utf8');
|
|
197
|
-
}
|
|
198
|
-
else {
|
|
199
|
-
throw new Error('No github data found');
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
async buildReadmeSection(data) {
|
|
203
|
-
let htmlReadme = '';
|
|
204
|
-
if (fs.existsSync(`${data.sitePath}/README.md`)) {
|
|
205
|
-
const readmeContent = fs.readFileSync(`${data.sitePath}/README.md`, 'utf8');
|
|
206
|
-
htmlReadme = await this._ecto.render(readmeContent, undefined, 'markdown');
|
|
207
|
-
}
|
|
208
|
-
return htmlReadme;
|
|
209
|
-
}
|
|
210
|
-
async buildDocsPages(data) {
|
|
211
|
-
if (data.templates && data.documents?.length) {
|
|
212
|
-
const documentsTemplate = `${data.templatePath}/${data.templates.docPage}`;
|
|
213
|
-
await fs.promises.mkdir(`${data.outputPath}/docs`, { recursive: true });
|
|
214
|
-
data.sidebarItems = this.generateSidebarItems(data);
|
|
215
|
-
const promises = data.documents.map(async (document) => {
|
|
216
|
-
const folder = document.urlPath.split('/').slice(0, -1).join('/');
|
|
217
|
-
await fs.promises.mkdir(`${data.outputPath}/${folder}`, { recursive: true });
|
|
218
|
-
const slug = `${data.outputPath}${document.urlPath}`;
|
|
219
|
-
let documentContent = await this._ecto.renderFromFile(documentsTemplate, { ...data, ...document }, data.templatePath);
|
|
220
|
-
documentContent = he.decode(documentContent);
|
|
221
|
-
return fs.promises.writeFile(slug, documentContent, 'utf8');
|
|
222
|
-
});
|
|
223
|
-
await Promise.all(promises);
|
|
224
|
-
}
|
|
225
|
-
else {
|
|
226
|
-
throw new Error('No templates found');
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
generateSidebarItems(data) {
|
|
230
|
-
let sidebarItems = [...(data.sections ?? [])];
|
|
231
|
-
for (const document of (data.documents ?? [])) {
|
|
232
|
-
if (document.isRoot) {
|
|
233
|
-
sidebarItems.unshift({
|
|
234
|
-
path: document.urlPath.replace('index.html', ''),
|
|
235
|
-
name: document.navTitle,
|
|
236
|
-
order: document.order,
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
else {
|
|
240
|
-
const relativeFilePath = document.documentPath.replace(`${data.sitePath}/docs/`, '');
|
|
241
|
-
const sectionPath = relativeFilePath.slice(0, Math.max(0, relativeFilePath.lastIndexOf('/')));
|
|
242
|
-
const documentSection = document.section ?? sectionPath;
|
|
243
|
-
const sectionIndex = sidebarItems.findIndex(section => section.path === documentSection);
|
|
244
|
-
if (sectionIndex === -1) {
|
|
245
|
-
continue;
|
|
246
|
-
}
|
|
247
|
-
sidebarItems[sectionIndex].children ??= [];
|
|
248
|
-
sidebarItems[sectionIndex].children.push({
|
|
249
|
-
path: document.urlPath.replace('index.html', ''),
|
|
250
|
-
name: document.navTitle,
|
|
251
|
-
order: document.order,
|
|
252
|
-
});
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
// Sort the sidebarItems children
|
|
256
|
-
sidebarItems = sidebarItems.map(section => {
|
|
257
|
-
if (section.children) {
|
|
258
|
-
section.children.sort((a, b) => (a.order ?? section.children.length) - (b.order ?? section.children.length));
|
|
259
|
-
}
|
|
260
|
-
return section;
|
|
261
|
-
});
|
|
262
|
-
// Sort the sidebarItems
|
|
263
|
-
sidebarItems.sort((a, b) => (a.order ?? sidebarItems.length) - (b.order ?? sidebarItems.length));
|
|
264
|
-
return sidebarItems;
|
|
265
|
-
}
|
|
266
|
-
getDocuments(sitePath, doculaData) {
|
|
267
|
-
let documents = new Array();
|
|
268
|
-
if (fs.existsSync(sitePath)) {
|
|
269
|
-
// Get top level documents
|
|
270
|
-
documents = this.getDocumentInDirectory(sitePath);
|
|
271
|
-
// Get all sections and parse them
|
|
272
|
-
doculaData.sections = this.getSections(sitePath, this.options);
|
|
273
|
-
// Get all documents in each section
|
|
274
|
-
for (const section of doculaData.sections) {
|
|
275
|
-
const sectionPath = `${sitePath}/${section.path}`;
|
|
276
|
-
const sectionDocuments = this.getDocumentInDirectory(sectionPath);
|
|
277
|
-
documents = [...documents, ...sectionDocuments];
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
return documents;
|
|
281
|
-
}
|
|
282
|
-
getDocumentInDirectory(sitePath) {
|
|
283
|
-
const documents = new Array();
|
|
284
|
-
const documentList = fs.readdirSync(sitePath);
|
|
285
|
-
if (documentList.length > 0) {
|
|
286
|
-
for (const document of documentList) {
|
|
287
|
-
const documentPath = `${sitePath}/${document}`;
|
|
288
|
-
const stats = fs.statSync(documentPath);
|
|
289
|
-
if (stats.isFile()) {
|
|
290
|
-
const documentData = this.parseDocumentData(documentPath);
|
|
291
|
-
documents.push(documentData);
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
// Sort the documents by order
|
|
296
|
-
documents.sort((a, b) => (a.order ?? documents.length) - (b.order ?? documents.length));
|
|
297
|
-
return documents;
|
|
298
|
-
}
|
|
299
|
-
getSections(sitePath, doculaOptions) {
|
|
300
|
-
const sections = new Array();
|
|
301
|
-
if (fs.existsSync(sitePath)) {
|
|
302
|
-
const documentList = fs.readdirSync(sitePath);
|
|
303
|
-
if (documentList.length > 0) {
|
|
304
|
-
for (const document of documentList) {
|
|
305
|
-
const documentPath = `${sitePath}/${document}`;
|
|
306
|
-
const stats = fs.statSync(documentPath);
|
|
307
|
-
if (stats.isDirectory()) {
|
|
308
|
-
const section = {
|
|
309
|
-
name: document.replaceAll('-', ' ').replaceAll(/\b\w/g, l => l.toUpperCase()),
|
|
310
|
-
path: document,
|
|
311
|
-
};
|
|
312
|
-
this.mergeSectionWithOptions(section, doculaOptions);
|
|
313
|
-
sections.push(section);
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
// Sort the sections by order
|
|
318
|
-
sections.sort((a, b) => (a.order ?? sections.length) - (b.order ?? sections.length));
|
|
319
|
-
}
|
|
320
|
-
return sections;
|
|
321
|
-
}
|
|
322
|
-
mergeSectionWithOptions(section, options) {
|
|
323
|
-
if (options.sections) {
|
|
324
|
-
const sectionOptions = options.sections.find(sectionOption => sectionOption.path === section.path);
|
|
325
|
-
if (sectionOptions) {
|
|
326
|
-
section.name = sectionOptions.name;
|
|
327
|
-
section.order = sectionOptions.order;
|
|
328
|
-
section.path = sectionOptions.path;
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
return section;
|
|
332
|
-
}
|
|
333
|
-
parseDocumentData(documentPath) {
|
|
334
|
-
const documentContent = fs.readFileSync(documentPath, 'utf8');
|
|
335
|
-
const matterData = matter.default(documentContent);
|
|
336
|
-
let markdownContent = this.removeFrontmatter(documentContent);
|
|
337
|
-
markdownContent = markdownContent.replace(/^# .*\n/, '');
|
|
338
|
-
const documentsFolderIndex = documentPath.lastIndexOf('/docs/');
|
|
339
|
-
let urlPath = documentPath.slice(documentsFolderIndex).replace('.md', '/index.html');
|
|
340
|
-
let isRoot = urlPath.split('/').length === 3;
|
|
341
|
-
if (!documentPath.slice(documentsFolderIndex + 6).includes('/')) {
|
|
342
|
-
isRoot = true;
|
|
343
|
-
const filePath = documentPath.slice(documentsFolderIndex + 6);
|
|
344
|
-
if (filePath === 'index.md') {
|
|
345
|
-
urlPath = documentPath.slice(documentsFolderIndex).replace('.md', '.html');
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
return {
|
|
349
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
350
|
-
title: matterData.data.title,
|
|
351
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
352
|
-
navTitle: matterData.data.navTitle || matterData.data.title,
|
|
353
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
354
|
-
description: matterData.data.description || '',
|
|
355
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
356
|
-
order: matterData.data.order || undefined,
|
|
357
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
358
|
-
section: matterData.data.section || undefined,
|
|
359
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
360
|
-
keywords: matterData.data.keywords || [],
|
|
361
|
-
content: documentContent,
|
|
362
|
-
markdown: markdownContent,
|
|
363
|
-
generatedHtml: this._ecto.renderSync(markdownContent, undefined, 'markdown'),
|
|
364
|
-
tableOfContents: this.getTableOfContents(markdownContent),
|
|
365
|
-
documentPath,
|
|
366
|
-
urlPath,
|
|
367
|
-
isRoot,
|
|
368
|
-
};
|
|
369
|
-
}
|
|
370
|
-
removeFrontmatter(markdown) {
|
|
371
|
-
return markdown.replace(/^-{3}[\s\S]*?-{3}\s*/, '');
|
|
372
|
-
}
|
|
373
|
-
getTableOfContents(markdown) {
|
|
374
|
-
markdown = `## Table of Contents\n\n${markdown}`;
|
|
375
|
-
const html = this._ecto.renderSync(markdown, undefined, 'markdown');
|
|
376
|
-
const $ = cheerio.load(html);
|
|
377
|
-
const tocTitle = $('h2').first();
|
|
378
|
-
const tocContent = tocTitle.next('ul').toString();
|
|
379
|
-
if (tocContent) {
|
|
380
|
-
return tocTitle.toString() + tocContent;
|
|
381
|
-
}
|
|
382
|
-
return undefined;
|
|
383
|
-
}
|
|
384
|
-
copyDirectory(source, target) {
|
|
385
|
-
const files = fs.readdirSync(source);
|
|
386
|
-
for (const file of files) {
|
|
387
|
-
/* c8 ignore next 3 */
|
|
388
|
-
if (file.startsWith('.')) {
|
|
389
|
-
continue;
|
|
390
|
-
}
|
|
391
|
-
const sourcePath = `${source}/${file}`;
|
|
392
|
-
const targetPath = `${target}/${file}`;
|
|
393
|
-
const stat = fs.lstatSync(sourcePath);
|
|
394
|
-
if (stat.isDirectory()) {
|
|
395
|
-
fs.mkdirSync(targetPath, { recursive: true });
|
|
396
|
-
this.copyDirectory(sourcePath, targetPath);
|
|
397
|
-
}
|
|
398
|
-
else {
|
|
399
|
-
fs.mkdirSync(target, { recursive: true });
|
|
400
|
-
fs.copyFileSync(sourcePath, targetPath);
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
//# sourceMappingURL=builder.js.map
|
package/dist/builder.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"builder.js","sourceRoot":"","sources":["../src/builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAC,IAAI,EAAC,MAAM,MAAM,CAAC;AAC1B,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAC,aAAa,EAAC,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAC,aAAa,EAAC,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAC,MAAM,EAAsC,MAAM,aAAa,CAAC;AA+CxE,MAAM,OAAO,aAAa;IACR,QAAQ,GAAkB,IAAI,aAAa,EAAE,CAAC;IAC9C,KAAK,CAAO;IACZ,QAAQ,GAAkB,IAAI,aAAa,EAAE,CAAC;IAE/D,YAAY,OAAuB,EAAE,aAAmB;QACvD,IAAI,OAAO,EAAE,CAAC;YACb,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACz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,IAAI,IAAI,EAAE,CAAC;YACvC,MAAM,UAAU,GAAG,GAAG,MAAM,IAAI,IAAI,EAAE,CAAC;YAEvC,MAAM,IAAI,GAAG,EAAE,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;YAEtC,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;gBACxB,EAAE,CAAC,SAAS,CAAC,UAAU,EAAE,EAAC,SAAS,EAAE,IAAI,EAAC,CAAC,CAAC;gBAC5C,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;YAC5C,CAAC;iBAAM,CAAC;gBACP,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,EAAC,SAAS,EAAE,IAAI,EAAC,CAAC,CAAC;gBACxC,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;YACzC,CAAC;QACF,CAAC;IACF,CAAC;CACD"}
|
package/dist/console.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export declare class DoculaConsole {
|
|
2
|
-
log(message: string): void;
|
|
3
|
-
error(message: string): void;
|
|
4
|
-
warn(message: string): void;
|
|
5
|
-
printHelp(): void;
|
|
6
|
-
parseProcessArgv(argv: string[]): DoculaConsoleProcess;
|
|
7
|
-
getCommand(argv: string[]): string | undefined;
|
|
8
|
-
getArguments(argv: string[]): DoculaConsoleArguments;
|
|
9
|
-
}
|
|
10
|
-
type DoculaConsoleProcess = {
|
|
11
|
-
argv: string[];
|
|
12
|
-
command: string | undefined;
|
|
13
|
-
args: DoculaConsoleArguments;
|
|
14
|
-
};
|
|
15
|
-
type DoculaConsoleArguments = {
|
|
16
|
-
sitePath: string | undefined;
|
|
17
|
-
templatePath: string | undefined;
|
|
18
|
-
output: string | undefined;
|
|
19
|
-
watch: boolean;
|
|
20
|
-
port: number;
|
|
21
|
-
};
|
|
22
|
-
export {};
|