UNPKG

vue-docgen-cli

Version:

Generate documentation markdown files from VueJs components using the vue-docgen-api.

74 lines 2.96 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const cac_1 = __importDefault(require("cac")); const log = __importStar(require("loglevel")); const extractConfig_1 = __importDefault(require("./extractConfig")); const docgen_1 = __importDefault(require("./docgen")); const CLI = (0, cac_1.default)('vue-docgen-cli'); log.debug('[vue-docgen-cli] start'); /** * run the `config` recursively on pages * @param config */ function run(config) { const { pages } = config; if (pages) { // to avoid re-rendering the same pages delete config.pages; pages.forEach(page => { const pageConf = { ...config, ...page }; run(pageConf); }); } else { (0, docgen_1.default)(config); } } CLI.command('[componentsGlob] [outFile]', 'generate documentation') .option('-c, --configFile <configFile>', 'Path to the config file') .option('-w, --watch', 'turn on watch mode', { default: false }) .option('--cwd', 'where to look for the config file') .option('--logLevel <logLevel>', 'level of verbosity the CLI will be', { default: [], type: ['trace', 'debug', 'info', 'warn', 'error'] }) .option('-v, --verbose', 'equivalent to --logLevel=debug', { default: false }) .action(async (componentsGlob, outFile, options) => { const { configFile, watch, cwd, logLevel: [logLevel], verbose } = options; const conf = await (0, extractConfig_1.default)(cwd || process.cwd(), watch, configFile, [componentsGlob, outFile], verbose, logLevel).catch(err => { log.setLevel('error'); log.error(err); process.exit(1); }); run(conf); }); CLI.help(); CLI.parse(); CLI.version(require('../package.json').version); //# sourceMappingURL=index.js.map