UNPKG

ffbt

Version:

Build a Typescript app without pain

30 lines (29 loc) 1.32 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.printWebpackStats = void 0; const chalk_1 = require("chalk"); function getTimeString() { const dateNow = new Date(); const hoursString = String(dateNow.getHours()).padStart(2, "0"); const minutesString = String(dateNow.getMinutes()).padStart(2, "0"); const secondsString = String(dateNow.getSeconds()).padStart(2, "0"); return `${hoursString}:${minutesString}:${secondsString}`; } const printWebpackStats = (settings) => { return (error, stats) => { const startTime = (stats === null || stats === void 0 ? void 0 : stats.startTime) || NaN; const endTime = (stats === null || stats === void 0 ? void 0 : stats.endTime) || NaN; const buildDuration = endTime - startTime; const prettyBuildDuration = isNaN(buildDuration) ? chalk_1.bold(chalk_1.red("unknown")) : `${chalk_1.bold(buildDuration)}ms`; console.log(); console.log(`🛠 Built at ${getTimeString()}`); if (settings === "minimal") { console.log(` Time: ${prettyBuildDuration}`); } console.log(stats === null || stats === void 0 ? void 0 : stats.toString(settings)); console.log(); }; }; exports.printWebpackStats = printWebpackStats;