{"id":486,"date":"2020-10-22T15:22:07","date_gmt":"2020-10-22T13:22:07","guid":{"rendered":"https:\/\/nguenkam.com\/blog\/?p=486"},"modified":"2020-10-22T15:22:07","modified_gmt":"2020-10-22T13:22:07","slug":"compodoc-documentation-tool-for-angular-project","status":"publish","type":"post","link":"https:\/\/nguenkam.com\/blog\/index.php\/2020\/10\/22\/compodoc-documentation-tool-for-angular-project\/","title":{"rendered":"Compodoc &#8211; documentation tool for angular project &#8211;"},"content":{"rendered":"\n<h4>What is Compodoc ?<\/h4>\n\n\n\n<p>Compodoc is a documentation tool for Angular applications. It generates a static documentation of your application.<\/p>\n\n\n\n<h4>Why Use Compodoc ?<\/h4>\n\n\n\n<p>Compodoc helps Angular developers providing a clear and helpful documentation of their application.<\/p>\n\n\n\n<p>Others developers of your team, or internet visitors for a public documentation, can easily understand the features of your application or library.<\/p>\n\n\n\n<h4>Open Source<\/h4>\n\n\n\n<p>Compodoc is an open source effort from&nbsp;<a href=\"http:\/\/www.vincentogloblinsky.com\/\">Vincent Ogloblinsky<\/a>.<\/p>\n\n\n\n<p>Developers can contribute and fork the repo on\u00a0<a href=\"https:\/\/github.com\/compodoc\/compodoc\">GitHub<\/a>.<\/p>\n\n\n\n<h4>Node.js versions<\/h4>\n\n\n\n<p>Compodoc is tested with only LTS versions : v10.x, v8.x ; and support also Node.js v10.x+<\/p>\n\n\n\n<h4>Angular-CLI<\/h4>\n\n\n\n<p>Compodoc supports last Angular-CLI version : 10.x<\/p>\n\n\n\n<p>Just run Compodoc in a fresh or existing project.<\/p>\n\n\n\n<h4><span class=\"has-inline-color has-vivid-red-color\">Global installation<\/span><\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>npm install -g @compodoc\/compodoc<\/code><\/pre>\n\n\n\n<p><em><span class=\"has-inline-color has-black-color\">If you use PowerShell on Windows, add quotes :<\/span><\/em>   npm install -g <span class=\"has-inline-color has-vivid-green-cyan-color\">&#8220;@compodoc\/compodoc&#8221;<\/span><\/p>\n\n\n\n<h4><span class=\"has-inline-color has-vivid-red-color\">Local installation<\/span><\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>npm install --save-dev @compodoc\/compodoc<\/code><\/pre>\n\n\n\n<h4><span class=\"has-inline-color has-vivid-red-color\">Run<\/span><\/h4>\n\n\n\n<p>Define a script task for it in your package.json (with npm 6.x) :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\"scripts\": {\n  \"doc\": \"compodoc -p tsconfig.json --serve --open -w\"\n}<\/code><\/pre>\n\n\n\n<p>and run it like a normal npm script :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>npm run doc<\/code><\/pre>\n\n\n\n<h4>Position of tsconfig file in codebase<\/h4>\n\n\n\n<p>Compodoc start at the folder level of the tsconfig file provided with&nbsp;<code>-p<\/code>&nbsp;option.<\/p>\n\n\n\n<p>Example for an Angular CLI project :<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"292\" height=\"255\" src=\"https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2020\/10\/posTsConfig.png\" alt=\"\" class=\"wp-image-499\"\/><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>compodoc -p tsconfig.app.json src<\/code><\/pre>\n\n\n\n<h4><span class=\"has-inline-color has-vivid-red-color\">Usage<\/span><\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>compodoc &lt;src> &#91;options]<\/code><\/pre>\n\n\n\n<h1>Options :<\/h1>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Flag<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><strong>-h, &#8211;help<\/strong><\/td><td>output usage information<\/td><\/tr><tr><td><strong>-V, &#8211;version<\/strong><\/td><td>output the version number<\/td><\/tr><tr><td><strong>-c, &#8211;config [config]<\/strong><\/td><td>A configuration file : .compodocrc, .compodocrc.json, .compodocrc.yaml or compodoc property in package.json<\/td><\/tr><tr><td><strong>-p, &#8211;tsconfig [config]<\/strong><\/td><td>A tsconfig.json file<\/td><\/tr><tr><td><strong>-d, &#8211;output [folder]<\/strong><\/td><td>Where to store the generated documentation<\/td><\/tr><tr><td><strong>-y, &#8211;extTheme [file]<\/strong><\/td><td>External styling theme<\/td><\/tr><tr><td><strong>-n, &#8211;name [name]<\/strong><\/td><td>Title of the documentation<\/td><\/tr><tr><td><strong>-a, &#8211;assetsFolder [folder]<\/strong><\/td><td>External assets folder to copy in generated documentation folder<\/td><\/tr><tr><td><strong>-o, &#8211;open<\/strong><\/td><td>Open the generated documentation<\/td><\/tr><tr><td><strong>-t, &#8211;silent<\/strong><\/td><td>In silent mode, log messages aren&#8217;t logged in the console<\/td><\/tr><tr><td><strong>-s, &#8211;serve<\/strong><\/td><td>Serve generated documentation (default&nbsp;<a href=\"http:\/\/localhost:8080\/\">http:\/\/localhost:8080\/<\/a>)<\/td><\/tr><tr><td><strong>-r, &#8211;port [port]<\/strong><\/td><td>Change default serving port<\/td><\/tr><tr><td><strong>-w, &#8211;watch<\/strong><\/td><td>Watch source files after serve and force documentation rebuild<\/td><\/tr><tr><td><strong>-e, &#8211;exportFormat [format]<\/strong><\/td><td>Export in specified format (json, html (default))<\/td><\/tr><tr><td><strong>&#8211;language [language]<\/strong><\/td><td>Language used for the generated documentation (en-US, es-ES, fr-FR, hu-HU, it-IT, ja-JP, nl-NL, pt-BR, zh-CN) (default: en-US)<\/td><\/tr><tr><td><strong>&#8211;theme [theme]<\/strong><\/td><td>Choose one of available themes, default is &#8216;gitbook&#8217; (laravel, original, material, postmark, readthedocs, stripe, vagrant)<\/td><\/tr><tr><td><strong>&#8211;hideGenerator<\/strong><\/td><td>Do not print the Compodoc logo at the bottom of the page<\/td><\/tr><tr><td><strong>&#8211;toggleMenuItems<\/strong><\/td><td>Close by default items in the menu (default [&#8216;all&#8217;]) values : [&#8216;all&#8217;] or one of these [&#8216;modules&#8217;,&#8217;components&#8217;,&#8217;directives&#8217;,&#8217;controllers&#8217;,&#8217;classes&#8217;,&#8217;injectables&#8217;,&#8217;guards&#8217;,&#8217;interfaces&#8217;,&#8217;interceptors&#8217;,&#8217;pipes&#8217;,&#8217;miscellaneous&#8217;,&#8217;additionalPages&#8217;])<\/td><\/tr><tr><td><strong>&#8211;navTabConfig<\/strong><\/td><td>List navigation tab objects in the desired order with two string properties (&#8220;id&#8221; and &#8220;label&#8221;). Double-quotes must be escaped with &#8216;\\&#8217;. Available tab IDs are &#8220;info&#8221;, &#8220;readme&#8221;, &#8220;source&#8221;, &#8220;templateData&#8221;, &#8220;tree&#8221;, and &#8220;example&#8221;. Note: Certain tabs will only be shown if applicable to a given dependency<\/td><\/tr><tr><td><strong>&#8211;templates [folder]<\/strong><\/td><td>Path to directory of Handlebars templates to override built-in templates<\/td><\/tr><tr><td><strong>&#8211;includes [path]<\/strong><\/td><td>Path of external markdown files to include<\/td><\/tr><tr><td><strong>&#8211;includesName [name]<\/strong><\/td><td>Name of item menu of externals markdown files (default &#8220;Additional documentation&#8221;)<\/td><\/tr><tr><td><strong>&#8211;coverageTest<\/strong><\/td><td>Test command of documentation coverage with a threshold (default 70)<\/td><\/tr><tr><td><strong>&#8211;coverageMinimumPerFile [minimum]<\/strong><\/td><td>Test command of documentation coverage per file with a minimum (default 0)<\/td><\/tr><tr><td><strong>&#8211;coverageTestThresholdFail [boolean]<\/strong><\/td><td>Test command of documentation coverage (global or per file) will fail with error or just warn user (true: error, false: warn) (default: true)<\/td><\/tr><tr><td><strong>&#8211;coverageTestShowOnlyFailed<\/strong><\/td><td>Display only failed files for a coverage test<\/td><\/tr><tr><td><strong>&#8211;unitTestCoverage [json-summary]<\/strong><\/td><td>To include unit test coverage, specify istanbul JSON coverage summary file<\/td><\/tr><tr><td><strong>&#8211;disableSourceCode<\/strong><\/td><td>Do not add source code tab and links to source code<\/td><\/tr><tr><td><strong>&#8211;disableDomTree<\/strong><\/td><td>Do not add dom tree tab<\/td><\/tr><tr><td><strong>&#8211;disableTemplateTab<\/strong><\/td><td>Do not add template tab<\/td><\/tr><tr><td><strong>&#8211;disableStyleTab<\/strong><\/td><td>Do not add style tab<\/td><\/tr><tr><td><strong>&#8211;disableGraph<\/strong><\/td><td>Disable rendering of the dependency graph<\/td><\/tr><tr><td><strong>&#8211;disableCoverage<\/strong><\/td><td>Do not add the documentation coverage report<\/td><\/tr><tr><td><strong>&#8211;disablePrivate<\/strong><\/td><td>Do not show private in generated documentation<\/td><\/tr><tr><td><strong>&#8211;disableProtected<\/strong><\/td><td>Do not show protected in generated documentation<\/td><\/tr><tr><td><strong>&#8211;disableInternal<\/strong><\/td><td>Do not show @internal in generated documentation<\/td><\/tr><tr><td><strong>&#8211;disableLifeCycleHooks<\/strong><\/td><td>Do not show Angular lifecycle hooks in generated documentation<\/td><\/tr><tr><td><strong>&#8211;disableRoutesGraph<\/strong><\/td><td>Do not add the routes graph<\/td><\/tr><tr><td><strong>&#8211;disableSearch<\/strong><\/td><td>Do not add the search input<\/td><\/tr><tr><td><strong>&#8211;disableDependencies<\/strong><\/td><td>Do not add the dependencies list<\/td><\/tr><tr><td><strong>&#8211;minimal<\/strong><\/td><td>Minimal mode with only documentation. No search, no graph, no coverage.<\/td><\/tr><tr><td><strong>&#8211;customFavicon [path]<\/strong><\/td><td>Use a custom favicon<\/td><\/tr><tr><td><strong>&#8211;customLogo [path]<\/strong><\/td><td>Use a custom logo<\/td><\/tr><tr><td><strong>&#8211;gaID [id]<\/strong><\/td><td>Google Analytics tracking ID<\/td><\/tr><tr><td><strong>&#8211;gaSite [site]<\/strong><\/td><td>Google Analytics site name (default auto (default: auto)<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h5>Reference:<\/h5>\n\n\n\n<p><a href=\"https:\/\/compodoc.app\/\">https:\/\/compodoc.app\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is Compodoc ? Compodoc is a documentation tool for Angular applications. It generates a static documentation of your application. Why Use Compodoc ? Compodoc helps Angular developers providing a clear and helpful documentation of their application. Others developers of your team, or internet visitors for a public documentation, can easily understand the features of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[37],"tags":[119,120],"_links":{"self":[{"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/486"}],"collection":[{"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=486"}],"version-history":[{"count":14,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/486\/revisions"}],"predecessor-version":[{"id":501,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/486\/revisions\/501"}],"wp:attachment":[{"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=486"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=486"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=486"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}