compass-docgen
Version:
This is a package that will help you to create your documentation for yours components
43 lines (42 loc) • 1.54 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const commander_1 = require("commander");
const documentation_1 = require("./documentation/documentation");
const core_1 = require("@compass-docgen/core");
const server_1 = require("@compass-docgen/server");
const fs_1 = __importDefault(require("fs"));
const buildApp = async () => {
await core_1.AppConfig.bind();
var docLib = new documentation_1.Documentation();
await docLib.build();
};
const program = new commander_1.Command();
program.version('1.0.0').description('CLI to generate documentation');
program
.command('start', { isDefault: true })
.action(async (cmd) => {
if (fs_1.default.existsSync('/build/components.cache.json') ||
fs_1.default.existsSync('/components.cache.json')) {
console.error('Please run ---> compass build <--- first, to generate the build folder');
return;
}
const server = new server_1.CompassServer();
server.start();
});
program
.command('build')
.description('Build the documentation')
.action(async () => {
await buildApp();
});
program.command('dev', { isDefault: true }).action(async () => {
await buildApp();
//pass along the configuration that is a dev version
const server = new server_1.CompassServer();
server.start({ env: 'DEV' });
});
program.parse(process.argv);