Skip to content

Commit

Permalink
feat: print the time it took to build
Browse files Browse the repository at this point in the history
  • Loading branch information
razonyang committed Jun 14, 2024
1 parent 208fdbc commit 956222b
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,22 @@ class Metrics {
return m
}

duration (): string {
if (this.time > 3600 * 10e3) {
return `${this.time / 3600 * 10e3} h`
} else if (this.time > 60 * 10e3) {
return `${this.time / 60 * 10e3} min`
}

return `${this.time / 10e3} s`
}

speed (): string {
const totalPages = this.pages + this.paginatorPages
const totalPagesAliases = totalPages + this.aliases
const totalFiles = totalPagesAliases + this.staticFiles + this.nonPageFiles + this.processedImages
return `${this.colorSpeed(this.time / totalPages)} ms/page (${blue(totalPages)} pages)
return `${blue(this.duration())} in total
${this.colorSpeed(this.time / totalPages)} ms/page (${blue(totalPages)} pages)
${this.colorSpeed(this.time / totalPagesAliases)} ms/page (${blue(totalPagesAliases)} pages, including aliases)
${this.colorSpeed(this.time / totalFiles)} ms/file (${blue(totalFiles)} files)`
}
Expand Down

0 comments on commit 956222b

Please sign in to comment.