1 | 'use strict';
|
2 |
|
3 | const yargs = require('yargs');
|
4 | const { generate } = require('./cmds');
|
5 |
|
6 | function main() {
|
7 | yargs
|
8 | .usage('$0 <cmd> [args]')
|
9 |
|
10 | .command({
|
11 | command: 'generate [options]',
|
12 | aliases: ['gen', 'g', '$0'],
|
13 | desc: 'Generate the md files',
|
14 | handler: generate,
|
15 | builder: yargs => {
|
16 | yargs.options({
|
17 | source: {
|
18 | alias: 's',
|
19 | default: './src',
|
20 | desc: 'Source folder with .js or .ts files',
|
21 | type: 'string'
|
22 | },
|
23 | dist: {
|
24 | alias: 'd',
|
25 | default: './documentation',
|
26 | desc: 'Destination folder',
|
27 | type: 'string'
|
28 | },
|
29 | folder: {
|
30 | alias: 'f',
|
31 | default: 'code',
|
32 | desc: 'Folder inside destination folder. Gets overwritten everytime',
|
33 | type: 'string'
|
34 | },
|
35 | title: {
|
36 | alias: 't',
|
37 | default: 'API',
|
38 | desc: 'Title of your documentation',
|
39 | type: 'string'
|
40 | },
|
41 | readme: {
|
42 | alias: 'r',
|
43 | default: '',
|
44 | desc: 'Path to your custom readme',
|
45 | type: 'string'
|
46 | },
|
47 | exclude: {
|
48 | alias: 'e',
|
49 | default: '',
|
50 | desc: 'Pattern to exclude files/folders (Comma seperated) - *.test.js,exclude.js',
|
51 | type: 'string'
|
52 | },
|
53 | rmPattern: {
|
54 | alias: 'rm',
|
55 | default: [],
|
56 | desc: 'Pattern when removing files. You can ex- and include files. (glob pattern)',
|
57 | type: 'array'
|
58 | },
|
59 | jsDocConfigPath: {
|
60 | alias: 'c',
|
61 | default: '',
|
62 | desc: 'Path to jsdoc config',
|
63 | type: 'string'
|
64 | }
|
65 | });
|
66 | }
|
67 | })
|
68 |
|
69 | .alias('help', 'h')
|
70 | .alias('version', 'v').argv;
|
71 | }
|
72 |
|
73 | module.exports = main;
|