UNPKG

markugen

Version:

Markdown to HTML/PDF static site generation tool

39 lines (38 loc) 1.1 kB
#!/usr/bin/env node "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const node_child_process_1 = require("node:child_process"); const fs_extra_1 = __importDefault(require("fs-extra")); const markugen_1 = __importDefault(require("../markugen")); function main() { tsc(); docs(); } /** * Generates the documentation */ function docs() { const mark = new markugen_1.default(); mark.mdtohtml({ input: 'markdown', output: 'docs', assets: ['examples'], clearOutput: true, }); } /** * Compiles the project using the typescript compiler */ function tsc() { fs_extra_1.default.removeSync('./lib'); const result = (0, node_child_process_1.spawnSync)('npx', ['tsc', '-p', 'tsconfig.json'], { shell: true, encoding: 'utf8' }); if (result.stdout) console.log(result.stdout); if (result.stderr) console.error(result.stderr); return !result.error; } main();