Skip to content

Commit

Permalink
perf: remove dayjs dependency
Browse files Browse the repository at this point in the history
saves ~16KB bundle size
  • Loading branch information
pi0 committed Mar 28, 2023
1 parent 271b4db commit d6a3776
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 19 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
"@vitest/coverage-c8": "^0.29.8",
"changelogen": "^0.5.2",
"colorette": "^2.0.19",
"dayjs": "^1.11.7",
"eslint": "^8.36.0",
"eslint-config-unjs": "^0.1.0",
"figures": "^5.0.0",
Expand Down
7 changes: 0 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions src/reporters/basic.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import util from "node:util";
import { parseStack } from "../utils/error";
import { writeStream } from "../utils/stream";
import { formatDate } from "../utils/date";

const DEFAULTS = {
dateFormat: "HH:mm:ss",
formatOptions: {
date: true,
colors: false,
Expand Down Expand Up @@ -41,9 +39,7 @@ export default class BasicReporter {
}

formatDate(date) {
return this.options.formatOptions.date
? formatDate(this.options.dateFormat, date)
: "";
return this.options.formatOptions.date ? date.toLocaleTimeString() : "";
}

filterAndJoin(arr) {
Expand Down
2 changes: 1 addition & 1 deletion src/reporters/fancy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { TYPE_COLOR_MAP, LEVEL_COLOR_MAP } from "../utils/fancy";
import BasicReporter from "./basic";

const DEFAULTS = {
secondaryColor: "grey",
secondaryColor: "gray",
formatOptions: {
date: true,
colors: true,
Expand Down
5 changes: 0 additions & 5 deletions src/utils/date.ts

This file was deleted.

0 comments on commit d6a3776

Please sign in to comment.