docula 0.3.6 → 0.3.7

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 (47) hide show
  1. package/dist/config.js.map +1 -1
  2. package/dist/docula.d.ts +1 -0
  3. package/dist/docula.d.ts.map +1 -1
  4. package/dist/docula.js +10 -0
  5. package/dist/docula.js.map +1 -1
  6. package/dist/eleventy/shortcodes.js.map +1 -1
  7. package/dist/eleventy.js.map +1 -1
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +14 -0
  10. package/dist/index.js.map +1 -1
  11. package/dist/logger.js.map +1 -1
  12. package/dist/plugins/algolia.js.map +1 -1
  13. package/dist/plugins/github.js.map +1 -1
  14. package/dist/plugins/pagefind.js.map +1 -1
  15. package/dist/plugins/robots.js.map +1 -1
  16. package/dist/tools/inquirer-prompt.js.map +1 -1
  17. package/dist/tools/tools.js.map +1 -1
  18. package/package.json +22 -21
  19. package/templates/default/assets/css/highlight/highlight.min.js +1433 -0
  20. package/templates/default/assets/css/highlight/styles/base16/dracula.min.css +7 -0
  21. package/templates/default/assets/css/styles/home.css +305 -0
  22. package/templates/default/assets/css/styles/index.css +912 -0
  23. package/templates/default/assets/css/styles/search/algolia.css +125 -0
  24. package/templates/default/assets/css/styles/search/pagefind.css +60 -0
  25. package/templates/default/assets/css/styles/variables.css +30 -0
  26. package/templates/default/assets/images/docula-logo-horizontal.webp +0 -0
  27. package/templates/default/assets/images/logo.svg +10 -0
  28. package/templates/default/doc.njk +22 -0
  29. package/templates/default/index.njk +28 -0
  30. package/templates/default/landing/landingHero.njk +8 -0
  31. package/templates/default/landing/singlePage.njk +24 -0
  32. package/templates/default/multipage/header.njk +23 -0
  33. package/templates/default/multipage/homeHeader.njk +20 -0
  34. package/templates/default/multipage/main.njk +47 -0
  35. package/templates/default/multipage/scripts.njk +47 -0
  36. package/templates/default/multipage/searchEngine.njk +5 -0
  37. package/templates/default/multipage/searchModal.njk +19 -0
  38. package/templates/default/multipage/sidebar.njk +50 -0
  39. package/templates/default/releases.njk +38 -0
  40. package/templates/default/search/algolia.njk +98 -0
  41. package/templates/default/search/pagefind.njk +66 -0
  42. package/templates/default/search-index.md +14 -0
  43. package/templates/default/shared/footer.njk +4 -0
  44. package/templates/default/shared/head.njk +15 -0
  45. package/templates/default/shared/highlightScript.njk +6 -0
  46. package/templates/default/shared/homeData.njk +49 -0
  47. package/templates/default/versions.njk +40 -0
@@ -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;IAClB,UAAU,GAAG,MAAM,CAAC;IACpB,UAAU,GAAG,MAAM,CAAC;IACpB,QAAQ,GAAG,MAAM,CAAC;IAClB,YAAY,GAAG,UAAU,CAAC;IAC1B,YAAY,GAAG,UAAU,CAAC;IAC1B,0EAA0E;IAC1E,YAAY,GAAkB,EAAmB,CAAC;IAClD,OAAO,GAAY,EAAE,CAAC;IACtB,UAAU,GAAG,QAAQ,CAAC;IACtB,UAAU,GAAG,KAAK,CAAC;IACnB,OAAO,GAAG,EAAE,CAAC;IACb,QAAQ,GAAG,EAAE,CAAC;IACd,yCAAyC;IACzC,GAAG,GAAG,IAAI,GAAG,EAAE,CAAC;IAEC,MAAM,CAAe;IAEtC,YAAY,IAAa;QACxB,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,IA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,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"]}
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;IAClB,UAAU,GAAG,MAAM,CAAC;IACpB,UAAU,GAAG,MAAM,CAAC;IACpB,QAAQ,GAAG,MAAM,CAAC;IAClB,YAAY,GAAG,UAAU,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AAU,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.d.ts CHANGED
@@ -10,6 +10,7 @@ export declare class Docula {
10
10
  constructor(options?: CommanderOptions);
11
11
  init(sitePath?: string): Promise<void>;
12
12
  build(): Promise<void>;
13
+ build2(): Promise<void>;
13
14
  serve(): Promise<void>;
14
15
  copyLandingFolder(source: string, target: string): void;
15
16
  copyFolder(source: string, target: string): void;
@@ -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;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,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAc5B,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IA4BvD,UAAU,CA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B,IAAI,IAAI;IAsCvB,eAAe,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAuB1E,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
@@ -45,6 +45,16 @@ export class Docula {
45
45
  await this.eleventy.build();
46
46
  await this.executePlugins(this.afterPlugins);
47
47
  }
48
+ async build2() {
49
+ const { originPath } = this.config;
50
+ const userOriginPath = `${process.cwd()}/${originPath}`;
51
+ if (!fs.existsSync(userOriginPath)) {
52
+ throw new Error(`The origin path "${userOriginPath}" does not exist.`);
53
+ }
54
+ await this.executePlugins(this.beforePlugins);
55
+ await this.eleventy.build();
56
+ await this.executePlugins(this.afterPlugins);
57
+ }
48
58
  async serve() {
49
59
  const { outputPath } = this.config;
50
60
  if (!fs.existsSync(outputPath)) {
@@ -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,EAAC,MAAM,4BAA4B,CAAC;AACtD,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EAAC,aAAa,EAAE,WAAW,EAAE,WAAW,EAAC,MAAM,iBAAiB,CAAC;AACxE,OAAO,MAAM,MAAM,aAAa,CAAC;AAGj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AC,CAAC;QAC5C,MAAM,WAAW,GAAG,YAAY,IAAI,WAAW,CAAC,WAAW,EAAE,CAAC;QAE9D,OAAO;YACN,UAAU;YACV,YAAY;YACZ,YAAY;YACZ,WAAW;SACX,CAAC;IACH,CAAC;IAEO,WAAW;QAClB,MAAM,EAAC,OAAO,EAAC,GAAG,IAAI,CAAC,MAAM,CAAC;QAE9B,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;YAC7B,MAAM,WAAW,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;YAC1C,mCAAmC;YACnC,MAAM,cAAc,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACpD,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,GAAG,cAAc,CAAC;YAE9C,MAAM,EAAC,OAAO,EAAC,GAAG,cAAc,CAAC;YACjC,IAAI,OAAO,KAAK,QAAQ,EAAE;gBACzB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;aACxC;iBAAM,IAAI,OAAO,KAAK,OAAO,EAAE;gBAC/B,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;aACvC;SACD;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 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
+ {"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;AAC9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ACV,YAAY;YACZ,YAAY;YACZ,WAAW;SACX,CAAC;IACH,CAAC;IAEO,WAAW;QAClB,MAAM,EAAC,OAAO,EAAC,GAAG,IAAI,CAAC,MAAM,CAAC;QAE9B,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC9B,MAAM,WAAW,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;YAC1C,mCAAmC;YACnC,MAAM,cAAc,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACpD,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,GAAG,cAAc,CAAC;YAE9C,MAAM,EAAC,OAAO,EAAC,GAAG,cAAc,CAAC;YACjC,IAAI,OAAO,KAAK,QAAQ,EAAE,CAAC;gBAC1B,IAAI,CAAC,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 +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,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","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"]}
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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"e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AAwB,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","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"]}
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;AACjE,6CAA6C;AAC7C,OAAO,SAAS,MAAM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C,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"]}
@@ -1 +1 @@
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;CA+CtC"}
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 CHANGED
@@ -21,6 +21,20 @@ export class Executable {
21
21
  reportError(error);
22
22
  }
23
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
+ });
24
38
  program.command('init')
25
39
  .description('Initialize the site')
26
40
  .action(async (options) => {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
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,0CAA0C,CAAC;aAC3E,MAAM,CAAC,KAAK,EAAE,OAAyB,EAAE,EAAE;YAC3C,IAAI;gBACH,MAAM,CAAC,IAAI,CAAC,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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('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"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC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ula} 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"]}
@@ -1 +1 @@
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;QACtB,OAAO,mBAAmB,OAAO,EAAE,CAAC;KACpC;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
+ {"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 +1 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AAS,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","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"]}
1
+ {"version":3,"file":"algolia.js","sourceRoot":"","sources":["../../src/plugins/algolia.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OA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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,CAAC;YAC7B,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;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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"github.js","sourceRoot":"","sources":["../../src/plugins/github.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,MAAM,OAAO,YAAY;IACxB,MAAM,CAAC,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C,CAAC;aACrF;YAED,MAAM,KAAK,CAAC;SACZ;IACF,CAAC","sourcesContent":["import fs from 'fs-extra';\nimport axios from 'axios';\nimport type {DoculaPlugin, Options, Schema, Runtime} from '../docula-plugin.js';\nimport type {Config} from '../config.js';\n\nexport type GithubConfig = {\n\trepo: string;\n\tauthor: string;\n};\n\nexport class GithubPlugin implements DoculaPlugin {\n\tstatic schema: Schema = {\n\t\ttype: 'object',\n\t\trequired: ['repo', 'author'],\n\t\tproperties: {\n\t\t\trepo: {type: 'string'},\n\t\t\tauthor: {type: 'string'},\n\t\t},\n\t};\n\n\treadonly options: Options = {\n\t\tapi: 'https://api.github.com',\n\t\tdataPath: '_data',\n\t\tauthor: '',\n\t\trepo: '',\n\t\toutputFile: 'github.json',\n\t\tsitePath: '',\n\t};\n\n\truntime: Runtime = 'before';\n\n\tconstructor(config: Config) {\n\t\tthis.options.sitePath = config.originPath;\n\t\tconst {author, repo} = config.pluginConfig.github as GithubConfig;\n\t\tthis.options.author = author;\n\t\tthis.options.repo = repo;\n\t}\n\n\tasync execute(): Promise<void> {\n\t\tconst data = {\n\t\t\treleases: {},\n\t\t\tcontributors: {},\n\t\t};\n\t\tdata.releases = await this.getReleases();\n\t\tdata.contributors = await this.getContributors();\n\t\tconst path = `${this.options.sitePath}/${this.options.dataPath}`;\n\t\tconst filePath = `${path}/${this.options.outputFile}`;\n\t\tawait fs.ensureDir(path);\n\t\tawait fs.writeFile(filePath, JSON.stringify(data, null, 2));\n\t}\n\n\tasync getReleases(): Promise<any> {\n\t\tconst url = `${this.options.api}/repos/${this.options.author}/${this.options.repo}/releases`;\n\t\ttry {\n\t\t\tconst result = await axios.get(url);\n\t\t\treturn result.data;\n\t\t} catch (error: unknown) {\n\t\t\tconst typedError = error as {response: {status: number}};\n\t\t\tif (typedError.response?.status === 404) {\n\t\t\t\tthrow new Error(`Repository ${this.options.author}/${this.options.repo} not found.`);\n\t\t\t}\n\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tasync getContributors(): Promise<any> {\n\t\tconst url = `${this.options.api}/repos/${this.options.author}/${this.options.repo}/contributors`;\n\t\ttry {\n\t\t\tconst result = await axios.get(url);\n\t\t\treturn result.data;\n\t\t} catch (error: unknown) {\n\t\t\tconst typedError = error as {response: {status: number}};\n\t\t\tif (typedError.response?.status === 404) {\n\t\t\t\tthrow new Error(`Repository ${this.options.author}/${this.options.repo} not found.`);\n\t\t\t}\n\n\t\t\tthrow error;\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"github.js","sourceRoot":"","sources":["../../src/plugins/github.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,MAAM,OAAO,YAAY;IACxB,MAAM,CAAC,MAAM,GAAW;QACvB,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC;QAC5B,UAAU,EAAE;YACX,IAAI,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;YACtB,MAAM,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;SACxB;KACD,CAAC;IAEO,OAAO,GAAY;QAC3B,GAAG,EAAE,wBAAwB;QAC7B,QAAQ,EAAE,OAAO;QACjB,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,EAAE;QACR,UAAU,EAAE,aAAa;QACzB,QAAQ,EAAE,EAAE;KACZ,CAAC;IAEF,OAAO,GAAY,QAAQ,CAAC;IAE5B,YAAY,MAAc;QACzB,IAAI,CAAC,OAAO,CAAC,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC;QAC1C,MAAM,EAAC,MAAM,EAAE,IAAI,EAAC,GAAG,MAAM,CAAC,YAAY,CAAC,MAAsB,CAAC;QAClE,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;QAC7B,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,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,KAAK,CAAC,eAAe;QACpB,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,UAAU,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,eAAe,CAAC;QACjG,IAAI,CAAC;YACJ,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACpC,OAAO,MAAM,CAAC,IAAI,CAAC;QACpB,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACzB,MAAM,UAAU,GAAG,KAAqC,CAAC;YACzD,IAAI,UAAU,CAAC,QAAQ,EAAE,MAAM,KAAK,GAAG,EAAE,CAAC;gBACzC,MAAM,IAAI,KAAK,CAAC,cAAc,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,aAAa,CAAC,CAAC;YACtF,CAAC;YAED,MAAM,KAAK,CAAC;QACb,CAAC;IACF,CAAC","sourcesContent":["import fs from 'fs-extra';\nimport axios from 'axios';\nimport type {DoculaPlugin, Options, Schema, Runtime} from '../docula-plugin.js';\nimport type {Config} from '../config.js';\n\nexport type GithubConfig = {\n\trepo: string;\n\tauthor: string;\n};\n\nexport class GithubPlugin implements DoculaPlugin {\n\tstatic schema: Schema = {\n\t\ttype: 'object',\n\t\trequired: ['repo', 'author'],\n\t\tproperties: {\n\t\t\trepo: {type: 'string'},\n\t\t\tauthor: {type: 'string'},\n\t\t},\n\t};\n\n\treadonly options: Options = {\n\t\tapi: 'https://api.github.com',\n\t\tdataPath: '_data',\n\t\tauthor: '',\n\t\trepo: '',\n\t\toutputFile: 'github.json',\n\t\tsitePath: '',\n\t};\n\n\truntime: Runtime = 'before';\n\n\tconstructor(config: Config) {\n\t\tthis.options.sitePath = config.originPath;\n\t\tconst {author, repo} = config.pluginConfig.github as GithubConfig;\n\t\tthis.options.author = author;\n\t\tthis.options.repo = repo;\n\t}\n\n\tasync execute(): Promise<void> {\n\t\tconst data = {\n\t\t\treleases: {},\n\t\t\tcontributors: {},\n\t\t};\n\t\tdata.releases = await this.getReleases();\n\t\tdata.contributors = await this.getContributors();\n\t\tconst path = `${this.options.sitePath}/${this.options.dataPath}`;\n\t\tconst filePath = `${path}/${this.options.outputFile}`;\n\t\tawait fs.ensureDir(path);\n\t\tawait fs.writeFile(filePath, JSON.stringify(data, null, 2));\n\t}\n\n\tasync getReleases(): Promise<any> {\n\t\tconst url = `${this.options.api}/repos/${this.options.author}/${this.options.repo}/releases`;\n\t\ttry {\n\t\t\tconst result = await axios.get(url);\n\t\t\treturn result.data;\n\t\t} catch (error: unknown) {\n\t\t\tconst typedError = error as {response: {status: number}};\n\t\t\tif (typedError.response?.status === 404) {\n\t\t\t\tthrow new Error(`Repository ${this.options.author}/${this.options.repo} not found.`);\n\t\t\t}\n\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tasync getContributors(): Promise<any> {\n\t\tconst url = `${this.options.api}/repos/${this.options.author}/${this.options.repo}/contributors`;\n\t\ttry {\n\t\t\tconst result = await axios.get(url);\n\t\t\treturn result.data;\n\t\t} catch (error: unknown) {\n\t\t\tconst typedError = error as {response: {status: number}};\n\t\t\tif (typedError.response?.status === 404) {\n\t\t\t\tthrow new Error(`Repository ${this.options.author}/${this.options.repo} not found.`);\n\t\t\t}\n\n\t\t\tthrow error;\n\t\t}\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"pagefind.js","sourceRoot":"","sources":["../../src/plugins/pagefind.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,oBAAoB,CAAC;AAIxC,MAAM,OAAO,cAAc;IAC1B,MAAM,CAAC,MAAM,GAAW,EAAE,CAAC;IAElB,OAAO,GAAY;QAC3B,UAAU,EAAE,EAAE;KACd,CAAC;IAEF,OAAO,GAAY,OAAO,CAAC;IAE3B,YAAY,MAAc;QACzB,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,OAAO;QACZ,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,IAAI,CAAC,yBAAyB,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,KAAU,EAAE,MAAW,EAAE,EAAE;gBACpF,IAAI,KAAK,EAAE;oBACV,MAAM,CAAC,KAAK,CAAC,CAAC;iBACd;gBAED,OAAO,CAAC,MAAM,CAAC,CAAC;YACjB,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC","sourcesContent":["import {exec} from 'node:child_process';\nimport type {DoculaPlugin, Options, Schema, Runtime} from '../docula-plugin.js';\nimport type {Config} from '../config.js';\n\nexport class PagefindPlugin implements DoculaPlugin {\n\tstatic schema: Schema = {};\n\n\treadonly options: Options = {\n\t\toutputPath: '',\n\t};\n\n\truntime: Runtime = 'after';\n\n\tconstructor(config: Config) {\n\t\tthis.options.outputPath = config.outputPath;\n\t}\n\n\tasync execute(): Promise<void> {\n\t\tawait new Promise((resolve, reject) => {\n\t\t\texec(`npx pagefind --source ${this.options.outputPath}`, (error: any, stdout: any) => {\n\t\t\t\tif (error) {\n\t\t\t\t\treject(error);\n\t\t\t\t}\n\n\t\t\t\tresolve(stdout);\n\t\t\t});\n\t\t});\n\t}\n}\n"]}
1
+ {"version":3,"file":"pagefind.js","sourceRoot":"","sources":["../../src/plugins/pagefind.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,oBAAoB,CAAC;AAIxC,MAAM,OAAO,cAAc;IAC1B,MAAM,CAAC,MAAM,GAAW,EAAE,CAAC;IAElB,OAAO,GAAY;QAC3B,UAAU,EAAE,EAAE;KACd,CAAC;IAEF,OAAO,GAAY,OAAO,CAAC;IAE3B,YAAY,MAAc;QACzB,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,OAAO;QACZ,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,IAAI,CAAC,yBAAyB,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,KAAU,EAAE,MAAW,EAAE,EAAE;gBACpF,IAAI,KAAK,EAAE,CAAC;oBACX,MAAM,CAAC,KAAK,CAAC,CAAC;gBACf,CAAC;gBAED,OAAO,CAAC,MAAM,CAAC,CAAC;YACjB,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC","sourcesContent":["import {exec} from 'node:child_process';\nimport type {DoculaPlugin, Options, Schema, Runtime} from '../docula-plugin.js';\nimport type {Config} from '../config.js';\n\nexport class PagefindPlugin implements DoculaPlugin {\n\tstatic schema: Schema = {};\n\n\treadonly options: Options = {\n\t\toutputPath: '',\n\t};\n\n\truntime: Runtime = 'after';\n\n\tconstructor(config: Config) {\n\t\tthis.options.outputPath = config.outputPath;\n\t}\n\n\tasync execute(): Promise<void> {\n\t\tawait new Promise((resolve, reject) => {\n\t\t\texec(`npx pagefind --source ${this.options.outputPath}`, (error: any, stdout: any) => {\n\t\t\t\tif (error) {\n\t\t\t\t\treject(error);\n\t\t\t\t}\n\n\t\t\t\tresolve(stdout);\n\t\t\t});\n\t\t});\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"robots.js","sourceRoot":"","sources":["../../src/plugins/robots.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAC;AAS1B,MAAM,OAAO,YAAY;IACxB,MAAM,CAAC,MAAM,GAAW;QACvB,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACX,UAAU,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;YAC5B,aAAa,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;SAC/B;KACD,CAAC;IAEO,OAAO,GAAY;QAC3B,WAAW,EAAE,aAAa;QAC1B,UAAU,EAAE,YAAY;KACxB,CAAC;IAEF,OAAO,GAAY,OAAO,CAAC;IAE3B,YAAY,MAAc;QACzB,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;QAC5C,MAAM,EAAC,UAAU,EAAE,aAAa,EAAC,GAAG,MAAM,CAAC,YAAY,CAAC,MAAiC,IAAI,EAAE,CAAC;QAChG,IAAI,UAAU,EAAE;YACf,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,UAAU,CAAC;SACrC;QAED,IAAI,aAAa,EAAE;YAClB,IAAI,CAAC,OAAO,CAAC,aAAa,GAAG,aAAa,CAAC;SAC3C;IACF,CAAC;IAED,KAAK,CAAC,OAAO;QACZ,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACrF,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,aAAa,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAEjG,MAAM,IAAI,GAAG,mBAAmB,SAAS,MAAM,YAAY,eAAe,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;QACrG,MAAM,QAAQ,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;QACzE,MAAM,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAC5C,MAAM,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IACpC,CAAC","sourcesContent":["import fs from 'fs-extra';\nimport type {DoculaPlugin, Options, Runtime, Schema} from '../docula-plugin.js';\nimport type {Config} from '../config.js';\n\nexport type RobotsConfig = {\n\tallowedUrl: string;\n\tdisallowedUrl: string;\n};\n\nexport class RobotsPlugin implements DoculaPlugin {\n\tstatic schema: Schema = {\n\t\ttype: 'object',\n\t\tproperties: {\n\t\t\tallowedUrl: {type: 'string'},\n\t\t\tdisallowedUrl: {type: 'string'},\n\t\t},\n\t};\n\n\treadonly options: Options = {\n\t\tsitemapPath: 'sitemap.xml',\n\t\toutputFile: 'robots.txt',\n\t};\n\n\truntime: Runtime = 'after';\n\n\tconstructor(config: Config) {\n\t\tthis.options.outputPath = config.outputPath;\n\t\tconst {allowedUrl, disallowedUrl} = config.pluginConfig.robots as unknown as RobotsConfig || {};\n\t\tif (allowedUrl) {\n\t\t\tthis.options.allowedUrl = allowedUrl;\n\t\t}\n\n\t\tif (disallowedUrl)\t{\n\t\t\tthis.options.disallowedUrl = disallowedUrl;\n\t\t}\n\t}\n\n\tasync execute(): Promise<void> {\n\t\tconst isAllowed = this.options.allowedUrl ? `Allow: ${this.options.allowedUrl}` : '';\n\t\tconst isDisallowed = this.options.disallowedUrl ? `Disallow: ${this.options.disallowedUrl}` : '';\n\n\t\tconst data = `User-agent: * \\n${isAllowed} \\n${isDisallowed} \\nSitemap: ${this.options.sitemapPath}`;\n\t\tconst filePath = `${this.options.outputPath}/${this.options.outputFile}`;\n\t\tawait fs.ensureDir(this.options.outputPath);\n\t\tawait fs.writeFile(filePath, data);\n\t}\n}\n"]}
1
+ {"version":3,"file":"robots.js","sourceRoot":"","sources":["../../src/plugins/robots.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAC;AAS1B,MAAM,OAAO,YAAY;IACxB,MAAM,CAAC,MAAM,GAAW;QACvB,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACX,UAAU,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;YAC5B,aAAa,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;SAC/B;KACD,CAAC;IAEO,OAAO,GAAY;QAC3B,WAAW,EAAE,aAAa;QAC1B,UAAU,EAAE,YAAY;KACxB,CAAC;IAEF,OAAO,GAAY,OAAO,CAAC;IAE3B,YAAY,MAAc;QACzB,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;QAC5C,MAAM,EAAC,UAAU,EAAE,aAAa,EAAC,GAAG,MAAM,CAAC,YAAY,CAAC,MAAiC,IAAI,EAAE,CAAC;QAChG,IAAI,UAAU,EAAE,CAAC;YAChB,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,UAAU,CAAC;QACtC,CAAC;QAED,IAAI,aAAa,EAAE,CAAC;YACnB,IAAI,CAAC,OAAO,CAAC,aAAa,GAAG,aAAa,CAAC;QAC5C,CAAC;IACF,CAAC;IAED,KAAK,CAAC,OAAO;QACZ,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACrF,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,aAAa,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAEjG,MAAM,IAAI,GAAG,mBAAmB,SAAS,MAAM,YAAY,eAAe,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;QACrG,MAAM,QAAQ,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;QACzE,MAAM,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAC5C,MAAM,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IACpC,CAAC","sourcesContent":["import fs from 'fs-extra';\nimport type {DoculaPlugin, Options, Runtime, Schema} from '../docula-plugin.js';\nimport type {Config} from '../config.js';\n\nexport type RobotsConfig = {\n\tallowedUrl: string;\n\tdisallowedUrl: string;\n};\n\nexport class RobotsPlugin implements DoculaPlugin {\n\tstatic schema: Schema = {\n\t\ttype: 'object',\n\t\tproperties: {\n\t\t\tallowedUrl: {type: 'string'},\n\t\t\tdisallowedUrl: {type: 'string'},\n\t\t},\n\t};\n\n\treadonly options: Options = {\n\t\tsitemapPath: 'sitemap.xml',\n\t\toutputFile: 'robots.txt',\n\t};\n\n\truntime: Runtime = 'after';\n\n\tconstructor(config: Config) {\n\t\tthis.options.outputPath = config.outputPath;\n\t\tconst {allowedUrl, disallowedUrl} = config.pluginConfig.robots as unknown as RobotsConfig || {};\n\t\tif (allowedUrl) {\n\t\t\tthis.options.allowedUrl = allowedUrl;\n\t\t}\n\n\t\tif (disallowedUrl)\t{\n\t\t\tthis.options.disallowedUrl = disallowedUrl;\n\t\t}\n\t}\n\n\tasync execute(): Promise<void> {\n\t\tconst isAllowed = this.options.allowedUrl ? `Allow: ${this.options.allowedUrl}` : '';\n\t\tconst isDisallowed = this.options.disallowedUrl ? `Disallow: ${this.options.disallowedUrl}` : '';\n\n\t\tconst data = `User-agent: * \\n${isAllowed} \\n${isDisallowed} \\nSitemap: ${this.options.sitemapPath}`;\n\t\tconst filePath = `${this.options.outputPath}/${this.options.outputFile}`;\n\t\tawait fs.ensureDir(this.options.outputPath);\n\t\tawait fs.writeFile(filePath, data);\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"inquirer-prompt.js","sourceRoot":"","sources":["../../src/tools/inquirer-prompt.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEpC,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,IAAqC,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC;IACzF;QACC,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,+BAA+B;KACxC,EAAE;QACF,IAAI,EAAE,OAAO;QACb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AC,QAAQ,EAAE,GAAG,MAAM,EAAC,CAAC;AAC9B,CAAC,CAAC","sourcesContent":["import inquirer from 'inquirer';\nimport {urlRegex} from './tools.js';\n\nexport const getGithubInfo = async (): Promise<Record<string, string>> => inquirer.prompt([\n\t{\n\t\ttype: 'input',\n\t\tname: 'author',\n\t\tmessage: 'What is your GitHub username?',\n\t}, {\n\t\ttype: 'input',\n\t\tname: 'repo',\n\t\tmessage: 'What is your GitHub repository\\'s name?',\n\t},\n]);\n\nexport const validateUrl = (value: string): boolean | string => {\n\tconst trimmed = value.trim();\n\tif (trimmed.length > 0 && urlRegex.test(trimmed)) {\n\t\treturn true;\n\t}\n\n\treturn 'Please enter a complete URL.';\n};\n\nexport const getSiteUrl = async (): Promise<string> => {\n\tconst siteAnswer = await inquirer.prompt([\n\t\t{\n\t\t\ttype: 'input',\n\t\t\tname: 'url',\n\t\t\tmessage: 'What is the URL of your site?',\n\t\t\tvalidate: validateUrl,\n\t\t},\n\t]);\n\treturn siteAnswer.url;\n};\n\nexport const getUserPlugins = async (): Promise<string[]> => {\n\tconst userPlugins = await inquirer.prompt([\n\t\t{\n\t\t\ttype: 'checkbox',\n\t\t\tname: 'plugins',\n\t\t\tmessage: 'Select the plugins you want to use',\n\t\t\tchoices: [\n\t\t\t\t{\n\t\t\t\t\tname: 'github',\n\t\t\t\t\tvalue: 'github',\n\t\t\t\t}, {\n\t\t\t\t\tname: 'robots.txt',\n\t\t\t\t\tvalue: 'robots',\n\t\t\t\t}, {\n\t\t\t\t\tname: 'sitemap.xml',\n\t\t\t\t\tvalue: 'sitemap',\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t]);\n\treturn userPlugins.plugins;\n};\n\nexport const getSearchEngine = async (): Promise<'algolia' | 'pagefind'> => {\n\tconst searchEngine = await inquirer.prompt([\n\t\t{\n\t\t\ttype: 'list',\n\t\t\tname: 'engine',\n\t\t\tmessage: 'Which search engine do you want to use?',\n\t\t\tchoices: ['Algolia', 'Pagefind'],\n\t\t\tdefault: 'Pagefind',\n\t\t\tfilter(value: string): string {\n\t\t\t\treturn value.toLowerCase();\n\t\t\t},\n\t\t},\n\t]);\n\treturn searchEngine.engine;\n};\n\nexport const getAlgoliaInfo = async (): Promise<Record<string, string>> => inquirer.prompt([\n\t{\n\t\ttype: 'input',\n\t\tname: 'appId',\n\t\tmessage: 'What is your Algolia application ID?',\n\t},\n\t{\n\t\ttype: 'input',\n\t\tname: 'apiKey',\n\t\tmessage: 'What is your Algolia API key?',\n\t},\n\t{\n\t\ttype: 'input',\n\t\tname: 'indexName',\n\t\tmessage: 'What is your Algolia index name?',\n\t},\n]);\n\nexport const getSiteType = async (): Promise<'landing' | 'multipage'> => {\n\tconst siteType = await inquirer.prompt([\n\t\t{\n\t\t\ttype: 'list',\n\t\t\tname: 'type',\n\t\t\tmessage: 'What type of site do you want to build?',\n\t\t\tchoices: ['Landing', 'Multi page'],\n\t\t\tdefault: 'Multi page',\n\t\t\tfilter(value: string): string {\n\t\t\t\treturn value.toLowerCase();\n\t\t\t},\n\t\t},\n\t]);\n\treturn siteType.type;\n};\n\nexport const buildLandingPage = async (): Promise<Record<string, unknown>> => {\n\tlet githubInfo: Record<string, string> | undefined;\n\tconst siteUrl = await getSiteUrl();\n\tconst plugins = await getUserPlugins();\n\n\tif (plugins.includes('github')) {\n\t\tgithubInfo = await getGithubInfo();\n\t}\n\n\treturn {\n\t\tsiteUrl,\n\t\tplugins,\n\t\t...(githubInfo && {github: githubInfo}),\n\t};\n};\n\nexport const buildMultipageSite = async (): Promise<Record<string, unknown>> => {\n\tlet githubInfo: Record<string, string> | undefined;\n\tlet algoliaInfo: Record<string, string> | undefined;\n\tconst siteUrl = await getSiteUrl();\n\tconst searchEngine = await getSearchEngine();\n\tconst plugins = await getUserPlugins();\n\n\tif (searchEngine === 'algolia') {\n\t\talgoliaInfo = await getAlgoliaInfo();\n\t}\n\n\tif (plugins.includes('github')) {\n\t\tgithubInfo = await getGithubInfo();\n\t}\n\n\treturn {\n\t\tsiteUrl,\n\t\tsearchEngine,\n\t\tplugins: [...plugins, searchEngine],\n\t\t...(githubInfo && {github: githubInfo}),\n\t\t...(algoliaInfo && {algolia: algoliaInfo}),\n\t};\n};\n\nexport const setPlugins = async (): Promise<Record<string, unknown>> => {\n\tconst siteType = await getSiteType();\n\tconst config = await (siteType.includes('landing') ? buildLandingPage() : buildMultipageSite());\n\n\treturn {siteType, ...config};\n};\n"]}
1
+ {"version":3,"file":"inquirer-prompt.js","sourceRoot":"","sources":["../../src/tools/inquirer-prompt.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEpC,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,IAAqC,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC;IACzF;QACC,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,+BAA+B;KACxC,EAAE;QACF,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,yCAAyC;KAClD;CACD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAa,EAAoB,EAAE;IAC9D,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7B,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QAClD,OAAO,IAAI,CAAC;IACb,CAAC;IAED,OAAO,8BAA8B,CAAC;AACvC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,IAAqB,EAAE;IACrD,MAAM,UAAU,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;QACxC;YACC,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,KAAK;YACX,OAAO,EAAE,+BAA+B;YACxC,QAAQ,EAAE,WAAW;SACrB;KACD,CAAC,C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AW,GAAG,MAAM,cAAc,EAAE,CAAC;IACtC,CAAC;IAED,IAAI,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QAChC,UAAU,GAAG,MAAM,aAAa,EAAE,CAAC;IACpC,CAAC;IAED,OAAO;QACN,OAAO;QACP,YAAY;QACZ,OAAO,EAAE,CAAC,GAAG,OAAO,EAAE,YAAY,CAAC;QACnC,GAAG,CAAC,UAAU,IAAI,EAAC,MAAM,EAAE,UAAU,EAAC,CAAC;QACvC,GAAG,CAAC,WAAW,IAAI,EAAC,OAAO,EAAE,WAAW,EAAC,CAAC;KAC1C,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,IAAsC,EAAE;IACtE,MAAM,QAAQ,GAAG,MAAM,WAAW,EAAE,CAAC;IACrC,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,kBAAkB,EAAE,CAAC,CAAC;IAEhG,OAAO,EAAC,QAAQ,EAAE,GAAG,MAAM,EAAC,CAAC;AAC9B,CAAC,CAAC","sourcesContent":["import inquirer from 'inquirer';\nimport {urlRegex} from './tools.js';\n\nexport const getGithubInfo = async (): Promise<Record<string, string>> => inquirer.prompt([\n\t{\n\t\ttype: 'input',\n\t\tname: 'author',\n\t\tmessage: 'What is your GitHub username?',\n\t}, {\n\t\ttype: 'input',\n\t\tname: 'repo',\n\t\tmessage: 'What is your GitHub repository\\'s name?',\n\t},\n]);\n\nexport const validateUrl = (value: string): boolean | string => {\n\tconst trimmed = value.trim();\n\tif (trimmed.length > 0 && urlRegex.test(trimmed)) {\n\t\treturn true;\n\t}\n\n\treturn 'Please enter a complete URL.';\n};\n\nexport const getSiteUrl = async (): Promise<string> => {\n\tconst siteAnswer = await inquirer.prompt([\n\t\t{\n\t\t\ttype: 'input',\n\t\t\tname: 'url',\n\t\t\tmessage: 'What is the URL of your site?',\n\t\t\tvalidate: validateUrl,\n\t\t},\n\t]);\n\treturn siteAnswer.url;\n};\n\nexport const getUserPlugins = async (): Promise<string[]> => {\n\tconst userPlugins = await inquirer.prompt([\n\t\t{\n\t\t\ttype: 'checkbox',\n\t\t\tname: 'plugins',\n\t\t\tmessage: 'Select the plugins you want to use',\n\t\t\tchoices: [\n\t\t\t\t{\n\t\t\t\t\tname: 'github',\n\t\t\t\t\tvalue: 'github',\n\t\t\t\t}, {\n\t\t\t\t\tname: 'robots.txt',\n\t\t\t\t\tvalue: 'robots',\n\t\t\t\t}, {\n\t\t\t\t\tname: 'sitemap.xml',\n\t\t\t\t\tvalue: 'sitemap',\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t]);\n\treturn userPlugins.plugins;\n};\n\nexport const getSearchEngine = async (): Promise<'algolia' | 'pagefind'> => {\n\tconst searchEngine = await inquirer.prompt([\n\t\t{\n\t\t\ttype: 'list',\n\t\t\tname: 'engine',\n\t\t\tmessage: 'Which search engine do you want to use?',\n\t\t\tchoices: ['Algolia', 'Pagefind'],\n\t\t\tdefault: 'Pagefind',\n\t\t\tfilter(value: string): string {\n\t\t\t\treturn value.toLowerCase();\n\t\t\t},\n\t\t},\n\t]);\n\treturn searchEngine.engine;\n};\n\nexport const getAlgoliaInfo = async (): Promise<Record<string, string>> => inquirer.prompt([\n\t{\n\t\ttype: 'input',\n\t\tname: 'appId',\n\t\tmessage: 'What is your Algolia application ID?',\n\t},\n\t{\n\t\ttype: 'input',\n\t\tname: 'apiKey',\n\t\tmessage: 'What is your Algolia API key?',\n\t},\n\t{\n\t\ttype: 'input',\n\t\tname: 'indexName',\n\t\tmessage: 'What is your Algolia index name?',\n\t},\n]);\n\nexport const getSiteType = async (): Promise<'landing' | 'multipage'> => {\n\tconst siteType = await inquirer.prompt([\n\t\t{\n\t\t\ttype: 'list',\n\t\t\tname: 'type',\n\t\t\tmessage: 'What type of site do you want to build?',\n\t\t\tchoices: ['Landing', 'Multi page'],\n\t\t\tdefault: 'Multi page',\n\t\t\tfilter(value: string): string {\n\t\t\t\treturn value.toLowerCase();\n\t\t\t},\n\t\t},\n\t]);\n\treturn siteType.type;\n};\n\nexport const buildLandingPage = async (): Promise<Record<string, unknown>> => {\n\tlet githubInfo: Record<string, string> | undefined;\n\tconst siteUrl = await getSiteUrl();\n\tconst plugins = await getUserPlugins();\n\n\tif (plugins.includes('github')) {\n\t\tgithubInfo = await getGithubInfo();\n\t}\n\n\treturn {\n\t\tsiteUrl,\n\t\tplugins,\n\t\t...(githubInfo && {github: githubInfo}),\n\t};\n};\n\nexport const buildMultipageSite = async (): Promise<Record<string, unknown>> => {\n\tlet githubInfo: Record<string, string> | undefined;\n\tlet algoliaInfo: Record<string, string> | undefined;\n\tconst siteUrl = await getSiteUrl();\n\tconst searchEngine = await getSearchEngine();\n\tconst plugins = await getUserPlugins();\n\n\tif (searchEngine === 'algolia') {\n\t\talgoliaInfo = await getAlgoliaInfo();\n\t}\n\n\tif (plugins.includes('github')) {\n\t\tgithubInfo = await getGithubInfo();\n\t}\n\n\treturn {\n\t\tsiteUrl,\n\t\tsearchEngine,\n\t\tplugins: [...plugins, searchEngine],\n\t\t...(githubInfo && {github: githubInfo}),\n\t\t...(algoliaInfo && {algolia: algoliaInfo}),\n\t};\n};\n\nexport const setPlugins = async (): Promise<Record<string, unknown>> => {\n\tconst siteType = await getSiteType();\n\tconst config = await (siteType.includes('landing') ? buildLandingPage() : buildMultipageSite());\n\n\treturn {siteType, ...config};\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/tools/tools.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,cAAc,CAAC;AAElC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAc,EAAQ,EAAE;IACnD,IAAI,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5B,IAAI,KAAK,YAAY,KAAK,EAAE;QAC3B,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;KACxB;IAED,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AACvB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,0EAA0E,CAAC","sourcesContent":["import logger from '../logger.js';\n\nexport const reportError = (error: unknown): void => {\n\tlet message = String(error);\n\tif (error instanceof Error) {\n\t\tmessage = error.message;\n\t}\n\n\tlogger.error(message);\n};\n\nexport const urlRegex = /^(http(s)?:\\/\\/.)[-\\w@:%.+~#=]{2,256}\\.[a-z]{2,6}\\b([-\\w@:%+.~#?&/=]*)$/g;\n\n"]}
1
+ {"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/tools/tools.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,cAAc,CAAC;AAElC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAc,EAAQ,EAAE;IACnD,IAAI,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5B,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC5B,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;IACzB,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AACvB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,0EAA0E,CAAC","sourcesContent":["import logger from '../logger.js';\n\nexport const reportError = (error: unknown): void => {\n\tlet message = String(error);\n\tif (error instanceof Error) {\n\t\tmessage = error.message;\n\t}\n\n\tlogger.error(message);\n};\n\nexport const urlRegex = /^(http(s)?:\\/\\/.)[-\\w@:%.+~#=]{2,256}\\.[a-z]{2,6}\\b([-\\w@:%+.~#?&/=]*)$/g;\n\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docula",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
4
4
  "description": "Open Source Static Site Generator",
5
5
  "exports": "./dist/docula.js",
6
6
  "types": "./dist/docula.d.ts",
@@ -37,47 +37,48 @@
37
37
  },
38
38
  "homepage": "https://github.com/jaredwray/docula#readme",
39
39
  "devDependencies": {
40
- "@types/express": "^4.17.17",
41
- "@types/fs-extra": "^11.0.2",
42
- "@types/inquirer": "^9.0.3",
43
- "@types/jest": "^29.5.5",
44
- "@types/luxon": "^3.3.2",
40
+ "@types/express": "^4.17.21",
41
+ "@types/fs-extra": "^11.0.4",
42
+ "@types/inquirer": "^9.0.7",
43
+ "@types/jest": "^29.5.11",
44
+ "@types/luxon": "^3.4.1",
45
45
  "jest": "^29.7.0",
46
46
  "jest-resolve": "^29.7.0",
47
47
  "jest-ts-webcompat-resolver": "^1.0.0",
48
48
  "ts-jest": "^29.1.1",
49
49
  "ts-jest-resolver": "^2.0.1",
50
- "typescript": "^5.2.2",
51
- "webpack": "^5.88.2",
50
+ "typescript": "^5.3.3",
51
+ "webpack": "^5.89.0",
52
52
  "xo": "^0.56.0"
53
53
  },
54
54
  "dependencies": {
55
55
  "@11ty/eleventy": "^1.0.2",
56
56
  "@11ty/eleventy-navigation": "^0.3.5",
57
- "@types/markdown-it": "^13.0.1",
57
+ "@types/markdown-it": "^13.0.7",
58
58
  "ajv": "^8.12.0",
59
- "algoliasearch": "^4.20.0",
60
- "axios": "^1.5.0",
61
- "commander": "^11.0.0",
62
- "dayjs": "^1.11.9",
59
+ "algoliasearch": "^4.22.1",
60
+ "axios": "^1.6.5",
61
+ "commander": "^11.1.0",
62
+ "dayjs": "^1.11.10",
63
63
  "dotenv": "^16.3.1",
64
64
  "download-stats": "^0.3.4",
65
- "ecto": "^2.2.0",
65
+ "ecto": "^2.2.5",
66
66
  "eleventy-plugin-toc": "^1.1.5",
67
67
  "express": "^4.18.2",
68
- "fs-extra": "^11.1.1",
69
- "inquirer": "^9.2.11",
70
- "instantsearch.js": "^4.56.11",
71
- "luxon": "^3.4.3",
72
- "markdown-it": "^13.0.1",
68
+ "fs-extra": "^11.2.0",
69
+ "inquirer": "^9.2.12",
70
+ "instantsearch.js": "^4.64.0",
71
+ "luxon": "^3.4.4",
72
+ "markdown-it": "^14.0.0",
73
73
  "markdown-it-anchor": "^8.6.7",
74
74
  "node-fetch": "3.3.2",
75
- "winston": "^3.10.0"
75
+ "winston": "^3.11.0"
76
76
  },
77
77
  "files": [
78
78
  "dist",
79
79
  "bin",
80
- "init"
80
+ "init",
81
+ "templates"
81
82
  ],
82
83
  "xo": {
83
84
  "rules": {