Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | 1x 1x 1x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 2x 4x | import {CliArgs} from './args'; import {Mooltipage} from '../lib'; import {CliConsole} from './cli'; import {expandPagePaths} from './cliFs'; export class CliEngine { readonly args: CliArgs; readonly cliConsole: CliConsole; readonly mooltipage: Mooltipage; constructor(args: CliArgs, cliConsole: CliConsole) { this.args = args; this.cliConsole = cliConsole; this.mooltipage = this.createMooltipage(); } async runApp(): Promise<void> { // convert page arguments into full list of pages const basePath = this.args.inPath ?? process.cwd(); const pages = await expandPagePaths(this.args.pages, basePath); // print stats this.cliConsole.log(`Source path: [${ this.args.inPath ?? process.cwd() }]`); this.cliConsole.log(`Destination path: [${ this.args.outPath ?? process.cwd() }]`); this.cliConsole.log(`Page count: ${ pages.length }`); this.cliConsole.log(); // compile each page await this.mooltipage.processPages(pages); // we are done this.cliConsole.log(); this.cliConsole.log('Done.'); } protected createMooltipage(): Mooltipage { return new Mooltipage({ inPath: this.args.inPath, outPath: this.args.outPath, formatter: this.args.formatter, onPageCompiled: async page => this.cliConsole.log(`Compiled [${ page.path }].`) }); } } |