Skip to content

Commit

Permalink
Merge pull request #41 from yosion-p/report
Browse files Browse the repository at this point in the history
Report
  • Loading branch information
PeterAlfredLee committed Jul 20, 2021
2 parents 49f887c + c27ddeb commit 0a3cafc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { Config } from '../config/config'
import { astParseRoot, AstParsingResult } from '../ast-parse/astParse'
import { printReport, recordConver } from '../utils/report'

const beginTime = Date.now()

export function run (): void {
const program = new Command()
const version = require('../../package.json').version
Expand Down Expand Up @@ -51,7 +53,7 @@ export async function start (config : Config): Promise<void> {

// generate index.html must be after generate vite.config.js
geneIndexHtml(rootDir, config, astParsingResult)
printReport(config.reportType, config.rootDir) // output conversion
printReport(config.reportType, config.rootDir, beginTime) // output conversion

// generate patches
const patchesDir = path.resolve(rootDir, 'patches')
Expand Down
3 changes: 2 additions & 1 deletion src/utils/report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,13 @@ function recordConver (args: ConverObj) {
})
}

function printReport (reportType: string, dir:string) {
function printReport (reportType: string, dir: string, beginTime: number) {
console.log('features of successful conversion:')
reportList.forEach(item => {
tabDt.push([item.num, item.feat, item.times?.toString()])
})
console.log(table(tabDt, tabFormat));
console.log(chalk.green(`Conversion in ${Date.now() - beginTime}ms.`))
if (reportType === 'log') {
const options = {
flags: 'w', //
Expand Down

0 comments on commit 0a3cafc

Please sign in to comment.