feat(dependencies): remove moment.js (#530)
* feat(dependencies): remove moment.js * fix(dependencies): remove yarn from yarn.lock * feat(log-date-formatting): rename function Co-authored-by: Jaco Greeff <jacogr@gmail.com>
This commit is contained in:
co-authored by
Jaco Greeff
parent
b0d6ccdbd4
commit
2e08018718
@@ -29,8 +29,7 @@
|
||||
"bn.js": "^5.1.1",
|
||||
"camelcase": "^5.3.1",
|
||||
"chalk": "^3.0.0",
|
||||
"ip-regex": "^4.1.0",
|
||||
"moment": "^2.24.0"
|
||||
"ip-regex": "^4.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/bn.js": "^4.11.6"
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
import { Logger, Logger$Data } from './types';
|
||||
|
||||
import chalk from 'chalk';
|
||||
import moment from 'moment';
|
||||
|
||||
import isBn from './is/bn';
|
||||
import isBuffer from './is/buffer';
|
||||
@@ -70,6 +69,18 @@ export function format (value: any): any {
|
||||
return value;
|
||||
}
|
||||
|
||||
function formatDate (date: Date): string {
|
||||
const year = date.getFullYear().toString();
|
||||
const month = (date.getMonth() + 1).toString().padStart(2, '0');
|
||||
const day = date.getDate().toString().padStart(2, '0');
|
||||
|
||||
const hour = date.getHours().toString().padStart(2, '0');
|
||||
const minute = date.getMinutes().toString().padStart(2, '0');
|
||||
const second = date.getSeconds().toString().padStart(2, '0');
|
||||
|
||||
return `${year}-${month}-${day} ${hour}:${minute}:${second}`;
|
||||
}
|
||||
|
||||
function apply (log: LogType, type: string, values: Logger$Data): void {
|
||||
if (values.length === 1 && isFunction(values[0])) {
|
||||
const fnResult = (values[0] as Function)();
|
||||
@@ -81,7 +92,7 @@ function apply (log: LogType, type: string, values: Logger$Data): void {
|
||||
chalked[log](value);
|
||||
|
||||
console[logTo[log] as 'log'](
|
||||
chalk(moment().format('YYYY-MM-DD HH:mm:ss')),
|
||||
chalk(formatDate(new Date())),
|
||||
chalk(type),
|
||||
...values.map(format)
|
||||
);
|
||||
|
||||
@@ -9176,11 +9176,6 @@ module-lookup-amd@^6.1.0:
|
||||
requirejs "^2.3.5"
|
||||
requirejs-config-file "^3.1.1"
|
||||
|
||||
moment@^2.24.0:
|
||||
version "2.24.0"
|
||||
resolved "https://registry.yarnpkg.com/moment/-/moment-2.24.0.tgz#0d055d53f5052aa653c9f6eb68bb5d12bf5c2b5b"
|
||||
integrity sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg==
|
||||
|
||||
move-concurrently@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92"
|
||||
|
||||
Reference in New Issue
Block a user