Skip to content

Latest commit

 

History

History
110 lines (71 loc) · 2.74 KB

README.md

File metadata and controls

110 lines (71 loc) · 2.74 KB

Compodoc architecture and operating

Libraries used inside generate static HTML pages

  • bootstrap native : 1.1.0
  • d3 from d3-flextree : 3.x.x
  • deep-iterator : 2.4.0
  • es6-shim : 0.35.1
  • EventDispatcher
  • htmlparser : 2.0.0
  • innersvg : 2.x.x
  • prism : 1.9.0
  • promise
  • svg-pan-zoom : 3.5.2
  • tablesort : 5.0.2
  • vis : 4.20.1
  • zepto : 1.2.0
  • lunr : 2.1.5

Entry files

If you are using Compodoc in module mode with a JavaScript file, require('@compodoc/compodoc'), the first entry file is src/index.ts.

If you are using Compodoc with the CLI, the first entry file is src/index-cli.ts.

Process

The process of Compodoc is :

  • handle CLI flags
  • find files to scan using tsconfig.json include and/or exclude options, or use the root folder of tsconfig.json
  • scan the files using TypeScript compiler
  • generate all the internal stuff
  • emit files for each category (modules, components, etc)
  • echo the result of the generation.

Testing

Unit testing is done by running severals documentation generation with many different files and projects.

E2E testing is done with saucelabs service.

Local unit testing

npm run test

Local E2E

  1. install selenium-standalone (https://www.npmjs.com/package/selenium-standalone)

npm install selenium-standalone@latest -g

  1. configure selenium-standalone

selenium-standalone install

  1. start selenium-standalone

selenium-standalone start

  1. start local documentation generation in another terminal tab

npm run test:simple-doc

  1. start local E2E testing

npm run local-test-e2e-mocha

Development setup

Install

npm i

Init

npm run build

Link

npm link

This will put compodoc command available everywhere.

Start

npm start

Launch watch process for source files and rollup build.

Node.js inspecting

  • install sleep package npm i sleep
  • add these lines in index-cli.ts, atfer --files check
const sleep = require('sleep');
const isInInspectMode = /--inspect/.test(process.execArgv.join(' '));
if (isInInspectMode) {
    // wait 10 seconds for debugger to connect in Chrome devtools
    sleep.sleep(10);
}
  • open one terminal and run inside compodoc folder : npm run start
  • add debuggerstatement where you want to debug your code
  • open Chrome and this url : chrome://inspect
  • open another terminal with the source code of the demo project, and run node --inspect ../compodoc/bin/index-cli.js -p tsconfig.json -a screenshots -n 'TodoMVC Angular documentation' --includes additional-doc --toggleMenuItems "'all'" -s
  • Compodoc will wait 10s before starting when it detects --inspect flag
  • open the debug window in Chrome, and click inspect