docula 0.0.9 → 0.2.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/README.md +6 -4
- package/dist/config.d.ts +2 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +4 -1
- package/dist/config.js.map +1 -1
- package/dist/docula.d.ts +5 -1
- package/dist/docula.d.ts.map +1 -1
- package/dist/docula.js +97 -20
- package/dist/docula.js.map +1 -1
- package/dist/eleventy/global-data.d.ts +3 -0
- package/dist/eleventy/global-data.d.ts.map +1 -0
- package/dist/eleventy/global-data.js +2 -0
- package/dist/eleventy/global-data.js.map +1 -0
- package/dist/eleventy/shortcodes.d.ts +1 -1
- package/dist/eleventy/shortcodes.d.ts.map +1 -1
- package/dist/eleventy/shortcodes.js +1 -1
- package/dist/eleventy/shortcodes.js.map +1 -1
- package/dist/eleventy.d.ts +1 -0
- package/dist/eleventy.d.ts.map +1 -1
- package/dist/eleventy.js +12 -1
- package/dist/eleventy.js.map +1 -1
- package/dist/plugins/algolia.d.ts +21 -0
- package/dist/plugins/algolia.d.ts.map +1 -0
- package/dist/plugins/algolia.js +53 -0
- package/dist/plugins/algolia.js.map +1 -0
- package/dist/plugins/index.d.ts +4 -2
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/index.js +2 -0
- package/dist/plugins/index.js.map +1 -1
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +2 -1
- package/dist/schemas.js.map +1 -1
- package/dist/tools/__mocks__/inquirer-prompt.d.ts +4 -2
- package/dist/tools/__mocks__/inquirer-prompt.d.ts.map +1 -1
- package/dist/tools/__mocks__/inquirer-prompt.js +3 -1
- package/dist/tools/__mocks__/inquirer-prompt.js.map +1 -1
- package/dist/tools/inquirer-prompt.d.ts +7 -3
- package/dist/tools/inquirer-prompt.d.ts.map +1 -1
- package/dist/tools/inquirer-prompt.js +103 -26
- package/dist/tools/inquirer-prompt.js.map +1 -1
- package/init/_data/site.json +2 -1
- package/init/_includes/assets/css/styles/home.css +58 -9
- package/init/_includes/assets/css/styles/index.css +0 -59
- package/init/_includes/assets/css/styles/search/algolia.css +125 -0
- package/init/_includes/assets/css/styles/search/pagefind.css +60 -0
- package/init/_includes/assets/images/docula-logo-horizontal.webp +0 -0
- package/init/_includes/doc.njk +12 -7
- package/init/_includes/landing/landingHero.njk +8 -0
- package/init/_includes/landing/singlePage.njk +24 -0
- package/init/_includes/{shared → multipage}/main.njk +2 -2
- package/init/_includes/{shared → multipage}/scripts.njk +5 -10
- package/init/_includes/multipage/searchEngine.njk +5 -0
- package/init/_includes/multipage/searchModal.njk +19 -0
- package/init/_includes/search/algolia.njk +98 -0
- package/init/_includes/shared/footer.njk +4 -0
- package/init/_includes/shared/head.njk +15 -13
- package/init/_includes/shared/highlightScript.njk +6 -0
- package/init/_includes/shared/homeData.njk +49 -0
- package/init/index.njk +15 -59
- package/init/releases.njk +38 -0
- package/init/search-index.md +14 -0
- package/init/versions.njk +12 -5
- package/package.json +10 -9
- package/init/_includes/assets/images/docula.png +0 -0
- package/init/_includes/shared/searchModal.njk +0 -10
- /package/init/_includes/{shared → multipage}/header.njk +0 -0
- /package/init/_includes/{shared → multipage}/homeHeader.njk +0 -0
- /package/init/_includes/{shared → multipage}/sidebar.njk +0 -0
package/README.md
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
<img src="
|
|
1
|
+
<img src="branding-guidelines/Docula Logos/PNG/Color/docula.png" />
|
|
2
2
|
|
|
3
3
|
# Docula
|
|
4
4
|
|
|
5
5
|
[](https://github.com/jaredwray/docula/actions/workflows/tests.yaml)
|
|
6
6
|
[](https://codecov.io/github/jaredwray/docula)
|
|
7
|
+
[](https://github.com/jaredwray/docula/actions/workflows/release.yaml)
|
|
8
|
+
[](https://www.npmjs.com/package/docula)
|
|
9
|
+
[](https://www.npmjs.com/package/docula)
|
|
7
10
|
|
|
8
|
-
## :warning:
|
|
11
|
+
## :warning: Please do not use until v1.x.x is released
|
|
9
12
|
|
|
10
13
|
## Features
|
|
11
14
|
|
|
@@ -14,7 +17,7 @@
|
|
|
14
17
|
- Knowledge Base that is easy to setup and manage
|
|
15
18
|
- Beautiful and Responsive Design (Like Stripe or 11ty)
|
|
16
19
|
- Search Engine Optimized
|
|
17
|
-
- Search Engine Plugin (Algolia)
|
|
20
|
+
- Search Engine Plugin (Algolia) and local search by default.
|
|
18
21
|
- Convention over Configuration - just add your files, use a template (or build your own) and you're done.
|
|
19
22
|
- Will generate a sitemap.xml
|
|
20
23
|
- Will generate a robots.txt
|
|
@@ -25,7 +28,6 @@
|
|
|
25
28
|
|
|
26
29
|
- `site/docs` - contains the documentation files
|
|
27
30
|
- `site/template` - contains the templates files
|
|
28
|
-
- `site/blog` - contains the blog files and images
|
|
29
31
|
|
|
30
32
|
This will all be generated in the `dist` folder by default. To change that you can use the `--output=<folder_name>` flag.
|
|
31
33
|
|
package/dist/config.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import Ajv from 'ajv';
|
|
2
1
|
import type { PluginConfig, PluginConfigs, PluginName, Plugins } from './types/config.js';
|
|
3
2
|
export declare class Config {
|
|
4
3
|
originPath: string;
|
|
@@ -11,7 +10,8 @@ export declare class Config {
|
|
|
11
10
|
imagesPath: string;
|
|
12
11
|
assetsPath: string;
|
|
13
12
|
siteUrl: string;
|
|
14
|
-
|
|
13
|
+
siteType: string;
|
|
14
|
+
ajv: any;
|
|
15
15
|
private readonly schema;
|
|
16
16
|
constructor(path?: string);
|
|
17
17
|
loadConfig(path: string): void;
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAC,MAAM,mBAAmB,CAAC;AAGxF,qBAAa,MAAM;IAClB,UAAU,SAAU;IACpB,UAAU,SAAU;IACpB,QAAQ,SAAU;IAClB,YAAY,SAAc;IAC1B,YAAY,SAAc;IAE1B,YAAY,EAAE,aAAa,CAAuB;IAClD,OAAO,EAAE,OAAO,CAAM;IACtB,UAAU,SAAY;IACtB,UAAU,SAAS;IACnB,OAAO,SAAM;IACb,QAAQ,SAAM;IAEd,GAAG,MAAa;IAEhB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAe;gBAE1B,IAAI,CAAC,EAAE,MAAM;IAczB,UAAU,CAAC,IAAI,EAAE,MAAM;IAyCvB,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY;IAWlD,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CAGtC"}
|
package/dist/config.js
CHANGED
|
@@ -15,6 +15,8 @@ export class Config {
|
|
|
15
15
|
this.imagesPath = 'images';
|
|
16
16
|
this.assetsPath = 'css';
|
|
17
17
|
this.siteUrl = '';
|
|
18
|
+
this.siteType = '';
|
|
19
|
+
// @ts-expect-error - ajv is not callable
|
|
18
20
|
this.ajv = new Ajv();
|
|
19
21
|
this.schema = { ...jsonConfigSchema };
|
|
20
22
|
this.schema.required = [];
|
|
@@ -36,11 +38,12 @@ export class Config {
|
|
|
36
38
|
}
|
|
37
39
|
}
|
|
38
40
|
this.schema.required = [...new Set(this.schema.required)];
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
39
42
|
const validate = this.ajv.compile(this.schema);
|
|
40
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
41
43
|
validate(jsonConfig);
|
|
42
44
|
if (validate.errors) {
|
|
43
45
|
const [error] = validate.errors;
|
|
46
|
+
// @ts-expect-error - dataPath exist without error"
|
|
44
47
|
const { dataPath, message, keyword, params } = error;
|
|
45
48
|
if (keyword === 'additionalProperties') {
|
|
46
49
|
const { additionalProperty } = params;
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,YAAY,EAAC,MAAM,SAAS,CAAC;AACjD,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAoB,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAEjE,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAE/C,MAAM,OAAO,MAAM;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,YAAY,EAAC,MAAM,SAAS,CAAC;AACjD,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAoB,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAEjE,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAE/C,MAAM,OAAO,MAAM;IAkBlB,YAAY,IAAa;QAjBzB,eAAU,GAAG,MAAM,CAAC;QACpB,eAAU,GAAG,MAAM,CAAC;QACpB,aAAQ,GAAG,MAAM,CAAC;QAClB,iBAAY,GAAG,UAAU,CAAC;QAC1B,iBAAY,GAAG,UAAU,CAAC;QAC1B,0EAA0E;QAC1E,iBAAY,GAAkB,EAAmB,CAAC;QAClD,YAAO,GAAY,EAAE,CAAC;QACtB,eAAU,GAAG,QAAQ,CAAC;QACtB,eAAU,GAAG,KAAK,CAAC;QACnB,YAAO,GAAG,EAAE,CAAC;QACb,aAAQ,GAAG,EAAE,CAAC;QACd,yCAAyC;QACzC,QAAG,GAAG,IAAI,GAAG,EAAE,CAAC;QAKf,IAAI,CAAC,MAAM,GAAG,EAAC,GAAG,gBAAgB,EAAC,CAAC;QACpC,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,EAAE,CAAC;QAC1B,MAAM,UAAU,GAAG,IAAI,IAAI,KAAK,IAAI,CAAC,UAAU,cAAc,CAAC;QAC9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IAED,eAAe,CAAC,IAAY;QAC3B,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;CACD"}
|
package/dist/docula.d.ts
CHANGED
|
@@ -6,12 +6,16 @@ export declare class Docula {
|
|
|
6
6
|
private pluginInstances;
|
|
7
7
|
private readonly beforePlugins;
|
|
8
8
|
private readonly afterPlugins;
|
|
9
|
+
private readonly landingFilesExceptions;
|
|
9
10
|
constructor(options?: CommanderOptions);
|
|
10
11
|
init(sitePath?: string): Promise<void>;
|
|
11
12
|
build(): Promise<void>;
|
|
12
13
|
serve(): Promise<void>;
|
|
14
|
+
copyLandingFolder(source: string, target: string): void;
|
|
13
15
|
copyFolder(source: string, target: string): void;
|
|
14
|
-
|
|
16
|
+
copySearchEngineFiles(): void;
|
|
17
|
+
writeConfigFile(): Promise<Record<string, unknown>>;
|
|
18
|
+
validateFilePath(source: string, target: string): Record<string, any>;
|
|
15
19
|
private loadPlugins;
|
|
16
20
|
private readonly executePlugins;
|
|
17
21
|
}
|
package/dist/docula.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docula.d.ts","sourceRoot":"","sources":["../src/docula.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAMnC,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,YAAY,CAAC;AAEjD,qBAAa,MAAM;IAClB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAW;IACpC,OAAO,CAAC,eAAe,CAAuB;IAE9C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAwB;IACtD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAwB;
|
|
1
|
+
{"version":3,"file":"docula.d.ts","sourceRoot":"","sources":["../src/docula.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAMnC,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,YAAY,CAAC;AAEjD,qBAAa,MAAM;IAClB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAW;IACpC,OAAO,CAAC,eAAe,CAAuB;IAE9C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAwB;IACtD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAwB;IACrD,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAyE;gBAEpG,OAAO,CAAC,EAAE,gBAAgB;IASzB,IAAI,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBtC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAYtB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAc5B,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IA4BvD,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IA4BvD,qBAAqB,IAAI,IAAI;IAsCvB,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAczD,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAiBrE,OAAO,CAAC,WAAW;IAkBnB,OAAO,CAAC,QAAQ,CAAC,cAAc,CAE7B;CACF"}
|
package/dist/docula.js
CHANGED
|
@@ -4,7 +4,7 @@ import fs from 'fs-extra';
|
|
|
4
4
|
import express from 'express';
|
|
5
5
|
import { Eleventy } from './eleventy.js';
|
|
6
6
|
import { Config } from './config.js';
|
|
7
|
-
import {
|
|
7
|
+
import { setPlugins } from './tools/inquirer-prompt.js';
|
|
8
8
|
import DoculaPlugins from './plugins/index.js';
|
|
9
9
|
import { getConfigPath, getFileName } from './tools/path.js';
|
|
10
10
|
import logger from './logger.js';
|
|
@@ -13,6 +13,7 @@ export class Docula {
|
|
|
13
13
|
this.pluginInstances = {};
|
|
14
14
|
this.beforePlugins = [];
|
|
15
15
|
this.afterPlugins = [];
|
|
16
|
+
this.landingFilesExceptions = ['search-index.md', 'versions.njk', 'index.njk', 'doc.njk'];
|
|
16
17
|
this.executePlugins = async (plugins) => {
|
|
17
18
|
await Promise.all(plugins.map(async (plugin) => plugin.execute()));
|
|
18
19
|
};
|
|
@@ -24,14 +25,20 @@ export class Docula {
|
|
|
24
25
|
this.loadPlugins();
|
|
25
26
|
}
|
|
26
27
|
async init(sitePath) {
|
|
27
|
-
await this.
|
|
28
|
+
const config = await this.writeConfigFile();
|
|
28
29
|
const { originPath } = this.config;
|
|
29
30
|
const rootSitePath = path.join(process.cwd(), sitePath ?? originPath);
|
|
30
31
|
// Create the <site> folder
|
|
31
32
|
if (!fs.existsSync(rootSitePath)) {
|
|
32
33
|
fs.mkdirSync(rootSitePath);
|
|
33
34
|
}
|
|
34
|
-
|
|
35
|
+
if (config.siteType === 'multi page') {
|
|
36
|
+
this.copyFolder('init', rootSitePath);
|
|
37
|
+
this.copySearchEngineFiles();
|
|
38
|
+
}
|
|
39
|
+
if (config.siteType === 'landing') {
|
|
40
|
+
this.copyLandingFolder('init', rootSitePath);
|
|
41
|
+
}
|
|
35
42
|
}
|
|
36
43
|
async build() {
|
|
37
44
|
const { originPath } = this.config;
|
|
@@ -55,15 +62,37 @@ export class Docula {
|
|
|
55
62
|
logger.info(`Docula is running on http://localhost:${port}`);
|
|
56
63
|
});
|
|
57
64
|
}
|
|
65
|
+
copyLandingFolder(source, target) {
|
|
66
|
+
const { sourcePath, targetExists, isDirectory } = this.validateFilePath(source, target);
|
|
67
|
+
if (isDirectory) {
|
|
68
|
+
const regex = /(search|docs|multipage)+/gi;
|
|
69
|
+
if (regex.test(source)) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (!targetExists) {
|
|
73
|
+
fs.mkdirSync(target);
|
|
74
|
+
}
|
|
75
|
+
for (const file of fs.readdirSync(sourcePath)) {
|
|
76
|
+
if (!fs.existsSync(path.join(target, file))) {
|
|
77
|
+
this.copyLandingFolder(path.join(source, file), path.join(target, file));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
else if (!fs.existsSync(target)) {
|
|
82
|
+
const isExcepted = this.landingFilesExceptions.some(file => source.includes(file));
|
|
83
|
+
if (isExcepted) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
fs.copyFileSync(sourcePath, target);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
58
89
|
copyFolder(source, target) {
|
|
59
|
-
const
|
|
60
|
-
const doculaPath = path.dirname(path.dirname(path.dirname(__filename)));
|
|
61
|
-
const sourcePath = path.join(doculaPath, source);
|
|
62
|
-
const sourceExists = fs.existsSync(sourcePath);
|
|
63
|
-
const targetExists = fs.existsSync(target);
|
|
64
|
-
const sourceStats = fs.statSync(sourcePath);
|
|
65
|
-
const isDirectory = sourceExists && sourceStats.isDirectory();
|
|
90
|
+
const { sourcePath, targetExists, isDirectory } = this.validateFilePath(source, target);
|
|
66
91
|
if (isDirectory) {
|
|
92
|
+
// Exclude the search folder
|
|
93
|
+
if (source.includes('search') || source.includes('landing')) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
67
96
|
if (!targetExists) {
|
|
68
97
|
fs.mkdirSync(target);
|
|
69
98
|
}
|
|
@@ -74,22 +103,70 @@ export class Docula {
|
|
|
74
103
|
}
|
|
75
104
|
}
|
|
76
105
|
else if (!fs.existsSync(target)) {
|
|
106
|
+
// Exclude the search-index file
|
|
107
|
+
if (source.includes('search-index.md') || source.includes('releases')) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
77
110
|
fs.copyFileSync(sourcePath, target);
|
|
78
111
|
}
|
|
79
112
|
}
|
|
80
|
-
|
|
81
|
-
const
|
|
82
|
-
const
|
|
83
|
-
const
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
113
|
+
copySearchEngineFiles() {
|
|
114
|
+
const { searchEngine, originPath } = this.config;
|
|
115
|
+
const __filename = getFileName();
|
|
116
|
+
const doculaPath = path.dirname(path.dirname(path.dirname(__filename)));
|
|
117
|
+
const sourcePath = path.join(doculaPath, `init/_includes/search/${searchEngine}.njk`);
|
|
118
|
+
const searchPath = path.join(process.cwd(), `${originPath}/_includes/search`);
|
|
119
|
+
const targetPath = path.join(process.cwd(), `${originPath}/_includes/search/${searchEngine}.njk`);
|
|
120
|
+
const searchStylesPath = path.join(process.cwd(), `${originPath}/_includes/assets/css/styles/search`);
|
|
121
|
+
const sourceSearchStylesPath = path.join(doculaPath, `init/_includes/assets/css/styles/search/${searchEngine}.css`);
|
|
122
|
+
const searchStylesTargetPath = path.join(process.cwd(), `${originPath}/_includes/assets/css/styles/search/${searchEngine}.css`);
|
|
123
|
+
if (!fs.existsSync(searchPath)) {
|
|
124
|
+
fs.mkdirSync(searchPath);
|
|
125
|
+
}
|
|
126
|
+
if (!fs.existsSync(targetPath)) {
|
|
127
|
+
fs.copyFileSync(sourcePath, targetPath);
|
|
128
|
+
}
|
|
129
|
+
// Copy search styles
|
|
130
|
+
if (!fs.existsSync(searchStylesPath)) {
|
|
131
|
+
fs.mkdirSync(searchStylesPath);
|
|
132
|
+
}
|
|
133
|
+
if (!fs.existsSync(searchStylesTargetPath)) {
|
|
134
|
+
fs.copyFileSync(sourceSearchStylesPath, searchStylesTargetPath);
|
|
135
|
+
}
|
|
136
|
+
if (searchEngine === 'algolia') {
|
|
137
|
+
const indexSource = path.join(doculaPath, 'init/search-index.md');
|
|
138
|
+
const indexTarget = path.join(process.cwd(), `${originPath}/search-index.md`);
|
|
139
|
+
if (!fs.existsSync(indexTarget)) {
|
|
140
|
+
fs.copyFileSync(indexSource, indexTarget);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
async writeConfigFile() {
|
|
145
|
+
const plugins = await setPlugins();
|
|
146
|
+
for (const plugin in plugins) {
|
|
147
|
+
if (Object.prototype.hasOwnProperty.call(plugins, plugin)) {
|
|
148
|
+
// @ts-expect-error fix later
|
|
149
|
+
this.config[plugin] = plugins[plugin];
|
|
89
150
|
}
|
|
90
151
|
}
|
|
91
152
|
const configPath = getConfigPath();
|
|
92
|
-
fs.writeFileSync(configPath, JSON.stringify(
|
|
153
|
+
fs.writeFileSync(configPath, JSON.stringify(plugins, null, 2));
|
|
154
|
+
return plugins;
|
|
155
|
+
}
|
|
156
|
+
validateFilePath(source, target) {
|
|
157
|
+
const __filename = getFileName();
|
|
158
|
+
const doculaPath = path.dirname(path.dirname(path.dirname(__filename)));
|
|
159
|
+
const sourcePath = path.join(doculaPath, source);
|
|
160
|
+
const sourceExists = fs.existsSync(sourcePath);
|
|
161
|
+
const targetExists = fs.existsSync(target);
|
|
162
|
+
const sourceStats = fs.statSync(sourcePath);
|
|
163
|
+
const isDirectory = sourceExists && sourceStats.isDirectory();
|
|
164
|
+
return {
|
|
165
|
+
sourcePath,
|
|
166
|
+
sourceExists,
|
|
167
|
+
targetExists,
|
|
168
|
+
isDirectory,
|
|
169
|
+
};
|
|
93
170
|
}
|
|
94
171
|
loadPlugins() {
|
|
95
172
|
const { plugins } = this.config;
|
package/dist/docula.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docula.js","sourceRoot":"","sources":["../src/docula.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AACvC,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AACnC,OAAO,EAAC,UAAU,
|
|
1
|
+
{"version":3,"file":"docula.js","sourceRo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"version":3,"file":"global-data.d.ts","sourceRoot":"","sources":["../../src/eleventy/global-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,MAAM,EAAC,MAAM,cAAc,CAAC;AAEzC,eAAO,MAAM,SAAS,WAAY,MAAM,KAAG,MAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global-data.js","sourceRoot":"","sources":["../../src/eleventy/global-data.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,MAAc,EAAU,EAAE,CAAC,MAAM,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const getYear: () => string;
|
|
2
|
-
export declare const formatDate: (format: string, date?:
|
|
2
|
+
export declare const formatDate: (format: string, date?: string) => string;
|
|
3
3
|
export declare const parseRelease: (content: string) => string;
|
|
4
4
|
//# sourceMappingURL=shortcodes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shortcodes.d.ts","sourceRoot":"","sources":["../../src/eleventy/shortcodes.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,QAAO,MAAmD,CAAC;AAE/E,eAAO,MAAM,UAAU,WAAY,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"shortcodes.d.ts","sourceRoot":"","sources":["../../src/eleventy/shortcodes.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,QAAO,MAAmD,CAAC;AAE/E,eAAO,MAAM,UAAU,WAAY,MAAM,SAAS,MAAM,KAAG,MAM1D,CAAC;AAEF,eAAO,MAAM,YAAY,YAAa,MAAM,WAO3C,CAAC"}
|
|
@@ -3,7 +3,7 @@ import MarkdownIt from 'markdown-it';
|
|
|
3
3
|
export const getYear = () => DateTime.local().toUTC().toFormat('yyyy');
|
|
4
4
|
export const formatDate = (format, date) => {
|
|
5
5
|
if (date) {
|
|
6
|
-
return DateTime.
|
|
6
|
+
return DateTime.fromISO(date).toUTC().toFormat(format);
|
|
7
7
|
}
|
|
8
8
|
return DateTime.now().toUTC().toFormat(format);
|
|
9
9
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shortcodes.js","sourceRoot":"","sources":["../../src/eleventy/shortcodes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC/B,OAAO,UAAU,MAAM,aAAa,CAAC;AAErC,MAAM,CAAC,MAAM,OAAO,GAAG,GAAW,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAE/E,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,MAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"shortcodes.js","sourceRoot":"","sources":["../../src/eleventy/shortcodes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC/B,OAAO,UAAU,MAAM,aAAa,CAAC;AAErC,MAAM,CAAC,MAAM,OAAO,GAAG,GAAW,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAE/E,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,MAAc,EAAE,IAAa,EAAU,EAAE;IACnE,IAAI,IAAI,EAAE;QACT,OAAO,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;KACvD;IAED,OAAO,QAAQ,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAChD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,OAAe,EAAE,EAAE;IAC/C,MAAM,EAAE,GAAG,IAAI,UAAU,CAAC;QACzB,IAAI,EAAE,IAAI;QACV,OAAO,EAAE,IAAI;QACb,WAAW,EAAE,IAAI;KACjB,CAAC,CAAC;IACH,OAAO,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAC3B,CAAC,CAAC"}
|
package/dist/eleventy.d.ts
CHANGED
package/dist/eleventy.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eleventy.d.ts","sourceRoot":"","sources":["../src/eleventy.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"eleventy.d.ts","sourceRoot":"","sources":["../src/eleventy.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AA+BxC,KAAK,cAAc,GAAG;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,qBAAa,QAAQ;IACpB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA2J;IAC1L,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgB;IACzC,IAAI,MAAM,IAAI,MAAM,CAEnB;gBAEW,MAAM,EAAE,MAAM;IA4Bb,KAAK;IASL,MAAM;IAKnB,OAAO,CAAC,kBAAkB;IAK1B,OAAO,CAAC,UAAU;IAOlB,OAAO,CAAC,SAAS;IAOjB,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,aAAa;CAIrB"}
|
package/dist/eleventy.js
CHANGED
|
@@ -8,6 +8,7 @@ import markdownIt from 'markdown-it';
|
|
|
8
8
|
import markdownItAnchor from 'markdown-it-anchor';
|
|
9
9
|
import { squashCallback } from './eleventy/filters.js';
|
|
10
10
|
import { getYear, formatDate, parseRelease } from './eleventy/shortcodes.js';
|
|
11
|
+
import { getConfig } from './eleventy/global-data.js';
|
|
11
12
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
12
13
|
const Elev = pkg.default;
|
|
13
14
|
export class Eleventy {
|
|
@@ -25,6 +26,7 @@ export class Eleventy {
|
|
|
25
26
|
this.addPlugin(eleventyConfig);
|
|
26
27
|
this.addShortcode(eleventyConfig);
|
|
27
28
|
this.addFilter(eleventyConfig);
|
|
29
|
+
this.addGlobalData(eleventyConfig);
|
|
28
30
|
eleventyConfig.setTemplateFormats(['njk', 'md', 'html']);
|
|
29
31
|
return {
|
|
30
32
|
markdownTemplateEngine: 'njk',
|
|
@@ -37,7 +39,12 @@ export class Eleventy {
|
|
|
37
39
|
this.eleventy = new Elev(this.config.originPath, this.config.outputPath, this.eleventyConfig);
|
|
38
40
|
}
|
|
39
41
|
async build() {
|
|
40
|
-
|
|
42
|
+
try {
|
|
43
|
+
await this.eleventy.write();
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
throw new Error(`Eleventy build failed: ${error.message}`);
|
|
47
|
+
}
|
|
41
48
|
}
|
|
42
49
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
43
50
|
async toJSON() {
|
|
@@ -65,5 +72,9 @@ export class Eleventy {
|
|
|
65
72
|
addFilter(eleventyConfig) {
|
|
66
73
|
eleventyConfig.addFilter('squash', squashCallback);
|
|
67
74
|
}
|
|
75
|
+
addGlobalData(eleventyConfig) {
|
|
76
|
+
// EleventyConfig.addGlobalData('algoliaKeys', () => algoliaKeys(this.config));
|
|
77
|
+
eleventyConfig.addGlobalData('config', () => getConfig(this.config));
|
|
78
|
+
}
|
|
68
79
|
}
|
|
69
80
|
//# sourceMappingURL=eleventy.js.map
|
package/dist/eleventy.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eleventy.js","sourceRoot":"","sources":["../src/eleventy.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,OAAO,KAAK,GAAG,MAAM,gBAAgB,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AAmB,CAAC;QAChE,cAAc,CAAC,kBAAkB,CAAC,EAAC,CAAC,UAAU,CAAC,EAAE,UAAU,EAAC,CAAC,CAAC;IAC/D,CAAC;IAEO,UAAU,CAAC,cAA0B;QAC5C,cAAc,CAAC,UAAU,CACxB,IAAI,EACJ,UAAU,EAAE,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAClC,CAAC;IACH,CAAC;IAEO,SAAS,CAAC,cAA0B;QAC3C,cAAc,CAAC,SAAS,CAAC,wBAAwB,CAAC,CAAC;QACnD,cAAc,CAAC,SAAS,CAAC,SAAS,EAAE;YACnC,IAAI,EAAE,CAAC,IAAI,CAAC;SACZ,CAAC,CAAC;IACJ,CAAC;IAEO,YAAY,CAAC,cAA0B;QAC9C,cAAc,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC7C,cAAc,CAAC,YAAY,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;QACtD,cAAc,CAAC,YAAY,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;IAC3D,CAAC;IAEO,SAAS,CAAC,cAA0B;QAC3C,cAAc,CAAC,SAAS,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;IACpD,CAAC;IAEO,aAAa,CAAC,cAA0B;QAC/C,+EAA+E;QAC/E,cAAc,CAAC,aAAa,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IACtE,CAAC;CACD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type SearchClient, type SearchIndex } from 'algoliasearch';
|
|
2
|
+
import type { Config } from '../config.js';
|
|
3
|
+
import type { DoculaPlugin, Options, Schema, Runtime } from '../docula-plugin.js';
|
|
4
|
+
export type AlgoliaConfig = {
|
|
5
|
+
apiKey: string;
|
|
6
|
+
appId: string;
|
|
7
|
+
indexName: string;
|
|
8
|
+
};
|
|
9
|
+
type SearchOptions = {
|
|
10
|
+
index?: SearchIndex;
|
|
11
|
+
} & Options;
|
|
12
|
+
export declare class AlgoliaPlugin implements DoculaPlugin {
|
|
13
|
+
static schema: Schema;
|
|
14
|
+
readonly options: SearchOptions;
|
|
15
|
+
runtime: Runtime;
|
|
16
|
+
readonly client: SearchClient;
|
|
17
|
+
constructor(config: Config);
|
|
18
|
+
execute(): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=algolia.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"algolia.d.ts","sourceRoot":"","sources":["../../src/plugins/algolia.ts"],"names":[],"mappings":"AACA,OAAsB,EAAC,KAAK,YAAY,EAAE,KAAK,WAAW,EAAC,MAAM,eAAe,CAAC;AAEjF,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAC,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAC,MAAM,qBAAqB,CAAC;AAEhF,MAAM,MAAM,aAAa,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,KAAK,aAAa,GAAG;IACpB,KAAK,CAAC,EAAE,WAAW,CAAC;CACpB,GAAG,OAAO,CAAC;AAEZ,qBAAa,aAAc,YAAW,YAAY;IACjD,MAAM,CAAC,MAAM,EAAE,MAAM,CAQnB;IAEF,QAAQ,CAAC,OAAO,EAAE,aAAa,CAK7B;IAEF,OAAO,EAAE,OAAO,CAAW;IAC3B,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;gBAElB,MAAM,EAAE,MAAM;IAWpB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAqB9B"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import process from 'node:process';
|
|
2
|
+
import algoliasearch from 'algoliasearch';
|
|
3
|
+
import fs from 'fs-extra';
|
|
4
|
+
export class AlgoliaPlugin {
|
|
5
|
+
constructor(config) {
|
|
6
|
+
this.options = {
|
|
7
|
+
apiKey: '',
|
|
8
|
+
appId: '',
|
|
9
|
+
indexName: '',
|
|
10
|
+
outputPath: '',
|
|
11
|
+
};
|
|
12
|
+
this.runtime = 'after';
|
|
13
|
+
const { appId, apiKey, indexName } = config.pluginConfig.algolia;
|
|
14
|
+
this.options.outputPath = config.outputPath;
|
|
15
|
+
this.options.appId = appId;
|
|
16
|
+
this.options.apiKey = apiKey;
|
|
17
|
+
this.options.indexName = indexName;
|
|
18
|
+
// @ts-expect-error - algoliasearch is not callable
|
|
19
|
+
this.client = algoliasearch(this.options.appId, this.options.apiKey);
|
|
20
|
+
this.options.index = this.client.initIndex(this.options.indexName);
|
|
21
|
+
}
|
|
22
|
+
async execute() {
|
|
23
|
+
let jsonContent = [];
|
|
24
|
+
const jsonPath = `${process.cwd()}/${this.options.outputPath}/algolia.json`;
|
|
25
|
+
if (fs.existsSync(jsonPath)) {
|
|
26
|
+
const data = fs.readFileSync(jsonPath, 'utf8');
|
|
27
|
+
const content = JSON.parse(data);
|
|
28
|
+
jsonContent = content.filter(item => item.description.length);
|
|
29
|
+
}
|
|
30
|
+
try {
|
|
31
|
+
// @ts-expect-error - clearObjects
|
|
32
|
+
await this.options.index.clearObjects();
|
|
33
|
+
// @ts-expect-error - saveObjects
|
|
34
|
+
await this.options.index.saveObjects(jsonContent, {
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
36
|
+
autoGenerateObjectIDIfNotExist: true,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
throw new Error(`Error while indexing to Algolia: ${error.message}`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
AlgoliaPlugin.schema = {
|
|
45
|
+
type: 'object',
|
|
46
|
+
required: ['apiKey', 'appId', 'indexName'],
|
|
47
|
+
properties: {
|
|
48
|
+
apiKey: { type: 'string' },
|
|
49
|
+
appId: { type: 'string' },
|
|
50
|
+
indexName: { type: 'string' },
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=algolia.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"algolia.js","sourceRoot":"","sources":["../../src/plugins/algolia.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,aAAoD,MAAM,eAAe,CAAC;AACjF,OAAO,EAAE,MAAM,UAAU,CAAC;AAc1B,MAAM,OAAO,aAAa;IAqBzB,YAAY,MAAc;QAVjB,YAAO,GAAkB;YACjC,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,EAAE;YACT,SAAS,EAAE,EAAE;YACb,UAAU,EAAE,EAAE;SACd,CAAC;QAEF,YAAO,GAAY,OAAO,CAAC;QAI1B,MAAM,EAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAC,GAAG,MAAM,CAAC,YAAY,CAAC,OAAwB,CAAC;QAChF,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;QAC5C,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;QAC3B,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;QAC7B,IAAI,CAAC,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;QACnC,mDAAmD;QACnD,IAAI,CAAC,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACrE,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACpE,CAAC;IAED,KAAK,CAAC,OAAO;QACZ,IAAI,WAAW,GAAkC,EAAE,CAAC;QACpD,MAAM,QAAQ,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,eAAe,CAAC;QAC5E,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;YAC5B,MAAM,IAAI,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YAC/C,MAAM,OAAO,GAAkC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAChE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;SAC9D;QAED,IAAI;YACH,kCAAkC;YAClC,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;YACxC,iCAAiC;YACjC,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,WAAW,EAAE;gBACjD,gEAAgE;gBAChE,8BAA8B,EAAE,IAAI;aACpC,CAAC,CAAC;SACH;QAAC,OAAO,KAAc,EAAE;YACxB,MAAM,IAAI,KAAK,CAAC,oCAAqC,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;SAChF;IACF,CAAC;;AAnDM,oBAAM,GAAW;IACvB,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,WAAW,CAAC;IAC1C,UAAU,EAAE;QACX,MAAM,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;QACxB,KAAK,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;QACvB,SAAS,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;KAC3B;CACD,CAAC"}
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -3,14 +3,16 @@ import { type NpmConfig, NpmPlugin } from './npm.js';
|
|
|
3
3
|
import { type RobotsConfig, RobotsPlugin } from './robots.js';
|
|
4
4
|
import { SitemapPlugin } from './sitemap.js';
|
|
5
5
|
import { PagefindPlugin } from './pagefind.js';
|
|
6
|
+
import { type AlgoliaConfig, AlgoliaPlugin } from './algolia.js';
|
|
6
7
|
declare const plugins: {
|
|
7
8
|
github: typeof GithubPlugin;
|
|
8
9
|
npm: typeof NpmPlugin;
|
|
9
10
|
robots: typeof RobotsPlugin;
|
|
10
11
|
sitemap: typeof SitemapPlugin;
|
|
11
12
|
pagefind: typeof PagefindPlugin;
|
|
13
|
+
algolia: typeof AlgoliaPlugin;
|
|
12
14
|
};
|
|
13
|
-
export type PluginConfig = GithubConfig | NpmConfig | RobotsConfig;
|
|
14
|
-
export type PluginInstance = GithubPlugin | NpmPlugin | RobotsPlugin | SitemapPlugin | PagefindPlugin;
|
|
15
|
+
export type PluginConfig = GithubConfig | NpmConfig | RobotsConfig | AlgoliaConfig;
|
|
16
|
+
export type PluginInstance = GithubPlugin | NpmPlugin | RobotsPlugin | SitemapPlugin | PagefindPlugin | AlgoliaPlugin;
|
|
15
17
|
export default plugins;
|
|
16
18
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,YAAY,EAAE,YAAY,EAAC,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAC,KAAK,SAAS,EAAE,SAAS,EAAC,MAAM,UAAU,CAAC;AACnD,OAAO,EAAC,KAAK,YAAY,EAAE,YAAY,EAAC,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAC,aAAa,EAAC,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,YAAY,EAAE,YAAY,EAAC,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAC,KAAK,SAAS,EAAE,SAAS,EAAC,MAAM,UAAU,CAAC;AACnD,OAAO,EAAC,KAAK,YAAY,EAAE,YAAY,EAAC,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAC,aAAa,EAAC,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAC,KAAK,aAAa,EAAE,aAAa,EAAC,MAAM,cAAc,CAAC;AAE/D,QAAA,MAAM,OAAO;;;;;;;CAOZ,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG,SAAS,GAAG,YAAY,GAAG,aAAa,CAAC;AAEnF,MAAM,MAAM,cAAc,GAAG,YAAY,GAAG,SAAS,GAAG,YAAY,GAAG,aAAa,GAAG,cAAc,GAAG,aAAa,CAAC;AAEtH,eAAe,OAAO,CAAC"}
|
package/dist/plugins/index.js
CHANGED
|
@@ -3,12 +3,14 @@ import { NpmPlugin } from './npm.js';
|
|
|
3
3
|
import { RobotsPlugin } from './robots.js';
|
|
4
4
|
import { SitemapPlugin } from './sitemap.js';
|
|
5
5
|
import { PagefindPlugin } from './pagefind.js';
|
|
6
|
+
import { AlgoliaPlugin } from './algolia.js';
|
|
6
7
|
const plugins = {
|
|
7
8
|
github: GithubPlugin,
|
|
8
9
|
npm: NpmPlugin,
|
|
9
10
|
robots: RobotsPlugin,
|
|
10
11
|
sitemap: SitemapPlugin,
|
|
11
12
|
pagefind: PagefindPlugin,
|
|
13
|
+
algolia: AlgoliaPlugin,
|
|
12
14
|
};
|
|
13
15
|
export default plugins;
|
|
14
16
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,YAAY,EAAC,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAiB,SAAS,EAAC,MAAM,UAAU,CAAC;AACnD,OAAO,EAAoB,YAAY,EAAC,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAC,aAAa,EAAC,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,YAAY,EAAC,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAiB,SAAS,EAAC,MAAM,UAAU,CAAC;AACnD,OAAO,EAAoB,YAAY,EAAC,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAC,aAAa,EAAC,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAqB,aAAa,EAAC,MAAM,cAAc,CAAC;AAE/D,MAAM,OAAO,GAAG;IACf,MAAM,EAAE,YAAY;IACpB,GAAG,EAAE,SAAS;IACd,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,aAAa;IACtB,QAAQ,EAAE,cAAc;IACxB,OAAO,EAAE,aAAa;CACtB,CAAC;AAMF,eAAe,OAAO,CAAC"}
|
package/dist/schemas.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,KAAK,OAAO,EAAC,MAAM,mBAAmB,CAAC;AAE/C,KAAK,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;AAElD,KAAK,WAAW,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,OAAO,CAAC;KACd,CAAC;CACF,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,oBAAoB,EAAE,OAAO,CAAC;IAC9B,UAAU,EAAE;QACX,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,GAAG,WAAW,CAAC;QACtC,OAAO,EAAE,WAAW,CAAC;KACrB,CAAC;IACF,QAAQ,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,KAAK,OAAO,EAAC,MAAM,mBAAmB,CAAC;AAE/C,KAAK,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;AAElD,KAAK,WAAW,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,OAAO,CAAC;KACd,CAAC;CACF,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,oBAAoB,EAAE,OAAO,CAAC;IAC9B,UAAU,EAAE;QACX,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,GAAG,WAAW,CAAC;QACtC,OAAO,EAAE,WAAW,CAAC;KACrB,CAAC;IACF,QAAQ,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,YAsB9B,CAAC"}
|
package/dist/schemas.js
CHANGED
|
@@ -7,7 +7,7 @@ export const jsonConfigSchema = {
|
|
|
7
7
|
outputPath: { type: 'string' },
|
|
8
8
|
dataPath: { type: 'string' },
|
|
9
9
|
templatePath: { type: 'string' },
|
|
10
|
-
searchEngine: { type: 'string', enum: ['algolia'] },
|
|
10
|
+
searchEngine: { type: 'string', enum: ['algolia', 'pagefind'] },
|
|
11
11
|
plugins: {
|
|
12
12
|
type: 'array',
|
|
13
13
|
items: {
|
|
@@ -18,6 +18,7 @@ export const jsonConfigSchema = {
|
|
|
18
18
|
imagesPath: { type: 'string' },
|
|
19
19
|
assetsPath: { type: 'string' },
|
|
20
20
|
siteUrl: { type: 'string' },
|
|
21
|
+
siteType: { type: 'string', enum: ['landing', 'multi page'] },
|
|
21
22
|
},
|
|
22
23
|
required: [],
|
|
23
24
|
};
|
package/dist/schemas.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAuB/C,MAAM,CAAC,MAAM,gBAAgB,GAAiB;IAC7C,IAAI,EAAE,QAAQ;IACd,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE;QACX,UAAU,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;QAC5B,UAAU,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;QAC5B,QAAQ,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;QAC1B,YAAY,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;QAC9B,YAAY,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,SAAS,CAAC,EAAC;
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAuB/C,MAAM,CAAC,MAAM,gBAAgB,GAAiB;IAC7C,IAAI,EAAE,QAAQ;IACd,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE;QACX,UAAU,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;QAC5B,UAAU,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;QAC5B,QAAQ,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;QAC1B,YAAY,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;QAC9B,YAAY,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,SAAS,EAAE,UAAU,CAAC,EAAC;QAC7D,OAAO,EAAE;YACR,IAAI,EAAE,OAAO;YACb,KAAK,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,aAAa,CAAY;aAC3C;SACD;QACD,UAAU,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;QAC5B,UAAU,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;QAC5B,OAAO,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;QACzB,QAAQ,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,SAAS,EAAE,YAAY,CAAC,EAAC;KAC3D;IACD,QAAQ,EAAE,EAAE;CACZ,CAAC"}
|
|
@@ -8,11 +8,13 @@ export declare const getSiteUrl: jest.Mock<string, [], any>;
|
|
|
8
8
|
export declare const getUserPlugins: jest.Mock<{
|
|
9
9
|
plugins: string[];
|
|
10
10
|
}, [], any>;
|
|
11
|
-
export declare const
|
|
11
|
+
export declare const setPlugins: jest.Mock<{
|
|
12
|
+
siteUrl: string;
|
|
13
|
+
searchEngine: string;
|
|
12
14
|
plugins: string[];
|
|
13
15
|
github: {
|
|
14
16
|
author: string;
|
|
15
17
|
repo: string;
|
|
16
18
|
};
|
|
17
|
-
}, [
|
|
19
|
+
}, [], any>;
|
|
18
20
|
//# sourceMappingURL=inquirer-prompt.d.ts.map
|