Navigation | Overlay |
---|---|
t Navigate files | h Toggle hits |
y Change url to tip of branch | m Toggle misses |
b / v Jump to prev/next hit line | p Toggle partial |
z / x Jump to prev/next missed or partial line | 1..9 Toggle flags |
shift + o Open current page in GitHub | a Toggle all on |
/ or ? Show keyboard shortcuts dialog | c Toggle context lines or commits |
1 |
#!/usr/bin/env node |
|
2 |
|
|
3 |
import minimist from 'minimist' |
|
4 |
import extractConfig from './extractConfig' |
|
5 |
import docgen from './docgen' |
|
6 |
import { SafeDocgenCLIConfig } from './config' |
|
7 |
|
|
8 |
/**
|
|
9 |
* run the `config` recursively on pages
|
|
10 |
* @param config
|
|
11 |
*/
|
|
12 |
function run(config: SafeDocgenCLIConfig) { |
|
13 |
const { pages } = config |
|
14 |
if (pages) { |
|
15 |
// to avoid re-rendering the same pages
|
|
16 |
delete config.pages |
|
17 |
pages.forEach(page => { |
|
18 |
const pageConf = { ...config, ...page } |
|
19 |
run(pageConf) |
|
20 |
})
|
|
21 |
} else { |
|
22 |
docgen(config) |
|
23 |
}
|
|
24 |
}
|
|
25 |
|
|
26 |
const { _: pathArray, configFile, watch, cwd } = minimist(process.argv.slice(2), { |
|
27 |
alias: { c: 'configFile', w: 'watch' } |
|
28 |
})
|
|
29 |
|
|
30 |
const conf = extractConfig(cwd || process.cwd(), watch, configFile, pathArray) |
|
31 |
run(conf) |
Read our documentation on viewing source code .