UNPKG

1.08 kBJavaScriptView Raw
1#!/usr/bin/env node
2
3const debug = require('debug');
4const program = require('commander');
5const path = require('path');
6const spawn = require('child_process').spawn;
7const Firedoc = require('../lib/firedoc').Firedoc;
8
9program
10 .option('-l --lint', 'lint the parser')
11 .option('--parse-only', 'only parse')
12 .option('-M --markdown', 'generate markdown docs')
13 .option('-T --theme <dir>', 'specify theme directory')
14 .option('-D --dest <dir>', 'the destination folder to build')
15 .option('-L --lang <language>', 'the i18n language')
16 .option('-v --verbose', 'print all verbose information')
17 .parse(process.argv);
18
19if (program.verbose) {
20 debug.enable('firedoc:*');
21}
22
23var doc = new Firedoc({
24 path: program.args[0],
25 lint: program.lint,
26 parseOnly: program.parseOnly,
27 markdown: program.markdown,
28 http: true,
29 dest: program.dest,
30 lang: program.lang,
31 theme: program.theme
32});
33doc.build(onbuild);
34
35function onbuild () {
36 var serve = path.join(__dirname, '../node_modules/.bin/serve');
37 spawn(serve, [doc.options.dest, '-H'], {
38 'stdio': 'inherit'
39 });
40}
41