docula 0.3.7 → 0.4.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 +108 -39
- package/bin/docula.mjs +8 -0
- package/dist/builder.d.ts +34 -0
- package/dist/builder.js +182 -0
- package/dist/console.d.ts +22 -0
- package/dist/console.js +120 -0
- package/dist/docula.d.ts +22 -22
- package/dist/docula.js +125 -174
- package/dist/github.d.ts +22 -0
- package/dist/github.js +74 -0
- package/dist/helpers/markdown.d.ts +10 -0
- package/dist/helpers/markdown.js +24 -0
- package/dist/helpers.d.ts +7 -0
- package/dist/helpers.js +58 -0
- package/dist/options.d.ts +12 -0
- package/dist/options.js +47 -0
- package/init/docula.config.cjs +10 -0
- package/init/favicon.ico +0 -0
- package/init/logo.png +0 -0
- package/init/variables.css +30 -0
- package/package.json +58 -91
- package/{templates/default/assets/css/styles → template/css}/home.css +20 -18
- package/{init/_includes/assets/css/styles → template/css}/index.css +7 -0
- package/template/includes/footer.hbs +10 -0
- package/template/includes/header.hbs +17 -0
- package/template/includes/landing/content.hbs +63 -0
- package/template/includes/landing/hero.hbs +3 -0
- package/template/includes/scripts.hbs +4 -0
- package/template/index.hbs +16 -0
- package/template/releases.hbs +45 -0
- package/bin/docula.js +0 -7
- package/dist/config.d.ts +0 -21
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -78
- package/dist/config.js.map +0 -1
- package/dist/docula-plugin.d.ts +0 -9
- package/dist/docula-plugin.d.ts.map +0 -1
- package/dist/docula-plugin.js +0 -2
- package/dist/docula-plugin.js.map +0 -1
- package/dist/docula.d.ts.map +0 -1
- package/dist/docula.js.map +0 -1
- package/dist/eleventy/filters.d.ts +0 -2
- package/dist/eleventy/filters.d.ts.map +0 -1
- package/dist/eleventy/filters.js +0 -10
- package/dist/eleventy/filters.js.map +0 -1
- package/dist/eleventy/global-data.d.ts +0 -3
- package/dist/eleventy/global-data.d.ts.map +0 -1
- package/dist/eleventy/global-data.js +0 -2
- package/dist/eleventy/global-data.js.map +0 -1
- package/dist/eleventy/shortcodes.d.ts +0 -4
- package/dist/eleventy/shortcodes.d.ts.map +0 -1
- package/dist/eleventy/shortcodes.js +0 -18
- package/dist/eleventy/shortcodes.js.map +0 -1
- package/dist/eleventy.d.ts +0 -24
- package/dist/eleventy.d.ts.map +0 -1
- package/dist/eleventy.js +0 -82
- package/dist/eleventy.js.map +0 -1
- package/dist/index.d.ts +0 -9
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -67
- package/dist/index.js.map +0 -1
- package/dist/logger.d.ts +0 -4
- package/dist/logger.d.ts.map +0 -1
- package/dist/logger.js +0 -20
- package/dist/logger.js.map +0 -1
- package/dist/plugins/algolia.d.ts +0 -21
- package/dist/plugins/algolia.d.ts.map +0 -1
- package/dist/plugins/algolia.js +0 -54
- package/dist/plugins/algolia.js.map +0 -1
- package/dist/plugins/github.d.ts +0 -16
- package/dist/plugins/github.d.ts.map +0 -1
- package/dist/plugins/github.js +0 -68
- package/dist/plugins/github.js.map +0 -1
- package/dist/plugins/index.d.ts +0 -18
- package/dist/plugins/index.d.ts.map +0 -1
- package/dist/plugins/index.js +0 -16
- package/dist/plugins/index.js.map +0 -1
- package/dist/plugins/npm.d.ts +0 -14
- package/dist/plugins/npm.d.ts.map +0 -1
- package/dist/plugins/npm.js +0 -36
- package/dist/plugins/npm.js.map +0 -1
- package/dist/plugins/pagefind.d.ts +0 -10
- package/dist/plugins/pagefind.d.ts.map +0 -1
- package/dist/plugins/pagefind.js +0 -22
- package/dist/plugins/pagefind.js.map +0 -1
- package/dist/plugins/robots.d.ts +0 -14
- package/dist/plugins/robots.d.ts.map +0 -1
- package/dist/plugins/robots.js +0 -34
- package/dist/plugins/robots.js.map +0 -1
- package/dist/plugins/sitemap.d.ts +0 -11
- package/dist/plugins/sitemap.d.ts.map +0 -1
- package/dist/plugins/sitemap.js +0 -27
- package/dist/plugins/sitemap.js.map +0 -1
- package/dist/schemas.d.ts +0 -21
- package/dist/schemas.d.ts.map +0 -1
- package/dist/schemas.js +0 -25
- package/dist/schemas.js.map +0 -1
- package/dist/tools/__mocks__/inquirer-prompt.d.ts +0 -20
- package/dist/tools/__mocks__/inquirer-prompt.d.ts.map +0 -1
- package/dist/tools/__mocks__/inquirer-prompt.js +0 -19
- package/dist/tools/__mocks__/inquirer-prompt.js.map +0 -1
- package/dist/tools/__mocks__/path.d.ts +0 -5
- package/dist/tools/__mocks__/path.d.ts.map +0 -1
- package/dist/tools/__mocks__/path.js +0 -7
- package/dist/tools/__mocks__/path.js.map +0 -1
- package/dist/tools/inquirer-prompt.d.ts +0 -11
- package/dist/tools/inquirer-prompt.d.ts.map +0 -1
- package/dist/tools/inquirer-prompt.js +0 -139
- package/dist/tools/inquirer-prompt.js.map +0 -1
- package/dist/tools/path.d.ts +0 -4
- package/dist/tools/path.d.ts.map +0 -1
- package/dist/tools/path.js +0 -6
- package/dist/tools/path.js.map +0 -1
- package/dist/tools/tools.d.ts +0 -3
- package/dist/tools/tools.d.ts.map +0 -1
- package/dist/tools/tools.js +0 -10
- package/dist/tools/tools.js.map +0 -1
- package/dist/types/config.d.ts +0 -8
- package/dist/types/config.d.ts.map +0 -1
- package/dist/types/config.js +0 -2
- package/dist/types/config.js.map +0 -1
- package/init/_data/site.json +0 -5
- package/init/_includes/assets/css/styles/home.css +0 -305
- package/init/_includes/assets/css/styles/search/algolia.css +0 -125
- package/init/_includes/assets/css/styles/search/pagefind.css +0 -60
- package/init/_includes/assets/css/styles/variables.css +0 -30
- package/init/_includes/assets/images/docula-logo-horizontal.webp +0 -0
- package/init/_includes/assets/images/logo.svg +0 -10
- package/init/_includes/doc.njk +0 -22
- package/init/_includes/landing/landingHero.njk +0 -8
- package/init/_includes/landing/singlePage.njk +0 -24
- package/init/_includes/multipage/header.njk +0 -23
- package/init/_includes/multipage/homeHeader.njk +0 -20
- package/init/_includes/multipage/main.njk +0 -47
- package/init/_includes/multipage/scripts.njk +0 -47
- package/init/_includes/multipage/searchEngine.njk +0 -5
- package/init/_includes/multipage/searchModal.njk +0 -19
- package/init/_includes/multipage/sidebar.njk +0 -50
- package/init/_includes/search/algolia.njk +0 -98
- package/init/_includes/search/pagefind.njk +0 -66
- package/init/_includes/shared/footer.njk +0 -4
- package/init/_includes/shared/head.njk +0 -15
- package/init/_includes/shared/highlightScript.njk +0 -6
- package/init/_includes/shared/homeData.njk +0 -49
- package/init/api/Readme.md +0 -3
- package/init/docs/Readme.md +0 -83
- package/init/docs/docs.json +0 -13
- package/init/index.njk +0 -28
- package/init/releases.njk +0 -38
- package/init/search-index.md +0 -14
- package/init/versions.njk +0 -40
- package/templates/default/assets/css/highlight/highlight.min.js +0 -1433
- package/templates/default/assets/css/highlight/styles/base16/dracula.min.css +0 -7
- package/templates/default/assets/css/styles/index.css +0 -912
- package/templates/default/assets/css/styles/search/algolia.css +0 -125
- package/templates/default/assets/css/styles/search/pagefind.css +0 -60
- package/templates/default/assets/css/styles/variables.css +0 -30
- package/templates/default/assets/images/docula-logo-horizontal.webp +0 -0
- package/templates/default/assets/images/logo.svg +0 -10
- package/templates/default/doc.njk +0 -22
- package/templates/default/index.njk +0 -28
- package/templates/default/landing/landingHero.njk +0 -8
- package/templates/default/landing/singlePage.njk +0 -24
- package/templates/default/multipage/header.njk +0 -23
- package/templates/default/multipage/homeHeader.njk +0 -20
- package/templates/default/multipage/main.njk +0 -47
- package/templates/default/multipage/scripts.njk +0 -47
- package/templates/default/multipage/searchEngine.njk +0 -5
- package/templates/default/multipage/searchModal.njk +0 -19
- package/templates/default/multipage/sidebar.njk +0 -50
- package/templates/default/releases.njk +0 -38
- package/templates/default/search/algolia.njk +0 -98
- package/templates/default/search/pagefind.njk +0 -66
- package/templates/default/search-index.md +0 -14
- package/templates/default/shared/footer.njk +0 -4
- package/templates/default/shared/head.njk +0 -15
- package/templates/default/shared/highlightScript.njk +0 -6
- package/templates/default/shared/homeData.njk +0 -49
- package/templates/default/versions.njk +0 -40
- /package/{init/_includes/assets → template}/css/highlight/highlight.min.js +0 -0
- /package/{init/_includes/assets → template}/css/highlight/styles/base16/dracula.min.css +0 -0
package/dist/config.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
-
import Ajv from 'ajv';
|
|
3
|
-
import { jsonConfigSchema } from './schemas.js';
|
|
4
|
-
import DoculaPlugins from './plugins/index.js';
|
|
5
|
-
export class Config {
|
|
6
|
-
originPath = 'site';
|
|
7
|
-
outputPath = 'dist';
|
|
8
|
-
dataPath = 'data';
|
|
9
|
-
templatePath = 'template';
|
|
10
|
-
searchEngine = 'pagefind';
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
12
|
-
pluginConfig = {};
|
|
13
|
-
plugins = [];
|
|
14
|
-
imagesPath = 'images';
|
|
15
|
-
assetsPath = 'css';
|
|
16
|
-
siteUrl = '';
|
|
17
|
-
siteType = '';
|
|
18
|
-
// @ts-expect-error - ajv is not callable
|
|
19
|
-
ajv = new Ajv();
|
|
20
|
-
schema;
|
|
21
|
-
constructor(path) {
|
|
22
|
-
this.schema = { ...jsonConfigSchema };
|
|
23
|
-
this.schema.required = [];
|
|
24
|
-
const configPath = path ?? `./${this.originPath}/config.json`;
|
|
25
|
-
const configFileExists = this.checkConfigFile(configPath);
|
|
26
|
-
if (configFileExists) {
|
|
27
|
-
this.loadConfig(configPath);
|
|
28
|
-
}
|
|
29
|
-
if (path && !configFileExists) {
|
|
30
|
-
throw new Error('Config file not found');
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
loadConfig(path) {
|
|
34
|
-
const data = readFileSync(path, { encoding: 'utf8' });
|
|
35
|
-
const jsonConfig = JSON.parse(data);
|
|
36
|
-
if (jsonConfig.plugins) {
|
|
37
|
-
for (const name of jsonConfig.plugins) {
|
|
38
|
-
this.loadPlugins(name, jsonConfig[name]);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
this.schema.required = [...new Set(this.schema.required)];
|
|
42
|
-
const validate = this.ajv.compile(this.schema);
|
|
43
|
-
validate(jsonConfig);
|
|
44
|
-
if (validate.errors) {
|
|
45
|
-
const [error] = validate.errors;
|
|
46
|
-
// @ts-expect-error - dataPath exist without error"
|
|
47
|
-
const { dataPath, message, keyword, params } = error;
|
|
48
|
-
if (keyword === 'additionalProperties') {
|
|
49
|
-
const { additionalProperty } = params;
|
|
50
|
-
throw new Error(`The config file has an invalid property: ${additionalProperty}`);
|
|
51
|
-
}
|
|
52
|
-
throw new Error(`${dataPath} ${message}`);
|
|
53
|
-
}
|
|
54
|
-
this.originPath = jsonConfig.originPath ?? this.originPath;
|
|
55
|
-
this.outputPath = jsonConfig.outputPath ?? this.outputPath;
|
|
56
|
-
this.dataPath = jsonConfig.dataPath ?? this.dataPath;
|
|
57
|
-
this.templatePath = jsonConfig.templatePath ?? this.templatePath;
|
|
58
|
-
this.searchEngine = jsonConfig.searchEngine ?? this.searchEngine;
|
|
59
|
-
this.imagesPath = jsonConfig.imagesPath ?? this.imagesPath;
|
|
60
|
-
this.assetsPath = jsonConfig.assetsPath ?? this.assetsPath;
|
|
61
|
-
this.plugins = jsonConfig.plugins ?? this.plugins;
|
|
62
|
-
this.siteUrl = jsonConfig.siteUrl ?? this.siteUrl;
|
|
63
|
-
}
|
|
64
|
-
loadPlugins(name, config) {
|
|
65
|
-
if (config) {
|
|
66
|
-
this.pluginConfig[name] = config;
|
|
67
|
-
const pluginSchema = DoculaPlugins[name].schema;
|
|
68
|
-
this.schema.properties[name] = pluginSchema;
|
|
69
|
-
if (pluginSchema.required?.length) {
|
|
70
|
-
this.schema.required.push(name);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
checkConfigFile(path) {
|
|
75
|
-
return existsSync(path);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
//# sourceMappingURL=config.js.map
|
package/dist/config.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"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I,CAAC,QAAQ,GAAG,UAAU,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC;QACrD,IAAI,CAAC,YAAY,GAAG,UAAU,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,CAAC;QACjE,IAAI,CAAC,YAAY,GAAG,UAAU,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,CAAC;QAEjE,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU,CAAC;QAC3D,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU,CAAC;QAC3D,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC;QAClD,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC;IACnD,CAAC;IAED,WAAW,CAAC,IAAgB,EAAE,MAAoB;QACjD,IAAI,MAAM,EAAE,CAAC;YACZ,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;YACjC,MAAM,YAAY,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;YAChD,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC;YAC5C,IAAI,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;gBACnC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACjC,CAAC;QACF,CAAC;IACF,CAAC;IAED,eAAe,CAAC,IAAY;QAC3B,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;CACD","sourcesContent":["import {existsSync, readFileSync} from 'node:fs';\nimport Ajv from 'ajv';\nimport {type ConfigSchema, jsonConfigSchema} from './schemas.js';\nimport type {PluginConfig, PluginConfigs, PluginName, Plugins} from './types/config.js';\nimport DoculaPlugins from './plugins/index.js';\n\nexport class Config {\n\toriginPath = 'site';\n\toutputPath = 'dist';\n\tdataPath = 'data';\n\ttemplatePath = 'template';\n\tsearchEngine = 'pagefind';\n\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\tpluginConfig: PluginConfigs = {} as PluginConfigs;\n\tplugins: Plugins = [];\n\timagesPath = 'images';\n\tassetsPath = 'css';\n\tsiteUrl = '';\n\tsiteType = '';\n\t// @ts-expect-error - ajv is not callable\n\tajv = new Ajv();\n\n\tprivate readonly schema: ConfigSchema;\n\n\tconstructor(path?: string) {\n\t\tthis.schema = {...jsonConfigSchema};\n\t\tthis.schema.required = [];\n\t\tconst configPath = path ?? `./${this.originPath}/config.json`;\n\t\tconst configFileExists = this.checkConfigFile(configPath);\n\t\tif (configFileExists) {\n\t\t\tthis.loadConfig(configPath);\n\t\t}\n\n\t\tif (path && !configFileExists) {\n\t\t\tthrow new Error('Config file not found');\n\t\t}\n\t}\n\n\tloadConfig(path: string) {\n\t\tconst data = readFileSync(path, {encoding: 'utf8'});\n\t\tconst jsonConfig = JSON.parse(data) as Record<string, any>;\n\n\t\tif (jsonConfig.plugins) {\n\t\t\tfor (const name of jsonConfig.plugins) {\n\t\t\t\tthis.loadPlugins(name, jsonConfig[name]);\n\t\t\t}\n\t\t}\n\n\t\tthis.schema.required = [...new Set(this.schema.required)];\n\n\t\tconst validate: Ajv.ValidateFunction = this.ajv.compile(this.schema);\n\n\t\tvalidate(jsonConfig);\n\n\t\tif (validate.errors) {\n\t\t\tconst [error] = validate.errors;\n\t\t\t// @ts-expect-error - dataPath exist without error\"\n\t\t\tconst {dataPath, message, keyword, params} = error;\n\t\t\tif (keyword === 'additionalProperties') {\n\t\t\t\tconst {additionalProperty} = params as Record<string, string>;\n\t\t\t\tthrow new Error(`The config file has an invalid property: ${additionalProperty}`);\n\t\t\t}\n\n\t\t\tthrow new Error(`${dataPath as string} ${message!}`);\n\t\t}\n\n\t\tthis.originPath = jsonConfig.originPath ?? this.originPath;\n\t\tthis.outputPath = jsonConfig.outputPath ?? this.outputPath;\n\t\tthis.dataPath = jsonConfig.dataPath ?? this.dataPath;\n\t\tthis.templatePath = jsonConfig.templatePath ?? this.templatePath;\n\t\tthis.searchEngine = jsonConfig.searchEngine ?? this.searchEngine;\n\n\t\tthis.imagesPath = jsonConfig.imagesPath ?? this.imagesPath;\n\t\tthis.assetsPath = jsonConfig.assetsPath ?? this.assetsPath;\n\t\tthis.plugins = jsonConfig.plugins ?? this.plugins;\n\t\tthis.siteUrl = jsonConfig.siteUrl ?? this.siteUrl;\n\t}\n\n\tloadPlugins(name: PluginName, config: PluginConfig) {\n\t\tif (config) {\n\t\t\tthis.pluginConfig[name] = config;\n\t\t\tconst pluginSchema = DoculaPlugins[name].schema;\n\t\t\tthis.schema.properties[name] = pluginSchema;\n\t\t\tif (pluginSchema.required?.length) {\n\t\t\t\tthis.schema.required.push(name);\n\t\t\t}\n\t\t}\n\t}\n\n\tcheckConfigFile(path: string): boolean {\n\t\treturn existsSync(path);\n\t}\n}\n"]}
|
package/dist/docula-plugin.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export type Runtime = 'before' | 'after';
|
|
2
|
-
export type Options = Record<string, string>;
|
|
3
|
-
export type Schema = Record<string, any>;
|
|
4
|
-
export type DoculaPlugin = {
|
|
5
|
-
options: Record<string, string>;
|
|
6
|
-
runtime: Runtime;
|
|
7
|
-
execute(): Promise<void>;
|
|
8
|
-
};
|
|
9
|
-
//# sourceMappingURL=docula-plugin.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"docula-plugin.d.ts","sourceRoot":"","sources":["../src/docula-plugin.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AACzC,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC7C,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAEzC,MAAM,MAAM,YAAY,GAAG;IAC1B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACzB,CAAC"}
|
package/dist/docula-plugin.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"docula-plugin.js","sourceRoot":"","sources":["../src/docula-plugin.ts"],"names":[],"mappings":"","sourcesContent":["\nexport type Runtime = 'before' | 'after';\nexport type Options = Record<string, string>;\nexport type Schema = Record<string, any>;\n\nexport type DoculaPlugin = {\n\toptions: Record<string, string>;\n\truntime: Runtime;\n\texecute(): Promise<void>;\n};\n"]}
|
package/dist/docula.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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;IAetC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAYtB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAYvB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IA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AC,aAAa,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YACzC,CAAC;iBAAM,IAAI,OAAO,KAAK,OAAO,EAAE,CAAC;gBAChC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YACxC,CAAC;QACF,CAAC;IACF,CAAC;IAEgB,cAAc,GAAG,KAAK,EAAE,OAAyB,EAAiB,EAAE;QACpF,MAAM,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAC,MAAM,EAAC,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAClE,CAAC,CAAC;CACF","sourcesContent":["import * as path from 'node:path';\nimport process from 'node:process';\nimport fs from 'fs-extra';\nimport express from 'express';\nimport {Eleventy} from './eleventy.js';\nimport {Config} from './config.js';\nimport {setPlugins} from './tools/inquirer-prompt.js';\nimport DoculaPlugins from './plugins/index.js';\nimport type {PluginInstance, PluginInstances} from './types/config.js';\nimport {getConfigPath, getFileName, getSitePath} from './tools/path.js';\nimport logger from './logger.js';\nimport type {CommanderOptions} from './index.js';\n\nexport class Docula {\n\treadonly config: Config;\n\tprivate readonly eleventy: Eleventy;\n\tprivate pluginInstances: PluginInstances = {};\n\n\tprivate readonly beforePlugins: PluginInstance[] = [];\n\tprivate readonly afterPlugins: PluginInstance[] = [];\n\tprivate readonly landingFilesExceptions: string[] = ['search-index.md', 'versions.njk', 'index.njk', 'doc.njk'];\n\n\tconstructor(options?: CommanderOptions) {\n\t\tconst parameters = options?.opts();\n\t\tconst defaultConfigPath = getConfigPath();\n\t\tconst configPath: string = parameters ? parameters?.config : defaultConfigPath;\n\t\tthis.config = new Config(configPath);\n\t\tthis.eleventy = new Eleventy(this.config);\n\t\tthis.loadPlugins();\n\t}\n\n\tpublic async init(sitePath?: string): Promise<void> {\n\t\tconst config = await this.writeConfigFile(sitePath);\n\t\tconst {originPath} = this.config;\n\t\tconst rootSitePath = path.join(process.cwd(), sitePath ?? originPath);\n\n\t\tif (config.siteType === 'multi page') {\n\t\t\tthis.copyFolder('init', rootSitePath);\n\t\t\tthis.copySearchEngineFiles();\n\t\t}\n\n\t\tif (config.siteType === 'landing') {\n\t\t\tthis.copyLandingFolder('init', rootSitePath);\n\t\t}\n\t}\n\n\tpublic async build(): Promise<void> {\n\t\tconst {originPath} = this.config;\n\t\tconst userOriginPath = `${process.cwd()}/${originPath}`;\n\t\tif (!fs.existsSync(userOriginPath)) {\n\t\t\tthrow new Error(`The origin path \"${userOriginPath}\" does not exist.`);\n\t\t}\n\n\t\tawait this.executePlugins(this.beforePlugins);\n\t\tawait this.eleventy.build();\n\t\tawait this.executePlugins(this.afterPlugins);\n\t}\n\n\tpublic async build2(): Promise<void> {\n\t\tconst {originPath} = this.config;\n\t\tconst userOriginPath = `${process.cwd()}/${originPath}`;\n\t\tif (!fs.existsSync(userOriginPath)) {\n\t\t\tthrow new Error(`The origin path \"${userOriginPath}\" does not exist.`);\n\t\t}\n\n\t\tawait this.executePlugins(this.beforePlugins);\n\t\tawait this.eleventy.build();\n\t\tawait this.executePlugins(this.afterPlugins);\n\t}\n\n\tpublic async serve(): Promise<void> {\n\t\tconst {outputPath} = this.config;\n\t\tif (!fs.existsSync(outputPath)) {\n\t\t\tthrow new Error(`The origin path \"${outputPath}\" does not exist.`);\n\t\t}\n\n\t\tconst app = express();\n\t\tconst port = 8080;\n\t\tapp.use(express.static(outputPath));\n\t\tapp.listen(port, () => {\n\t\t\tlogger.info(`Docula is running on http://localhost:${port}`);\n\t\t});\n\t}\n\n\tpublic copyLandingFolder(source: string, target: string): void {\n\t\tconst {sourcePath, targetExists, isDirectory} = this.validateFilePath(source, target);\n\n\t\tif (isDirectory) {\n\t\t\tconst regex = /(search|docs|multipage)+/gi;\n\t\t\tif (regex.test(source)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!targetExists) {\n\t\t\t\tfs.mkdirSync(target);\n\t\t\t}\n\n\t\t\tfor (const file of fs.readdirSync(sourcePath)) {\n\t\t\t\tif (!fs.existsSync(path.join(target, file))) {\n\t\t\t\t\tthis.copyLandingFolder(path.join(source, file), path.join(target, file));\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (!fs.existsSync(target)) {\n\t\t\tconst isExcepted = this.landingFilesExceptions.some(file => source.includes(file));\n\t\t\tif (isExcepted) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tfs.copyFileSync(sourcePath, target);\n\t\t}\n\t}\n\n\tpublic copyFolder(source: string, target: string): void {\n\t\tconst {sourcePath, targetExists, isDirectory} = this.validateFilePath(source, target);\n\n\t\tif (isDirectory) {\n\t\t\t// Exclude the search folder\n\t\t\tif (source.includes('search') || source.includes('landing')) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!targetExists) {\n\t\t\t\tfs.mkdirSync(target);\n\t\t\t}\n\n\t\t\tfor (const file of fs.readdirSync(sourcePath)) {\n\t\t\t\tif (!fs.existsSync(path.join(target, file))) {\n\t\t\t\t\tthis.copyFolder(path.join(source, file), path.join(target, file));\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (!fs.existsSync(target)) {\n\t\t\t// Exclude the search-index file\n\t\t\tif (source.includes('search-index.md') || source.includes('releases')) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tfs.copyFileSync(sourcePath, target);\n\t\t}\n\t}\n\n\tcopySearchEngineFiles(): void {\n\t\tconst {searchEngine, originPath} = this.config;\n\t\tconst __filename = getFileName();\n\t\tconst doculaPath = path.dirname(path.dirname(path.dirname(__filename)));\n\t\tconst sourcePath = path.join(doculaPath, `init/_includes/search/${searchEngine}.njk`);\n\t\tconst searchPath = path.join(process.cwd(), `${originPath}/_includes/search`);\n\t\tconst targetPath = path.join(process.cwd(), `${originPath}/_includes/search/${searchEngine}.njk`);\n\t\tconst searchStylesPath = path.join(process.cwd(), `${originPath}/_includes/assets/css/styles/search`);\n\t\tconst sourceSearchStylesPath = path.join(doculaPath, `init/_includes/assets/css/styles/search/${searchEngine}.css`);\n\t\tconst searchStylesTargetPath = path.join(process.cwd(), `${originPath}/_includes/assets/css/styles/search/${searchEngine}.css`);\n\n\t\tif (!fs.existsSync(searchPath)) {\n\t\t\tfs.mkdirSync(searchPath);\n\t\t}\n\n\t\tif (!fs.existsSync(targetPath)) {\n\t\t\tfs.copyFileSync(sourcePath, targetPath);\n\t\t}\n\n\t\t// Copy search styles\n\t\tif (!fs.existsSync(searchStylesPath)) {\n\t\t\tfs.mkdirSync(searchStylesPath);\n\t\t}\n\n\t\tif (!fs.existsSync(searchStylesTargetPath)) {\n\t\t\tfs.copyFileSync(sourceSearchStylesPath, searchStylesTargetPath);\n\t\t}\n\n\t\tif (searchEngine === 'algolia') {\n\t\t\tconst indexSource = path.join(doculaPath, 'init/search-index.md');\n\t\t\tconst indexTarget = path.join(process.cwd(), `${originPath}/search-index.md`);\n\n\t\t\tif (!fs.existsSync(indexTarget)) {\n\t\t\t\tfs.copyFileSync(indexSource, indexTarget);\n\t\t\t}\n\t\t}\n\t}\n\n\tasync writeConfigFile(sitePath?: string): Promise<Record<string, unknown>> {\n\t\tconst plugins = await setPlugins();\n\t\tfor (const plugin in plugins) {\n\t\t\tif (Object.prototype.hasOwnProperty.call(plugins, plugin)) {\n\t\t\t\t// @ts-expect-error fix later\n\t\t\t\tthis.config[plugin] = plugins[plugin];\n\t\t\t}\n\t\t}\n\n\t\tconst originPath = getSitePath();\n\t\tconst configPath = getConfigPath();\n\n\t\tconst rootSitePath = sitePath ? path.join(process.cwd(), sitePath) : originPath;\n\n\t\t// Create the <site> folder\n\t\tif (!fs.existsSync(rootSitePath)) {\n\t\t\tfs.mkdirSync(rootSitePath);\n\t\t}\n\n\t\tfs.writeFileSync(configPath, JSON.stringify(plugins, null, 2));\n\t\treturn plugins;\n\t}\n\n\tvalidateFilePath(source: string, target: string): Record<string, any> {\n\t\tconst __filename = getFileName();\n\t\tconst doculaPath = path.dirname(path.dirname(path.dirname(__filename)));\n\t\tconst sourcePath = path.join(doculaPath, source);\n\t\tconst sourceExists = fs.existsSync(sourcePath);\n\t\tconst targetExists = fs.existsSync(target);\n\t\tconst sourceStats = fs.statSync(sourcePath);\n\t\tconst isDirectory = sourceExists && sourceStats.isDirectory();\n\n\t\treturn {\n\t\t\tsourcePath,\n\t\t\tsourceExists,\n\t\t\ttargetExists,\n\t\t\tisDirectory,\n\t\t};\n\t}\n\n\tprivate loadPlugins(): void {\n\t\tconst {plugins} = this.config;\n\n\t\tfor (const plugin of plugins) {\n\t\t\tconst pluginClass = DoculaPlugins[plugin];\n\t\t\t// eslint-disable-next-line new-cap\n\t\t\tconst pluginInstance = new pluginClass(this.config);\n\t\t\tthis.pluginInstances[plugin] = pluginInstance;\n\n\t\t\tconst {runtime} = pluginInstance;\n\t\t\tif (runtime === 'before') {\n\t\t\t\tthis.beforePlugins.push(pluginInstance);\n\t\t\t} else if (runtime === 'after') {\n\t\t\t\tthis.afterPlugins.push(pluginInstance);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate readonly executePlugins = async (plugins: PluginInstance[]): Promise<void> => {\n\t\tawait Promise.all(plugins.map(async plugin => plugin.execute()));\n\t};\n}\n\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"filters.d.ts","sourceRoot":"","sources":["../../src/eleventy/filters.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,SAAU,MAAM,KAAG,MAU7C,CAAC"}
|
package/dist/eleventy/filters.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export const squashCallback = (text) => {
|
|
2
|
-
const content = text.toString().toLowerCase();
|
|
3
|
-
// Remove duplicated words
|
|
4
|
-
const words = content.split(' ');
|
|
5
|
-
const deduped = [...(new Set(words))];
|
|
6
|
-
const dedupedString = deduped.join(' ');
|
|
7
|
-
// Remove repeated spaces
|
|
8
|
-
return dedupedString.replaceAll(/ {2,}/g, ' ');
|
|
9
|
-
};
|
|
10
|
-
//# sourceMappingURL=filters.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"filters.js","sourceRoot":"","sources":["../../src/eleventy/filters.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,IAAY,EAAU,EAAE;IACtD,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,WAAW,EAAE,CAAC;IAE9C,0BAA0B;IAC1B,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACjC,MAAM,OAAO,GAAG,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACtC,MAAM,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAExC,yBAAyB;IACzB,OAAO,aAAa,CAAC,UAAU,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;AAChD,CAAC,CAAC","sourcesContent":["export const squashCallback = (text: string): string => {\n\tconst content = text.toString().toLowerCase();\n\n\t// Remove duplicated words\n\tconst words = content.split(' ');\n\tconst deduped = [...(new Set(words))];\n\tconst dedupedString = deduped.join(' ');\n\n\t// Remove repeated spaces\n\treturn dedupedString.replaceAll(/ {2,}/g, ' ');\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"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"}
|
|
@@ -1 +0,0 @@
|
|
|
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","sourcesContent":["import {type Config} from '../config.js';\n\nexport const getConfig = (config: Config): Config => config;\n\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { DateTime } from 'luxon';
|
|
2
|
-
import MarkdownIt from 'markdown-it';
|
|
3
|
-
export const getYear = () => DateTime.local().toUTC().toFormat('yyyy');
|
|
4
|
-
export const formatDate = (format, date) => {
|
|
5
|
-
if (date) {
|
|
6
|
-
return DateTime.fromISO(date).toUTC().toFormat(format);
|
|
7
|
-
}
|
|
8
|
-
return DateTime.now().toUTC().toFormat(format);
|
|
9
|
-
};
|
|
10
|
-
export const parseRelease = (content) => {
|
|
11
|
-
const md = new MarkdownIt({
|
|
12
|
-
html: true,
|
|
13
|
-
linkify: true,
|
|
14
|
-
typographer: true,
|
|
15
|
-
});
|
|
16
|
-
return md.render(content);
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=shortcodes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,CAAC;QACV,OAAO,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACxD,CAAC;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","sourcesContent":["import {DateTime} from 'luxon';\nimport MarkdownIt from 'markdown-it';\n\nexport const getYear = (): string => DateTime.local().toUTC().toFormat('yyyy');\n\nexport const formatDate = (format: string, date?: string): string => {\n\tif (date) {\n\t\treturn DateTime.fromISO(date).toUTC().toFormat(format);\n\t}\n\n\treturn DateTime.now().toUTC().toFormat(format);\n};\n\nexport const parseRelease = (content: string) => {\n\tconst md = new MarkdownIt({\n\t\thtml: true,\n\t\tlinkify: true,\n\t\ttypographer: true,\n\t});\n\treturn md.render(content);\n};\n"]}
|
package/dist/eleventy.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { Config } from './config.js';
|
|
2
|
-
type ElevJSONOutput = {
|
|
3
|
-
url: string;
|
|
4
|
-
inputPath: string;
|
|
5
|
-
outputPath: string;
|
|
6
|
-
content: string;
|
|
7
|
-
};
|
|
8
|
-
export declare class Eleventy {
|
|
9
|
-
private readonly _config;
|
|
10
|
-
private readonly eleventyConfig;
|
|
11
|
-
private readonly eleventy;
|
|
12
|
-
get config(): Config;
|
|
13
|
-
constructor(config: Config);
|
|
14
|
-
build(): Promise<void>;
|
|
15
|
-
toJSON(): Promise<ElevJSONOutput[]>;
|
|
16
|
-
private addPassthroughCopy;
|
|
17
|
-
private setLibrary;
|
|
18
|
-
private addPlugin;
|
|
19
|
-
private addShortcode;
|
|
20
|
-
private addFilter;
|
|
21
|
-
private addGlobalData;
|
|
22
|
-
}
|
|
23
|
-
export {};
|
|
24
|
-
//# sourceMappingURL=eleventy.d.ts.map
|
package/dist/eleventy.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"eleventy.d.ts","sourceRoot":"","sources":["../src/eleventy.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAgCxC,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;IA2Bb,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
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
// @ts-expect-error - 11ty doesn't have types
|
|
2
|
-
import * as pkg from '@11ty/eleventy';
|
|
3
|
-
// @ts-expect-error - 11ty doesn't have types
|
|
4
|
-
import eleventyNavigationPlugin from '@11ty/eleventy-navigation';
|
|
5
|
-
// @ts-expect-error - 11ty doesn't have types
|
|
6
|
-
import pluginTOC from 'eleventy-plugin-toc';
|
|
7
|
-
import markdownIt from 'markdown-it';
|
|
8
|
-
import markdownItAnchor from 'markdown-it-anchor';
|
|
9
|
-
import { squashCallback } from './eleventy/filters.js';
|
|
10
|
-
import { getYear, formatDate, parseRelease } from './eleventy/shortcodes.js';
|
|
11
|
-
import { getConfig } from './eleventy/global-data.js';
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
13
|
-
const Elev = pkg.default;
|
|
14
|
-
export class Eleventy {
|
|
15
|
-
_config;
|
|
16
|
-
eleventyConfig;
|
|
17
|
-
eleventy;
|
|
18
|
-
get config() {
|
|
19
|
-
return this._config;
|
|
20
|
-
}
|
|
21
|
-
constructor(config) {
|
|
22
|
-
this._config = config;
|
|
23
|
-
this.eleventyConfig = {
|
|
24
|
-
quietMode: true,
|
|
25
|
-
config: (eleventyConfig) => {
|
|
26
|
-
eleventyConfig.ignores.add(`./${this.config.originPath}/README.md`);
|
|
27
|
-
this.addPassthroughCopy(eleventyConfig);
|
|
28
|
-
this.setLibrary(eleventyConfig);
|
|
29
|
-
this.addPlugin(eleventyConfig);
|
|
30
|
-
this.addShortcode(eleventyConfig);
|
|
31
|
-
this.addFilter(eleventyConfig);
|
|
32
|
-
this.addGlobalData(eleventyConfig);
|
|
33
|
-
eleventyConfig.setTemplateFormats(['njk', 'md', 'html']);
|
|
34
|
-
return {
|
|
35
|
-
markdownTemplateEngine: 'njk',
|
|
36
|
-
htmlTemplateEngine: 'njk',
|
|
37
|
-
passthroughFileCopy: true,
|
|
38
|
-
};
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
this.eleventy = new Elev(this.config.originPath, this.config.outputPath, this.eleventyConfig);
|
|
42
|
-
}
|
|
43
|
-
async build() {
|
|
44
|
-
try {
|
|
45
|
-
await this.eleventy.write();
|
|
46
|
-
}
|
|
47
|
-
catch (error) {
|
|
48
|
-
throw new Error(`Eleventy build failed: ${error.message}`);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
52
|
-
async toJSON() {
|
|
53
|
-
const json = await this.eleventy.toJSON();
|
|
54
|
-
return json.filter((element) => element.url);
|
|
55
|
-
}
|
|
56
|
-
addPassthroughCopy(eleventyConfig) {
|
|
57
|
-
const assetsPath = `${this.config.originPath}/_includes/assets`;
|
|
58
|
-
eleventyConfig.addPassthroughCopy({ [assetsPath]: '/assets/' });
|
|
59
|
-
}
|
|
60
|
-
setLibrary(eleventyConfig) {
|
|
61
|
-
eleventyConfig.setLibrary('md', markdownIt().use(markdownItAnchor));
|
|
62
|
-
}
|
|
63
|
-
addPlugin(eleventyConfig) {
|
|
64
|
-
eleventyConfig.addPlugin(eleventyNavigationPlugin);
|
|
65
|
-
eleventyConfig.addPlugin(pluginTOC, {
|
|
66
|
-
tags: ['h2'],
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
addShortcode(eleventyConfig) {
|
|
70
|
-
eleventyConfig.addShortcode('year', getYear);
|
|
71
|
-
eleventyConfig.addShortcode('formatDate', formatDate);
|
|
72
|
-
eleventyConfig.addShortcode('parseRelease', parseRelease);
|
|
73
|
-
}
|
|
74
|
-
addFilter(eleventyConfig) {
|
|
75
|
-
eleventyConfig.addFilter('squash', squashCallback);
|
|
76
|
-
}
|
|
77
|
-
addGlobalData(eleventyConfig) {
|
|
78
|
-
// EleventyConfig.addGlobalData('algoliaKeys', () => algoliaKeys(this.config));
|
|
79
|
-
eleventyConfig.addGlobalData('config', () => getConfig(this.config));
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
//# sourceMappingURL=eleventy.js.map
|
package/dist/eleventy.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"eleventy.js","sourceRoot":"","sources":["../src/eleventy.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAC;AACtC,6CAA6C;AAC7C,OAAO,wBAAwB,MAAM,2BAA2B,CAAC;AACj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AA0B;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","sourcesContent":["// @ts-expect-error - 11ty doesn't have types\nimport * as pkg from '@11ty/eleventy';\n// @ts-expect-error - 11ty doesn't have types\nimport eleventyNavigationPlugin from '@11ty/eleventy-navigation';\n// @ts-expect-error - 11ty doesn't have types\nimport pluginTOC from 'eleventy-plugin-toc';\nimport markdownIt from 'markdown-it';\nimport markdownItAnchor from 'markdown-it-anchor';\nimport type {Config} from './config.js';\nimport {squashCallback} from './eleventy/filters.js';\nimport {getYear, formatDate, parseRelease} from './eleventy/shortcodes.js';\nimport {getConfig} from './eleventy/global-data.js';\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nconst Elev = pkg.default;\n\ntype ElevConfig = {\n\tignores: {\n\t\tadd: (pattern: string) => void;\n\t};\n\taddPassthroughCopy: (options: Record<string, unknown>) => void;\n\tsetLibrary: (name: string, library: unknown) => void;\n\taddPlugin: (plugin: any, options?: Record<string, unknown>) => void;\n\taddShortcode: (name: string, callback: (...args: any[]) => unknown) => void;\n\taddFilter: (name: string, callback: (text: string) => string) => void;\n\tsetTemplateFormats(strings: string[]): void;\n\taddGlobalData(name: string, config: () => unknown): void;\n};\n\ntype ElevInterface = {\n\tconstructor: (originPath: string, outputPath: string, config: {\n\t\tquietMode?: boolean;\n\t\tconfig: (config: ElevConfig) => Record<string, unknown>;\n\t}) => void;\n\twrite: () => Promise<void>;\n\t// eslint-disable-next-line @typescript-eslint/naming-convention\n\ttoJSON: () => Promise<ElevJSONOutput[]>;\n};\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\ntype ElevJSONOutput = {\n\turl: string;\n\tinputPath: string;\n\toutputPath: string;\n\tcontent: string;\n};\n\nexport class Eleventy {\n\tprivate readonly _config: Config;\n\tprivate readonly eleventyConfig: {quietMode: boolean; config: (eleventyConfig: ElevConfig) => {htmlTemplateEngine: string; passthroughFileCopy: boolean; markdownTemplateEngine: string}};\n\tprivate readonly eleventy: ElevInterface;\n\tget config(): Config {\n\t\treturn this._config;\n\t}\n\n\tconstructor(config: Config) {\n\t\tthis._config = config;\n\t\tthis.eleventyConfig = {\n\t\t\tquietMode: true,\n\t\t\tconfig: (eleventyConfig: ElevConfig) => {\n\t\t\t\televentyConfig.ignores.add(`./${this.config.originPath}/README.md`);\n\n\t\t\t\tthis.addPassthroughCopy(eleventyConfig);\n\t\t\t\tthis.setLibrary(eleventyConfig);\n\t\t\t\tthis.addPlugin(eleventyConfig);\n\t\t\t\tthis.addShortcode(eleventyConfig);\n\t\t\t\tthis.addFilter(eleventyConfig);\n\t\t\t\tthis.addGlobalData(eleventyConfig);\n\n\t\t\t\televentyConfig.setTemplateFormats(['njk', 'md', 'html']);\n\n\t\t\t\treturn {\n\t\t\t\t\tmarkdownTemplateEngine: 'njk',\n\t\t\t\t\thtmlTemplateEngine: 'njk',\n\t\t\t\t\tpassthroughFileCopy: true,\n\t\t\t\t};\n\t\t\t},\n\t\t};\n\n\t\tthis.eleventy = new Elev(this.config.originPath, this.config.outputPath, this.eleventyConfig);\n\t}\n\n\tpublic async build() {\n\t\ttry {\n\t\t\tawait this.eleventy.write();\n\t\t} catch (error: unknown) {\n\t\t\tthrow new Error(`Eleventy build failed: ${(error as Error).message}`);\n\t\t}\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/naming-convention\n\tpublic async toJSON() {\n\t\tconst json: ElevJSONOutput[] = await this.eleventy.toJSON();\n\t\treturn json.filter((element: ElevJSONOutput) => element.url);\n\t}\n\n\tprivate addPassthroughCopy(eleventyConfig: ElevConfig) {\n\t\tconst assetsPath = `${this.config.originPath}/_includes/assets`;\n\t\televentyConfig.addPassthroughCopy({[assetsPath]: '/assets/'});\n\t}\n\n\tprivate setLibrary(eleventyConfig: ElevConfig) {\n\t\televentyConfig.setLibrary(\n\t\t\t'md',\n\t\t\tmarkdownIt().use(markdownItAnchor),\n\t\t);\n\t}\n\n\tprivate addPlugin(eleventyConfig: ElevConfig) {\n\t\televentyConfig.addPlugin(eleventyNavigationPlugin);\n\t\televentyConfig.addPlugin(pluginTOC, {\n\t\t\ttags: ['h2'],\n\t\t});\n\t}\n\n\tprivate addShortcode(eleventyConfig: ElevConfig) {\n\t\televentyConfig.addShortcode('year', getYear);\n\t\televentyConfig.addShortcode('formatDate', formatDate);\n\t\televentyConfig.addShortcode('parseRelease', parseRelease);\n\t}\n\n\tprivate addFilter(eleventyConfig: ElevConfig) {\n\t\televentyConfig.addFilter('squash', squashCallback);\n\t}\n\n\tprivate addGlobalData(eleventyConfig: ElevConfig) {\n\t\t// EleventyConfig.addGlobalData('algoliaKeys', () => algoliaKeys(this.config));\n\t\televentyConfig.addGlobalData('config', () => getConfig(this.config));\n\t}\n}\n"]}
|
package/dist/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
import { type OptionValues } from 'commander';
|
|
3
|
-
export type CommanderOptions = {
|
|
4
|
-
opts: () => OptionValues;
|
|
5
|
-
};
|
|
6
|
-
export declare class Executable {
|
|
7
|
-
parseCLI(process: NodeJS.Process): Promise<void>;
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAgB,KAAK,YAAY,EAAC,MAAM,WAAW,CAAC;AAK3D,MAAM,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAE,MAAM,YAAY,CAAC;CACzB,CAAC;AAEF,qBAAa,UAAU;IAEhB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO;CA6DtC"}
|
package/dist/index.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { createCommand } from 'commander';
|
|
2
|
-
import { Docula } from './docula.js';
|
|
3
|
-
import { reportError } from './tools/tools.js';
|
|
4
|
-
import logger from './logger.js';
|
|
5
|
-
export class Executable {
|
|
6
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
7
|
-
async parseCLI(process) {
|
|
8
|
-
const program = createCommand();
|
|
9
|
-
program.storeOptionsAsProperties(true);
|
|
10
|
-
program.command('build', { isDefault: true })
|
|
11
|
-
.description('Build the site')
|
|
12
|
-
.option('-c, --config <config>', 'Path of where the config file is located')
|
|
13
|
-
.action(async (options) => {
|
|
14
|
-
try {
|
|
15
|
-
logger.info('Building your documentation...');
|
|
16
|
-
const docula = new Docula(options);
|
|
17
|
-
await docula.build();
|
|
18
|
-
logger.info('Site was built successfully!');
|
|
19
|
-
}
|
|
20
|
-
catch (error) {
|
|
21
|
-
reportError(error);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
program.command('build2')
|
|
25
|
-
.description('Build the site with ecto')
|
|
26
|
-
.option('-c, --config <config>', 'Path of where the config file is located')
|
|
27
|
-
.action(async (options) => {
|
|
28
|
-
try {
|
|
29
|
-
logger.info('Building your documentation...');
|
|
30
|
-
const docula = new Docula(options);
|
|
31
|
-
await docula.build2();
|
|
32
|
-
logger.info('Site was built successfully!');
|
|
33
|
-
}
|
|
34
|
-
catch (error) {
|
|
35
|
-
reportError(error);
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
program.command('init')
|
|
39
|
-
.description('Initialize the site')
|
|
40
|
-
.action(async (options) => {
|
|
41
|
-
try {
|
|
42
|
-
logger.info('Initializing Docula...');
|
|
43
|
-
const docula = new Docula(options);
|
|
44
|
-
await docula.init();
|
|
45
|
-
}
|
|
46
|
-
catch (error) {
|
|
47
|
-
reportError(error);
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
program.command('serve')
|
|
51
|
-
.description('build and serve the site')
|
|
52
|
-
.action(async (options) => {
|
|
53
|
-
try {
|
|
54
|
-
logger.info('Building your documentation...');
|
|
55
|
-
const docula = new Docula(options);
|
|
56
|
-
await docula.build();
|
|
57
|
-
logger.info('Site was built successfully!');
|
|
58
|
-
await docula.serve();
|
|
59
|
-
}
|
|
60
|
-
catch (error) {
|
|
61
|
-
reportError(error);
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
program.parse(process.argv);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAoB,MAAM,WAAW,CAAC;AAC3D,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AACnC,OAAO,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAC7C,OAAO,MAAM,MAAM,aAAa,CAAC;AAMjC,MAAM,OAAO,UAAU;IACtB,gEAAgE;IAChE,KAAK,CAAC,QAAQ,CAAC,OAAuB;QACrC,MAAM,OAAO,GAAG,aAAa,EAAE,CAAC;QAEhC,OAAO,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC;QAEvC,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,EAAC,SAAS,EAAE,IAAI,EAAC,CAAC;aACzC,WAAW,CAAC,gBAAgB,CAAC;aAC7B,MAAM,CAAC,uBAAuB,EAAE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rB,CAAC;YAAC,OAAO,KAAc,EAAE,CAAC;gBACzB,WAAW,CAAC,KAAK,CAAC,CAAC;YACpB,CAAC;QACF,CAAC,CAAC,CAAC;QAEJ,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC;aACtB,WAAW,CAAC,0BAA0B,CAAC;aACvC,MAAM,CAAC,KAAK,EAAE,OAAyB,EAAE,EAAE;YAC3C,IAAI,CAAC;gBACJ,MAAM,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;gBAC9C,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;gBACnC,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;gBACrB,MAAM,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;gBAC5C,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;YACtB,CAAC;YAAC,OAAO,KAAc,EAAE,CAAC;gBACzB,WAAW,CAAC,KAAK,CAAC,CAAC;YACpB,CAAC;QACF,CAAC,CAAC,CAAC;QAEJ,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;CACD","sourcesContent":["import {createCommand, type OptionValues} from 'commander';\nimport {Docula} from './docula.js';\nimport {reportError} from './tools/tools.js';\nimport logger from './logger.js';\n\nexport type CommanderOptions = {\n\topts: () => OptionValues;\n};\n\nexport class Executable {\n\t// eslint-disable-next-line @typescript-eslint/naming-convention\n\tasync parseCLI(process: NodeJS.Process) {\n\t\tconst program = createCommand();\n\n\t\tprogram.storeOptionsAsProperties(true);\n\n\t\tprogram.command('build', {isDefault: true})\n\t\t\t.description('Build the site')\n\t\t\t.option('-c, --config <config>', 'Path of where the config file is located')\n\t\t\t.action(async (options: CommanderOptions) => {\n\t\t\t\ttry {\n\t\t\t\t\tlogger.info('Building your documentation...');\n\t\t\t\t\tconst docula = new Docula(options);\n\t\t\t\t\tawait docula.build();\n\t\t\t\t\tlogger.info('Site was built successfully!');\n\t\t\t\t} catch (error: unknown) {\n\t\t\t\t\treportError(error);\n\t\t\t\t}\n\t\t\t});\n\n\t\tprogram.command('build2')\n\t\t\t.description('Build the site with ecto')\n\t\t\t.option('-c, --config <config>', 'Path of where the config file is located')\n\t\t\t.action(async (options: CommanderOptions) => {\n\t\t\t\ttry {\n\t\t\t\t\tlogger.info('Building your documentation...');\n\t\t\t\t\tconst docula = new Docula(options);\n\t\t\t\t\tawait docula.build2();\n\t\t\t\t\tlogger.info('Site was built successfully!');\n\t\t\t\t} catch (error: unknown) {\n\t\t\t\t\treportError(error);\n\t\t\t\t}\n\t\t\t});\n\n\t\tprogram.command('init')\n\t\t\t.description('Initialize the site')\n\t\t\t.action(async (options: CommanderOptions) => {\n\t\t\t\ttry {\n\t\t\t\t\tlogger.info('Initializing Docula...');\n\t\t\t\t\tconst docula = new Docula(options);\n\t\t\t\t\tawait docula.init();\n\t\t\t\t} catch (error: unknown) {\n\t\t\t\t\treportError(error);\n\t\t\t\t}\n\t\t\t});\n\n\t\tprogram.command('serve')\n\t\t\t.description('build and serve the site')\n\t\t\t.action(async (options: CommanderOptions) => {\n\t\t\t\ttry {\n\t\t\t\t\tlogger.info('Building your documentation...');\n\t\t\t\t\tconst docula = new Docula(options);\n\t\t\t\t\tawait docula.build();\n\t\t\t\t\tlogger.info('Site was built successfully!');\n\t\t\t\t\tawait docula.serve();\n\t\t\t\t} catch (error: unknown) {\n\t\t\t\t\treportError(error);\n\t\t\t\t}\n\t\t\t});\n\n\t\tprogram.parse(process.argv);\n\t}\n}\n"]}
|
package/dist/logger.d.ts
DELETED
package/dist/logger.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAU9B,QAAA,MAAM,MAAM,gBAaV,CAAC;AAEH,eAAe,MAAM,CAAC"}
|
package/dist/logger.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import winston from 'winston';
|
|
2
|
-
const logFormat = winston.format.printf(({ level, message }) => {
|
|
3
|
-
if (level === 'error') {
|
|
4
|
-
return `[Docula] Error: ${message}`;
|
|
5
|
-
}
|
|
6
|
-
return `[Docula] ${message}`;
|
|
7
|
-
});
|
|
8
|
-
const logger = winston.createLogger({
|
|
9
|
-
level: 'info',
|
|
10
|
-
format: winston.format.json(),
|
|
11
|
-
transports: [
|
|
12
|
-
new winston.transports.Console({
|
|
13
|
-
format: winston.format.combine(logFormat, winston.format.colorize({
|
|
14
|
-
all: true,
|
|
15
|
-
})),
|
|
16
|
-
}),
|
|
17
|
-
],
|
|
18
|
-
});
|
|
19
|
-
export default logger;
|
|
20
|
-
//# sourceMappingURL=logger.js.map
|
package/dist/logger.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAC,KAAK,EAAE,OAAO,EAAyB,EAAE,EAAE;IACpF,IAAI,KAAK,KAAK,OAAO,EAAE,CAAC;QACvB,OAAO,mBAAmB,OAAO,EAAE,CAAC;IACrC,CAAC;IAED,OAAO,YAAY,OAAO,EAAE,CAAC;AAC9B,CAAC,CAAC,CAAC;AAEH,MAAM,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IACnC,KAAK,EAAE,MAAM;IACb,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE;IAC7B,UAAU,EAAE;QACX,IAAI,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC;YAC9B,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,CAC7B,SAAS,EACT,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC;gBACvB,GAAG,EAAE,IAAI;aACT,CAAC,CACF;SACD,CAAC;KACF;CACD,CAAC,CAAC;AAEH,eAAe,MAAM,CAAC","sourcesContent":["import winston from 'winston';\n\nconst logFormat = winston.format.printf(({level, message}: Record<string, string>) => {\n\tif (level === 'error') {\n\t\treturn `[Docula] Error: ${message}`;\n\t}\n\n\treturn `[Docula] ${message}`;\n});\n\nconst logger = winston.createLogger({\n\tlevel: 'info',\n\tformat: winston.format.json(),\n\ttransports: [\n\t\tnew winston.transports.Console({\n\t\t\tformat: winston.format.combine(\n\t\t\t\tlogFormat,\n\t\t\t\twinston.format.colorize({\n\t\t\t\t\tall: true,\n\t\t\t\t}),\n\t\t\t),\n\t\t}),\n\t],\n});\n\nexport default logger;\n"]}
|
|
@@ -1,21 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/plugins/algolia.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import process from 'node:process';
|
|
2
|
-
import algoliasearch from 'algoliasearch';
|
|
3
|
-
import fs from 'fs-extra';
|
|
4
|
-
export class AlgoliaPlugin {
|
|
5
|
-
static schema = {
|
|
6
|
-
type: 'object',
|
|
7
|
-
required: ['apiKey', 'appId', 'indexName'],
|
|
8
|
-
properties: {
|
|
9
|
-
apiKey: { type: 'string' },
|
|
10
|
-
appId: { type: 'string' },
|
|
11
|
-
indexName: { type: 'string' },
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
options = {
|
|
15
|
-
apiKey: '',
|
|
16
|
-
appId: '',
|
|
17
|
-
indexName: '',
|
|
18
|
-
outputPath: '',
|
|
19
|
-
};
|
|
20
|
-
runtime = 'after';
|
|
21
|
-
client;
|
|
22
|
-
constructor(config) {
|
|
23
|
-
const { appId, apiKey, indexName } = config.pluginConfig.algolia;
|
|
24
|
-
this.options.outputPath = config.outputPath;
|
|
25
|
-
this.options.appId = appId;
|
|
26
|
-
this.options.apiKey = apiKey;
|
|
27
|
-
this.options.indexName = indexName;
|
|
28
|
-
// @ts-expect-error - algoliasearch is not callable
|
|
29
|
-
this.client = algoliasearch(this.options.appId, this.options.apiKey);
|
|
30
|
-
this.options.index = this.client.initIndex(this.options.indexName);
|
|
31
|
-
}
|
|
32
|
-
async execute() {
|
|
33
|
-
let jsonContent = [];
|
|
34
|
-
const jsonPath = `${process.cwd()}/${this.options.outputPath}/algolia.json`;
|
|
35
|
-
if (fs.existsSync(jsonPath)) {
|
|
36
|
-
const data = fs.readFileSync(jsonPath, 'utf8');
|
|
37
|
-
const content = JSON.parse(data);
|
|
38
|
-
jsonContent = content.filter(item => item.description.length);
|
|
39
|
-
}
|
|
40
|
-
try {
|
|
41
|
-
// @ts-expect-error - clearObjects
|
|
42
|
-
await this.options.index.clearObjects();
|
|
43
|
-
// @ts-expect-error - saveObjects
|
|
44
|
-
await this.options.index.saveObjects(jsonContent, {
|
|
45
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
46
|
-
autoGenerateObjectIDIfNotExist: true,
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
catch (error) {
|
|
50
|
-
throw new Error(`Error while indexing to Algolia: ${error.message}`);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=algolia.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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;IACzB,MAAM,CAAC,MAAM,GAAW;QACvB,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,WAAW,CAAC;QAC1C,UAA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AC,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;QAC/D,CAAC;QAED,IAAI,CAAC;YACJ,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;QACJ,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,oCAAqC,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;QACjF,CAAC;IACF,CAAC","sourcesContent":["import process from 'node:process';\nimport algoliasearch, {type SearchClient, type SearchIndex} from 'algoliasearch';\nimport fs from 'fs-extra';\nimport type {Config} from '../config.js';\nimport type {DoculaPlugin, Options, Schema, Runtime} from '../docula-plugin.js';\n\nexport type AlgoliaConfig = {\n\tapiKey: string;\n\tappId: string;\n\tindexName: string;\n};\n\ntype SearchOptions = {\n\tindex?: SearchIndex;\n} & Options;\n\nexport class AlgoliaPlugin implements DoculaPlugin {\n\tstatic schema: Schema = {\n\t\ttype: 'object',\n\t\trequired: ['apiKey', 'appId', 'indexName'],\n\t\tproperties: {\n\t\t\tapiKey: {type: 'string'},\n\t\t\tappId: {type: 'string'},\n\t\t\tindexName: {type: 'string'},\n\t\t},\n\t};\n\n\treadonly options: SearchOptions = {\n\t\tapiKey: '',\n\t\tappId: '',\n\t\tindexName: '',\n\t\toutputPath: '',\n\t};\n\n\truntime: Runtime = 'after';\n\treadonly client: SearchClient;\n\n\tconstructor(config: Config) {\n\t\tconst {appId, apiKey, indexName} = config.pluginConfig.algolia as AlgoliaConfig;\n\t\tthis.options.outputPath = config.outputPath;\n\t\tthis.options.appId = appId;\n\t\tthis.options.apiKey = apiKey;\n\t\tthis.options.indexName = indexName;\n\t\t// @ts-expect-error - algoliasearch is not callable\n\t\tthis.client = algoliasearch(this.options.appId, this.options.apiKey);\n\t\tthis.options.index = this.client.initIndex(this.options.indexName);\n\t}\n\n\tasync execute(): Promise<void> {\n\t\tlet jsonContent: Array<Record<string, string>> = [];\n\t\tconst jsonPath = `${process.cwd()}/${this.options.outputPath}/algolia.json`;\n\t\tif (fs.existsSync(jsonPath)) {\n\t\t\tconst data = fs.readFileSync(jsonPath, 'utf8');\n\t\t\tconst content: Array<Record<string, string>> = JSON.parse(data);\n\t\t\tjsonContent = content.filter(item => item.description.length);\n\t\t}\n\n\t\ttry {\n\t\t\t// @ts-expect-error - clearObjects\n\t\t\tawait this.options.index.clearObjects();\n\t\t\t// @ts-expect-error - saveObjects\n\t\t\tawait this.options.index.saveObjects(jsonContent, {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/naming-convention\n\t\t\t\tautoGenerateObjectIDIfNotExist: true,\n\t\t\t});\n\t\t} catch (error: unknown) {\n\t\t\tthrow new Error(`Error while indexing to Algolia: ${(error as Error).message}`);\n\t\t}\n\t}\n}\n\n"]}
|
package/dist/plugins/github.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { DoculaPlugin, Options, Schema, Runtime } from '../docula-plugin.js';
|
|
2
|
-
import type { Config } from '../config.js';
|
|
3
|
-
export type GithubConfig = {
|
|
4
|
-
repo: string;
|
|
5
|
-
author: string;
|
|
6
|
-
};
|
|
7
|
-
export declare class GithubPlugin implements DoculaPlugin {
|
|
8
|
-
static schema: Schema;
|
|
9
|
-
readonly options: Options;
|
|
10
|
-
runtime: Runtime;
|
|
11
|
-
constructor(config: Config);
|
|
12
|
-
execute(): Promise<void>;
|
|
13
|
-
getReleases(): Promise<any>;
|
|
14
|
-
getContributors(): Promise<any>;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=github.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../src/plugins/github.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAC,MAAM,qBAAqB,CAAC;AAChF,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AAEzC,MAAM,MAAM,YAAY,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,qBAAa,YAAa,YAAW,YAAY;IAChD,MAAM,CAAC,MAAM,EAAE,MAAM,CAOnB;IAEF,QAAQ,CAAC,OAAO,EAAE,OAAO,CAOvB;IAEF,OAAO,EAAE,OAAO,CAAY;gBAEhB,MAAM,EAAE,MAAM;IAOpB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAaxB,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC;IAe3B,eAAe,IAAI,OAAO,CAAC,GAAG,CAAC;CAcrC"}
|