Skip to content

@dovenv/docs - API documentation

Classes

Docs

Documentation class

For build, dev and preview documentation pages

Constructors

new Docs()
ts
new Docs(conf?: DocsConfig, opts?: DocsParams): Docs
Parameters
ParameterType
conf?DocsConfig
opts?DocsParams
Returns

Docs

Methods

build()
ts
build(flags?: string[]): Promise<void>

Builds the documentation site.

This command is a wrapper of the npx vitepress build command.

Parameters
ParameterTypeDescription
flags?string[]Flags to pass to the underlying vitepress build command. This allows for customization and control over the build process.
Returns

Promise<void>

dev()
ts
dev(flags?: string[]): Promise<void>

Starts the development server.

This command is a wrapper of the npx vitepress dev command.

Parameters
ParameterTypeDescription
flags?string[]Flags to pass to the underlying vitepress dev command. The --force flag is always passed to ensure the server starts without prompting the user.
Returns

Promise<void>

preview()
ts
preview(flags?: string[]): Promise<void>

Starts the preview server.

This command is a wrapper of the npx vitepress preview command.

Parameters
ParameterTypeDescription
flags?string[]Flags to pass to the underlying vitepress preview command. This allows for customization and control over the preview process.
Returns

Promise<void>

Properties

PropertyType
configundefined | DocsConfig
optsDocsParams
outputReplaced{ start: () => void; stop: () => void; }
outputReplaced.start() => void
outputReplaced.stop() => void

Functions

defineConfig()

ts
function defineConfig(...config: (DocsConfig | DocsConfig[])[]): DocsConfig

Defines a configuration object for the dovenv documentation plugin.

Parameters

ParameterTypeDescription
...config(DocsConfig | DocsConfig[])[]The configuration object.

Returns

DocsConfig

The defined configuration object.


docsPlugin()

ts
function docsPlugin(conf?: DocsPluginConfig): Config

Define a dovenv configuration that creates a documentation site for your workspace.

Parameters

ParameterTypeDescription
conf?DocsPluginConfigThe configuration object.

Returns

Config

The dovenv configuration object.


getPkgConfig()

ts
function getPkgConfig(pkgData: JSONSchemaForNPMPackageJsonFiles): Promise<DocsConfig>

Extracts and constructs documentation configuration from package JSON data.

Parameters

ParameterTypeDescription
pkgDataJSONSchemaForNPMPackageJsonFilesThe package JSON data object.

Returns

Promise<DocsConfig>

A promise that resolves to a DocsConfig object containing extracted configuration details like funding URL, bugs URL, license, homepage URL, description, name, version, and contributors.

Type Aliases

DocsConfig

ts
type DocsConfig: {
  autoSidebar: {
     about: boolean;
     contribute: boolean;
     intro: boolean;
     reference: boolean;
    };
  bugsURL: string;
  changelogURL: string;
  contributingURL: string;
  contributors: {
     actionText: string;
     avatar: string;
     desc: string;
     links: SocialLinks;
     name: string;
     org: string;
     orgLink: string;
     sponsor: string;
     title: string;
    }[];
  css: string;
  desc: string;
  docsPath: string;
  download: {
     groups: {};
     items: {};
    };
  experimental: {
     noTempDirOnBuild: boolean;
    };
  favicon: string;
  footer: {
     copy: {
        name: string;
        url: string;
       };
     links: {
        email: string;
        instagram: string;
        medium: string;
        twitter: string;
        web: string;
       };
    };
  fundingURL: string;
  input: string;
  lang: string;
  license: {
     type: string;
     url: string;
    };
  links: Links;
  logo: string;
  moreURL: string;
  name: string;
  nav: Nav;
  navLinks: SocialLinks;
  npmURL: string;
  og: {
     description: string;
     image: string;
     siteName: string;
     title: string;
     twitterAccount: string;
     url: string;
    };
  oldVersions: {
     name: string;
     url: string;
    }[];
  output: string;
  pwa: Partial<VitePWAOptions> | false;
  repoURL: string;
  rss: RSSOptions;
  server: {
     hotReloadFiles: string[];
     restartFiles: string[];
    };
  shortDesc: string;
  sidebar: Sidebar;
  styles: {
     color: {
        dark: Colors;
        fourth: string;
        light: Colors;
        primary: string;
        secondary: string;
        terciary: string;
       };
     radius: string;
    };
  url: string;
  version: string;
  vitepress: UserConfig;
};

Type declaration

NameTypeDescription
autoSidebar?{ about: boolean; contribute: boolean; intro: boolean; reference: boolean; }Active or desactivated sidebar autogenerated
autoSidebar.about?booleanDisplay the "About" section in the sidebar. Default true
autoSidebar.contribute?booleanDisplay the "Contribute" section in the sidebar. Default true
autoSidebar.intro?booleanDisplay the "Get started" section in the sidebar. Default true
autoSidebar.reference?booleanDisplay the "Reference" section in the sidebar. Default true
bugsURL?stringURL for the project's issue tracker or bug reports.
changelogURL?stringCHANGELOG url of the project.
contributingURL?stringcontributing url of the project.
contributors?{ actionText: string; avatar: string; desc: string; links: SocialLinks; name: string; org: string; orgLink: string; sponsor: string; title: string; }[]Contributors information including their details and social links.
css?stringCustom CSS for the documentation site.
desc?string-
docsPath?stringPath to the documentation files. Used for editLink in pages Default 'docs'
download?{ groups: {}; items: {}; }Data related to downloads and version releases.
download.groups?{}Optional grouping of download items by category. Each key in the object represents a group name and maps to a string label. Example { * "extension": "extension", * "app": "app", * }
download.items?{}Optional list of downloadable items, where each key represents an item identifier. Each item includes details such as name, URL, and optionally a logo and type.
experimental?{ noTempDirOnBuild: boolean; }Settings for experimental options. Use at your own risk
experimental.noTempDirOnBuild?booleanDisable temp directory during compilation. The temp directory is used to store documentation files in the output directory during the compilation process. Used to allow input paths with '../' Default false
favicon?stringFavicon URL for the documentation site. Default '/favicon.png'
footer?{ copy: { name: string; url: string; }; links: { email: string; instagram: string; medium: string; twitter: string; web: string; }; }Footer configuration with links and copyright information.
footer.copy?{ name: string; url: string; }Copyright information for the project.
footer.copy.name?stringName to display in copyright notices.
footer.copy.url?stringURL for the copyright holder or organization.
footer.links?{ email: string; instagram: string; medium: string; twitter: string; web: string; }Links to various social platforms or contact methods.
footer.links.email?stringEmail link for contacting the project or organization.
footer.links.instagram?stringInstagram link for the project or organization.
footer.links.medium?stringMedium link for articles or blogs related to the project.
footer.links.twitter?stringTwitter link for the project or organization.
footer.links.web?stringWebsite link for the project or organization.
fundingURL?stringURL for funding or sponsorship of the project.
input?stringInput directory for documentation files. Default './docs'
lang?stringLanguage code for the documentation, e.g., 'en' for English. Default 'en'
license?{ type: string; url: string; }License information for the project.
license.type?stringType of license (e.g., MIT, GPL). Default 'MIT'
license.url?stringURL to the full license text.
links?LinksAdditional links to display in a special page.
logo?stringLogo URL for the documentation site. Default '/logo.png'
moreURL?stringAdditional URL for more resources or links related to the project.
name?stringName of the project or documentation. Default 'DOVENV'
nav?NavNavigation configuration for links at the top of the documentation.
navLinks?SocialLinksAdditional navigation links. Icons IDs: https://simpleicons.org/
npmURL?stringNPM package URL for the project.
og?{ description: string; image: string; siteName: string; title: string; twitterAccount: string; url: string; }Open Graph meta tags for better link previews on social media.
og.description?stringDescription for the Open Graph metadata.
og.image?stringImage URL for the Open Graph metadata.
og.siteName?stringSite name for Open Graph metadata.
og.title?stringTitle for the Open Graph metadata.
og.twitterAccount?stringTwitter account associated with the site.
og.url?stringURL for the site, used in Open Graph metadata.
oldVersions?{ name: string; url: string; }[]Array of previous versions of the project, each with a name and a URL.
output?stringOutput directory for the built documentation. Default './build'
pwa?Partial<VitePWAOptions> | falseConfiguration options for PWA (Progressive Web App) support.
repoURL?stringRepository URL for the project.
rss?RSSOptionsConfiguration options for RSS feed.
server?{ hotReloadFiles: string[]; restartFiles: string[]; }Server-related configurations, including file watching settings.
server.hotReloadFiles?string[]Files that trigger a hot reload on changes.
server.restartFiles?string[]Files that trigger a server restart on changes.
shortDesc?stringA shorter version of the description for better display.
sidebar?SidebarSidebar configuration for navigation within the documentation.
styles?{ color: { dark: Colors; fourth: string; light: Colors; primary: string; secondary: string; terciary: string; }; radius: string; }Custom styles for the documentation site.
styles.color?{ dark: Colors; fourth: string; light: Colors; primary: string; secondary: string; terciary: string; }Color scheme for the documentation site.
styles.color.dark?ColorsDark mode colors for the theme.
styles.color.fourth?stringFourth color for the theme.
styles.color.light?ColorsLight mode colors for the theme.
styles.color.primary?stringPrimary color for the theme.
styles.color.secondary?stringSecondary color for the theme.
styles.color.terciary?stringTertiary color for the theme.
styles.radius?stringBorder radius for elements in the theme.
url?stringURL of the project or documentation site.
version?stringVersion of the project.
vitepress?UserConfigVitePress user configuration for additional options.

DocsPluginConfig

ts
type DocsPluginConfig: DocsConfig | (config?: DovenvConfig) => Promise<DocsConfig>;

References

default

Renames and re-exports docsPlugin