docula 0.3.0 → 0.3.2

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.
Files changed (94) hide show
  1. package/README.md +2 -3
  2. package/package.json +15 -14
  3. package/dist/config.d.ts +0 -21
  4. package/dist/config.d.ts.map +0 -1
  5. package/dist/config.js +0 -78
  6. package/dist/config.js.map +0 -1
  7. package/dist/docula-plugin.d.ts +0 -9
  8. package/dist/docula-plugin.d.ts.map +0 -1
  9. package/dist/docula-plugin.js +0 -2
  10. package/dist/docula-plugin.js.map +0 -1
  11. package/dist/docula.d.ts +0 -22
  12. package/dist/docula.d.ts.map +0 -1
  13. package/dist/docula.js +0 -188
  14. package/dist/docula.js.map +0 -1
  15. package/dist/eleventy/filters.d.ts +0 -2
  16. package/dist/eleventy/filters.d.ts.map +0 -1
  17. package/dist/eleventy/filters.js +0 -10
  18. package/dist/eleventy/filters.js.map +0 -1
  19. package/dist/eleventy/global-data.d.ts +0 -3
  20. package/dist/eleventy/global-data.d.ts.map +0 -1
  21. package/dist/eleventy/global-data.js +0 -2
  22. package/dist/eleventy/global-data.js.map +0 -1
  23. package/dist/eleventy/shortcodes.d.ts +0 -4
  24. package/dist/eleventy/shortcodes.d.ts.map +0 -1
  25. package/dist/eleventy/shortcodes.js +0 -18
  26. package/dist/eleventy/shortcodes.js.map +0 -1
  27. package/dist/eleventy.d.ts +0 -24
  28. package/dist/eleventy.d.ts.map +0 -1
  29. package/dist/eleventy.js +0 -80
  30. package/dist/eleventy.js.map +0 -1
  31. package/dist/index.d.ts +0 -9
  32. package/dist/index.d.ts.map +0 -1
  33. package/dist/index.js +0 -53
  34. package/dist/index.js.map +0 -1
  35. package/dist/logger.d.ts +0 -4
  36. package/dist/logger.d.ts.map +0 -1
  37. package/dist/logger.js +0 -20
  38. package/dist/logger.js.map +0 -1
  39. package/dist/plugins/algolia.d.ts +0 -21
  40. package/dist/plugins/algolia.d.ts.map +0 -1
  41. package/dist/plugins/algolia.js +0 -54
  42. package/dist/plugins/algolia.js.map +0 -1
  43. package/dist/plugins/github.d.ts +0 -16
  44. package/dist/plugins/github.d.ts.map +0 -1
  45. package/dist/plugins/github.js +0 -69
  46. package/dist/plugins/github.js.map +0 -1
  47. package/dist/plugins/index.d.ts +0 -18
  48. package/dist/plugins/index.d.ts.map +0 -1
  49. package/dist/plugins/index.js +0 -16
  50. package/dist/plugins/index.js.map +0 -1
  51. package/dist/plugins/npm.d.ts +0 -14
  52. package/dist/plugins/npm.d.ts.map +0 -1
  53. package/dist/plugins/npm.js +0 -37
  54. package/dist/plugins/npm.js.map +0 -1
  55. package/dist/plugins/pagefind.d.ts +0 -10
  56. package/dist/plugins/pagefind.d.ts.map +0 -1
  57. package/dist/plugins/pagefind.js +0 -23
  58. package/dist/plugins/pagefind.js.map +0 -1
  59. package/dist/plugins/robots.d.ts +0 -14
  60. package/dist/plugins/robots.d.ts.map +0 -1
  61. package/dist/plugins/robots.js +0 -35
  62. package/dist/plugins/robots.js.map +0 -1
  63. package/dist/plugins/sitemap.d.ts +0 -11
  64. package/dist/plugins/sitemap.d.ts.map +0 -1
  65. package/dist/plugins/sitemap.js +0 -27
  66. package/dist/plugins/sitemap.js.map +0 -1
  67. package/dist/schemas.d.ts +0 -21
  68. package/dist/schemas.d.ts.map +0 -1
  69. package/dist/schemas.js +0 -25
  70. package/dist/schemas.js.map +0 -1
  71. package/dist/tools/__mocks__/inquirer-prompt.d.ts +0 -20
  72. package/dist/tools/__mocks__/inquirer-prompt.d.ts.map +0 -1
  73. package/dist/tools/__mocks__/inquirer-prompt.js +0 -19
  74. package/dist/tools/__mocks__/inquirer-prompt.js.map +0 -1
  75. package/dist/tools/__mocks__/path.d.ts +0 -4
  76. package/dist/tools/__mocks__/path.d.ts.map +0 -1
  77. package/dist/tools/__mocks__/path.js +0 -5
  78. package/dist/tools/__mocks__/path.js.map +0 -1
  79. package/dist/tools/inquirer-prompt.d.ts +0 -11
  80. package/dist/tools/inquirer-prompt.d.ts.map +0 -1
  81. package/dist/tools/inquirer-prompt.js +0 -139
  82. package/dist/tools/inquirer-prompt.js.map +0 -1
  83. package/dist/tools/path.d.ts +0 -3
  84. package/dist/tools/path.d.ts.map +0 -1
  85. package/dist/tools/path.js +0 -5
  86. package/dist/tools/path.js.map +0 -1
  87. package/dist/tools/tools.d.ts +0 -3
  88. package/dist/tools/tools.d.ts.map +0 -1
  89. package/dist/tools/tools.js +0 -10
  90. package/dist/tools/tools.js.map +0 -1
  91. package/dist/types/config.d.ts +0 -8
  92. package/dist/types/config.d.ts.map +0 -1
  93. package/dist/types/config.js +0 -2
  94. package/dist/types/config.js.map +0 -1
package/README.md CHANGED
@@ -10,12 +10,11 @@
10
10
 
11
11
  ## Features
12
12
 
13
- - Zero Config - Just drop it in and it works
13
+ - Zero Config - no config needed
14
14
  - Can run from `npx` or installed globally
15
15
  - Knowledge Base that is easy to setup and manage
16
16
  - Beautiful and Responsive Design (Like Stripe or 11ty)
17
- - Search Engine Optimized
18
- - Search Engine Plugin (Algolia) and local search by default.
17
+ - Search Engine Optimized and Plugin (Algolia) and local search by default.
19
18
  - Convention over Configuration - just add your files, use a template (or build your own) and you're done.
20
19
  - Will generate a sitemap.xml
21
20
  - Will generate a robots.txt
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docula",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Open Source Static Site Generator",
5
5
  "exports": "./dist/docula.js",
6
6
  "types": "./dist/docula.d.ts",
@@ -44,36 +44,36 @@
44
44
  "@types/express": "^4.17.17",
45
45
  "@types/fs-extra": "^11.0.1",
46
46
  "@types/inquirer": "^9.0.3",
47
- "@types/jest": "^29.5.1",
47
+ "@types/jest": "^29.5.3",
48
48
  "@types/luxon": "^3.3.0",
49
- "jest": "^29.5.0",
49
+ "jest": "^29.6.1",
50
50
  "jest-ts-webcompat-resolver": "^1.0.0",
51
- "ts-jest": "^29.1.0",
51
+ "ts-jest": "^29.1.1",
52
52
  "ts-jest-resolver": "^2.0.1",
53
- "typescript": "^5.0.4",
54
- "xo": "^0.54.2"
53
+ "typescript": "^5.1.6",
54
+ "xo": "^0.55.0"
55
55
  },
56
56
  "dependencies": {
57
57
  "@11ty/eleventy": "^1.0.2",
58
58
  "@11ty/eleventy-navigation": "^0.3.5",
59
59
  "@types/markdown-it": "^12.2.3",
60
60
  "ajv": "^8.12.0",
61
- "algoliasearch": "^4.17.0",
61
+ "algoliasearch": "^4.19.0",
62
62
  "axios": "^1.4.0",
63
- "commander": "^10.0.1",
64
- "dayjs": "^1.11.7",
65
- "dotenv": "^16.0.3",
63
+ "commander": "^11.0.0",
64
+ "dayjs": "^1.11.9",
65
+ "dotenv": "^16.3.1",
66
66
  "download-stats": "^0.3.4",
67
67
  "eleventy-plugin-toc": "^1.1.5",
68
68
  "express": "^4.18.2",
69
69
  "fs-extra": "^11.1.1",
70
- "inquirer": "^9.2.5",
71
- "instantsearch.js": "^4.56.0",
70
+ "inquirer": "^9.2.8",
71
+ "instantsearch.js": "^4.56.7",
72
72
  "luxon": "^3.3.0",
73
73
  "markdown-it": "^13.0.1",
74
74
  "markdown-it-anchor": "^8.6.7",
75
75
  "node-fetch": "3.3.1",
76
- "winston": "^3.8.2"
76
+ "winston": "^3.10.0"
77
77
  },
78
78
  "files": [
79
79
  "dist",
@@ -84,7 +84,8 @@
84
84
  "rules": {
85
85
  "@typescript-eslint/no-unsafe-assignment": 0,
86
86
  "@typescript-eslint/no-unsafe-return": 0,
87
- "@typescript-eslint/no-unsafe-argument": 0
87
+ "@typescript-eslint/no-unsafe-argument": 0,
88
+ "@typescript-eslint/no-unsafe-call": 0
88
89
  }
89
90
  },
90
91
  "jest": {
package/dist/config.d.ts DELETED
@@ -1,21 +0,0 @@
1
- import type { PluginConfig, PluginConfigs, PluginName, Plugins } from './types/config.js';
2
- export declare class Config {
3
- originPath: string;
4
- outputPath: string;
5
- dataPath: string;
6
- templatePath: string;
7
- searchEngine: string;
8
- pluginConfig: PluginConfigs;
9
- plugins: Plugins;
10
- imagesPath: string;
11
- assetsPath: string;
12
- siteUrl: string;
13
- siteType: string;
14
- ajv: any;
15
- private readonly schema;
16
- constructor(path?: string);
17
- loadConfig(path: string): void;
18
- loadPlugins(name: PluginName, config: PluginConfig): void;
19
- checkConfigFile(path: string): boolean;
20
- }
21
- //# sourceMappingURL=config.d.ts.map
@@ -1 +0,0 @@
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 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
- constructor(path) {
7
- this.originPath = 'site';
8
- this.outputPath = 'dist';
9
- this.dataPath = 'data';
10
- this.templatePath = 'template';
11
- this.searchEngine = 'pagefind';
12
- // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
13
- this.pluginConfig = {};
14
- this.plugins = [];
15
- this.imagesPath = 'images';
16
- this.assetsPath = 'css';
17
- this.siteUrl = '';
18
- this.siteType = '';
19
- // @ts-expect-error - ajv is not callable
20
- this.ajv = new Ajv();
21
- this.schema = { ...jsonConfigSchema };
22
- this.schema.required = [];
23
- const configPath = path ?? `./${this.originPath}/config.json`;
24
- const configFileExists = this.checkConfigFile(configPath);
25
- if (configFileExists) {
26
- this.loadConfig(configPath);
27
- }
28
- if (path && !configFileExists) {
29
- throw new Error('Config file not found');
30
- }
31
- }
32
- loadConfig(path) {
33
- const data = readFileSync(path, { encoding: 'utf8' });
34
- const jsonConfig = JSON.parse(data);
35
- if (jsonConfig.plugins) {
36
- for (const name of jsonConfig.plugins) {
37
- this.loadPlugins(name, jsonConfig[name]);
38
- }
39
- }
40
- this.schema.required = [...new Set(this.schema.required)];
41
- // eslint-disable-next-line @typescript-eslint/no-unsafe-call
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
@@ -1 +0,0 @@
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;QAC9D,MAAM,gBAAgB,GAAG,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;QAC1D,IAAI,gBAAgB,EAAE;YACrB,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;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<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"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=docula-plugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"docula-plugin.js","sourceRoot":"","sources":["../src/docula-plugin.ts"],"names":[],"mappings":""}
package/dist/docula.d.ts DELETED
@@ -1,22 +0,0 @@
1
- import { Config } from './config.js';
2
- import type { CommanderOptions } from './index.js';
3
- export declare class Docula {
4
- readonly config: Config;
5
- private readonly eleventy;
6
- private pluginInstances;
7
- private readonly beforePlugins;
8
- private readonly afterPlugins;
9
- private readonly landingFilesExceptions;
10
- constructor(options?: CommanderOptions);
11
- init(sitePath?: string): Promise<void>;
12
- build(): Promise<void>;
13
- serve(): Promise<void>;
14
- copyLandingFolder(source: string, target: string): void;
15
- copyFolder(source: string, target: string): void;
16
- copySearchEngineFiles(): void;
17
- writeConfigFile(): Promise<Record<string, unknown>>;
18
- validateFilePath(source: string, target: string): Record<string, any>;
19
- private loadPlugins;
20
- private readonly executePlugins;
21
- }
22
- //# sourceMappingURL=docula.d.ts.map
@@ -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;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 DELETED
@@ -1,188 +0,0 @@
1
- import * as path from 'node:path';
2
- import process from 'node:process';
3
- import fs from 'fs-extra';
4
- import express from 'express';
5
- import { Eleventy } from './eleventy.js';
6
- import { Config } from './config.js';
7
- import { setPlugins } from './tools/inquirer-prompt.js';
8
- import DoculaPlugins from './plugins/index.js';
9
- import { getConfigPath, getFileName } from './tools/path.js';
10
- import logger from './logger.js';
11
- export class Docula {
12
- constructor(options) {
13
- this.pluginInstances = {};
14
- this.beforePlugins = [];
15
- this.afterPlugins = [];
16
- this.landingFilesExceptions = ['search-index.md', 'versions.njk', 'index.njk', 'doc.njk'];
17
- this.executePlugins = async (plugins) => {
18
- await Promise.all(plugins.map(async (plugin) => plugin.execute()));
19
- };
20
- const parameters = options?.opts();
21
- const configPath = getConfigPath();
22
- const config = parameters ? parameters?.config : configPath;
23
- this.config = new Config(config);
24
- this.eleventy = new Eleventy(this.config);
25
- this.loadPlugins();
26
- }
27
- async init(sitePath) {
28
- const config = await this.writeConfigFile();
29
- const { originPath } = this.config;
30
- const rootSitePath = path.join(process.cwd(), sitePath ?? originPath);
31
- // Create the <site> folder
32
- if (!fs.existsSync(rootSitePath)) {
33
- fs.mkdirSync(rootSitePath);
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
- }
42
- }
43
- async build() {
44
- const { originPath } = this.config;
45
- const userOriginPath = `${process.cwd()}/${originPath}`;
46
- if (!fs.existsSync(userOriginPath)) {
47
- throw new Error(`The origin path "${userOriginPath}" does not exist.`);
48
- }
49
- await this.executePlugins(this.beforePlugins);
50
- await this.eleventy.build();
51
- await this.executePlugins(this.afterPlugins);
52
- }
53
- async serve() {
54
- const { outputPath } = this.config;
55
- if (!fs.existsSync(outputPath)) {
56
- throw new Error(`The origin path "${outputPath}" does not exist.`);
57
- }
58
- const app = express();
59
- const port = 8080;
60
- app.use(express.static(outputPath));
61
- app.listen(port, () => {
62
- logger.info(`Docula is running on http://localhost:${port}`);
63
- });
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
- }
89
- copyFolder(source, target) {
90
- const { sourcePath, targetExists, isDirectory } = this.validateFilePath(source, target);
91
- if (isDirectory) {
92
- // Exclude the search folder
93
- if (source.includes('search') || source.includes('landing')) {
94
- return;
95
- }
96
- if (!targetExists) {
97
- fs.mkdirSync(target);
98
- }
99
- for (const file of fs.readdirSync(sourcePath)) {
100
- if (!fs.existsSync(path.join(target, file))) {
101
- this.copyFolder(path.join(source, file), path.join(target, file));
102
- }
103
- }
104
- }
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
- }
110
- fs.copyFileSync(sourcePath, target);
111
- }
112
- }
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];
150
- }
151
- }
152
- const configPath = getConfigPath();
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
- };
170
- }
171
- loadPlugins() {
172
- const { plugins } = this.config;
173
- for (const plugin of plugins) {
174
- const pluginClass = DoculaPlugins[plugin];
175
- // eslint-disable-next-line new-cap
176
- const pluginInstance = new pluginClass(this.config);
177
- this.pluginInstances[plugin] = pluginInstance;
178
- const { runtime } = pluginInstance;
179
- if (runtime === 'before') {
180
- this.beforePlugins.push(pluginInstance);
181
- }
182
- else if (runtime === 'after') {
183
- this.afterPlugins.push(pluginInstance);
184
- }
185
- }
186
- }
187
- }
188
- //# sourceMappingURL=docula.js.map
@@ -1 +0,0 @@
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,EAAC,MAAM,4BAA4B,CAAC;AACtD,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EAAC,aAAa,EAAE,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAC3D,OAAO,MAAM,MAAM,aAAa,CAAC;AAGjC,MAAM,OAAO,MAAM;IASlB,YAAY,OAA0B;QAN9B,oBAAe,GAAoB,EAAE,CAAC;QAE7B,kBAAa,GAAqB,EAAE,CAAC;QACrC,iBAAY,GAAqB,EAAE,CAAC;QACpC,2BAAsB,GAAa,CAAC,iBAAiB,EAAE,cAAc,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;QAuM/F,mBAAc,GAAG,KAAK,EAAE,OAAyB,EAAiB,EAAE;YACpF,MAAM,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAC,MAAM,EAAC,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QAClE,CAAC,CAAC;QAtMD,MAAM,UAAU,GAAG,OAAO,EAAE,IAAI,EAAE,CAAC;QACnC,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;QACnC,MAAM,MAAM,GAAW,UAAU,CAAC,CAAC,CAAC,UAAU,EAAE,MAAM,CA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AAO,KAAK,OAAO,EAAE;gBAC/B,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;aACvC;SACD;IACF,CAAC;CAKD"}
@@ -1,2 +0,0 @@
1
- export declare const squashCallback: (text: string) => string;
2
- //# sourceMappingURL=filters.d.ts.map
@@ -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"}
@@ -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.replace(/ {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,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;AAC7C,CAAC,CAAC"}
@@ -1,3 +0,0 @@
1
- import { type Config } from '../config.js';
2
- export declare const getConfig: (config: Config) => Config;
3
- //# sourceMappingURL=global-data.d.ts.map
@@ -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,2 +0,0 @@
1
- export const getConfig = (config) => config;
2
- //# sourceMappingURL=global-data.js.map
@@ -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"}
@@ -1,4 +0,0 @@
1
- export declare const getYear: () => string;
2
- export declare const formatDate: (format: string, date?: string) => string;
3
- export declare const parseRelease: (content: string) => string;
4
- //# sourceMappingURL=shortcodes.d.ts.map
@@ -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;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"}
@@ -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
@@ -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;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 DELETED
@@ -1,80 +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
- get config() {
16
- return this._config;
17
- }
18
- constructor(config) {
19
- this._config = config;
20
- this.eleventyConfig = {
21
- quietMode: true,
22
- config: (eleventyConfig) => {
23
- eleventyConfig.ignores.add(`./${this.config.originPath}/README.md`);
24
- this.addPassthroughCopy(eleventyConfig);
25
- this.setLibrary(eleventyConfig);
26
- this.addPlugin(eleventyConfig);
27
- this.addShortcode(eleventyConfig);
28
- this.addFilter(eleventyConfig);
29
- this.addGlobalData(eleventyConfig);
30
- eleventyConfig.setTemplateFormats(['njk', 'md', 'html']);
31
- return {
32
- markdownTemplateEngine: 'njk',
33
- htmlTemplateEngine: 'njk',
34
- passthroughFileCopy: true,
35
- };
36
- },
37
- };
38
- // eslint-disable-next-line @typescript-eslint/no-unsafe-call
39
- this.eleventy = new Elev(this.config.originPath, this.config.outputPath, this.eleventyConfig);
40
- }
41
- async build() {
42
- try {
43
- await this.eleventy.write();
44
- }
45
- catch (error) {
46
- throw new Error(`Eleventy build failed: ${error.message}`);
47
- }
48
- }
49
- // eslint-disable-next-line @typescript-eslint/naming-convention
50
- async toJSON() {
51
- const json = await this.eleventy.toJSON();
52
- return json.filter((element) => element.url);
53
- }
54
- addPassthroughCopy(eleventyConfig) {
55
- const assetsPath = `${this.config.originPath}/_includes/assets`;
56
- eleventyConfig.addPassthroughCopy({ [assetsPath]: '/assets/' });
57
- }
58
- setLibrary(eleventyConfig) {
59
- eleventyConfig.setLibrary('md', markdownIt().use(markdownItAnchor));
60
- }
61
- addPlugin(eleventyConfig) {
62
- eleventyConfig.addPlugin(eleventyNavigationPlugin);
63
- eleventyConfig.addPlugin(pluginTOC, {
64
- tags: ['h2'],
65
- });
66
- }
67
- addShortcode(eleventyConfig) {
68
- eleventyConfig.addShortcode('year', getYear);
69
- eleventyConfig.addShortcode('formatDate', formatDate);
70
- eleventyConfig.addShortcode('parseRelease', parseRelease);
71
- }
72
- addFilter(eleventyConfig) {
73
- eleventyConfig.addFilter('squash', squashCallback);
74
- }
75
- addGlobalData(eleventyConfig) {
76
- // EleventyConfig.addGlobalData('algoliaKeys', () => algoliaKeys(this.config));
77
- eleventyConfig.addGlobalData('config', () => getConfig(this.config));
78
-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