UNPKG

docula

Version:

Beautiful Website for Your Projects

138 lines (132 loc) 3.42 kB
import http from 'node:http'; type DoculaSection = { name: string; order?: number; path: string; children?: DoculaSection[]; }; declare class DoculaOptions { /** * Path to the template directory */ templatePath: string; /** * Path to the output directory */ outputPath: string; /** * Path to the site directory */ sitePath: string; /** * Path to the github repository */ githubPath: string; /** * Site title */ siteTitle: string; /** * Site description */ siteDescription: string; /** * Site URL */ siteUrl: string; /** * Port to run the server */ port: number; /** * Single page website */ singlePage: boolean; /** * Sections */ sections?: DoculaSection[]; constructor(options?: Record<string, unknown>); parseOptions(options: Record<string, any>): void; } declare class DoculaHelpers { createDoc(path: string, destination: string, frontMatter?: Record<string, string>, contentFunction?: (content: string) => string): void; getFrontMatterFromFile(path: string): Record<string, string>; getFrontMatter(content: string): Record<string, string>; setFrontMatterToFile(path: string, frontMatter: Record<string, string>): void; setFrontMatterInContent(content: string, frontMatter?: Record<string, string>): string; } declare class Docula { private _options; private readonly _console; private _configFileModule; private _server; /** * Initialize the Docula class * @param {DoculaOptions} options * @returns {void} * @constructor */ constructor(options?: DoculaOptions); /** * Get the options * @returns {DoculaOptions} */ get options(): DoculaOptions; /** * Set the options * @param {DoculaOptions} value */ set options(value: DoculaOptions); /** * The http server used to serve the site * @returns {http.Server | undefined} */ get server(): http.Server | undefined; /** * The config file module. This is the module that is loaded from the docula.config.mjs file * @returns {any} */ get configFileModule(): any; /** * Check for updates * @returns {void} */ checkForUpdates(): void; /** * Is the execution process that runs the docula command * @param {NodeJS.Process} process * @returns {Promise<void>} */ execute(process: NodeJS.Process): Promise<void>; /** * Checks if the site is a single page website * @param {string} sitePath * @returns {boolean} */ isSinglePageWebsite(sitePath: string): boolean; /** * Generate the init files * @param {string} sitePath * @returns {void} */ generateInit(sitePath: string): void; /** * Get the version of the package * @returns {string} */ getVersion(): string; /** * Load the config file * @param {string} sitePath * @returns {Promise<void>} */ loadConfigFile(sitePath: string): Promise<void>; /** * Serve the site based on the options (port and output path) * @param {DoculaOptions} options * @returns {Promise<void>} */ serve(options: DoculaOptions): Promise<http.Server>; } export { DoculaHelpers, Docula as default };