The missing documentation tool for your Angular application
—
Quality
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Pending
The risk profile of this skill
The configuration system provides centralized management of all Compodoc settings and options.
Singleton configuration manager providing access to all Compodoc settings and page management.
/**
* Configuration singleton class for managing Compodoc settings
*/
class Configuration {
/**
* Get the singleton instance of Configuration
* @returns Configuration instance
*/
static getInstance(): Configuration;
/**
* Main configuration data containing all settings
*/
get mainData(): MainDataInterface;
/**
* Collection of documentation pages
*/
get pages(): PageInterface[];
/**
* Add a page to the documentation
* @param page - Page configuration to add
*/
addPage(page: PageInterface): void;
/**
* Add an additional page to the documentation
* @param page - Additional page configuration to add
*/
addAdditionalPage(page: PageInterface): void;
/**
* Check if a page exists in the documentation
* @param name - Name of the page to check
* @returns True if page exists
*/
hasPage(name: string): boolean;
/**
* Reset all pages in the documentation
*/
resetPages(): void;
/**
* Reset additional pages in the documentation
*/
resetAdditionalPages(): void;
/**
* Reset root markdown pages in the documentation
*/
resetRootMarkdownPages(): void;
/**
* Get additional page by ID
* @param id - ID of the additional page to retrieve
* @returns Page interface or undefined if not found
*/
getAdditionalPageById(id: string): PageInterface | undefined;
/**
* Get all markdown pages
* @returns Array of pages that have markdown property
*/
get markDownPages(): PageInterface[];
}Usage Examples:
import Configuration from "@compodoc/compodoc";
// Get configuration instance
const config = Configuration.getInstance();
// Access main configuration data
const outputPath = config.mainData.output;
const theme = config.mainData.theme;
// Add a custom page
config.addPage({
name: "custom-page",
id: "custom",
context: "custom",
depth: 0,
pageType: "root"
});
// Check if page exists
if (config.hasPage("overview")) {
console.log("Overview page exists");
}Complete configuration interface containing all available options.
interface MainDataInterface {
// Output settings
output: string;
theme: string;
extTheme: string;
serve: boolean;
hostname: string;
host: string;
port: number;
open: boolean;
// Content settings
assetsFolder: string;
documentationMainName: string;
documentationMainDescription: string;
base: string;
// UI settings
hideGenerator: boolean;
hideDarkModeToggle: boolean;
customFavicon: string;
customLogo: string;
// Data collections
modules: any[];
components: any[];
controllers: any[];
entities: any[];
directives: any[];
injectables: any[];
interceptors: any[];
guards: any[];
interfaces: any[];
pipes: any[];
classes: any[];
routes: any[];
miscellaneous: any[];
// File management
tsconfig: string;
hasFilesToCoverage: boolean;
// Markdown content
readme: boolean;
changelog: string;
contributing: string;
license: string;
todo: string;
markdowns: any[];
additionalPages: any[];
// Templates and includes
templates: string;
includes: string;
includesName: string;
includesFolder: string;
// Navigation
toggleMenuItems: string[];
navTabConfig: any[];
// Feature toggles
disableSourceCode: boolean;
disableDomTree: boolean;
disableTemplateTab: boolean;
disableStyleTab: boolean;
disableGraph: boolean;
disableMainGraph: boolean;
disableCoverage: boolean;
disablePrivate: boolean;
disableProtected: boolean;
disableInternal: boolean;
disableLifeCycleHooks: boolean;
disableConstructors: boolean;
disableRoutesGraph: boolean;
disableSearch: boolean;
disableDependencies: boolean;
disableProperties: boolean;
// Development
watch: boolean;
// Graphs
mainGraph: string;
// Coverage
coverageTest: boolean;
coverageTestThreshold: number;
coverageTestThresholdFail: boolean;
coverageTestPerFile: boolean;
coverageMinimumPerFile: number;
coverageTestShowOnlyFailed: boolean;
coverageData: CoverageData;
// Unit testing
unitTestCoverage: string;
unitTestData: Object;
// Routing
routesLength: number;
// Angular
angularVersion: string;
angularProject: boolean;
angularJSProject: boolean;
// Export
exportFormat: string;
// Dependencies
packageDependencies: Object[];
packagePeerDependencies: Object[];
packageProperties: any;
// Analytics
gaID: string;
gaSite: string;
// Internationalization
language: string;
// Search
maxSearchResults: number;
}Interface defining the structure of documentation pages.
interface PageInterface {
/**
* Display name of the page
*/
name: string;
/**
* Unique identifier for the page
*/
id: string;
/**
* Context/template to use for rendering
*/
context: string;
/**
* Nesting depth in documentation structure
*/
depth: number;
/**
* Type of page (root, internal, etc.)
*/
pageType: string;
/**
* Optional path segment for the page URL
*/
path?: string;
/**
* Optional custom filename for the page
*/
filename?: string;
/**
* Optional navigation tabs configuration
*/
navTabs?: any[];
/**
* Optional markdown content for the page
*/
markdown?: string;
/**
* Optional raw data for the page
*/
data?: any;
/**
* Optional child pages
*/
children?: PageInterface[];
/**
* Optional flag indicating if this is the last child
*/
lastChild?: boolean;
/**
* Optional number of children
*/
childrenLength?: number;
}const COMPODOC_DEFAULTS = {
title: "Application documentation";
additionalEntryName: "Additional documentation";
additionalEntryPath: "additional-documentation";
folder: "./documentation/";
hostname: "127.0.0.1";
port: 8080;
theme: "gitbook";
exportFormat: "html";
exportFormatsSupported: ["html", "json"];
base: "/";
defaultCoverageThreshold: 70;
defaultCoverageMinimumPerFile: 0;
coverageTestThresholdFail: true;
toggleMenuItems: ["all"];
navTabConfig: [];
disableSourceCode: false;
disableDomTree: false;
disableTemplateTab: false;
disableStyleTab: false;
disableGraph: false;
disableMainGraph: false;
disableCoverage: false;
disablePrivate: false;
disableProtected: false;
disableInternal: false;
disableLifeCycleHooks: false;
disableConstructors: false;
disableRoutesGraph: false;
disableDependencies: false;
disableProperties: false;
PAGE_TYPES: {
ROOT: "root";
INTERNAL: "internal";
};
gaSite: "auto";
coverageTestShowOnlyFailed: false;
language: "en-US";
maxSearchResults: 15;
};Usage Examples:
// Access default values
import { COMPODOC_DEFAULTS } from "@compodoc/compodoc";
const defaultTheme = COMPODOC_DEFAULTS.theme; // "gitbook"
const defaultPort = COMPODOC_DEFAULTS.port; // 8080
// Create configuration with defaults
const config = Configuration.getInstance();
config.mainData.theme = COMPODOC_DEFAULTS.theme;
config.mainData.port = COMPODOC_DEFAULTS.port;