ts-minifer
Version:
Advanced TypeScript code minification and compression tool
40 lines • 1.41 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Logger = void 0;
const chalk_1 = __importDefault(require("chalk"));
class Logger {
constructor(verbose = false) {
this.verbose = verbose;
}
info(message) {
console.log(chalk_1.default.blue(`[INFO] ${message}`));
}
warn(message) {
console.warn(chalk_1.default.yellow(`[WARN] ${message}`));
}
error(message) {
console.error(chalk_1.default.red(`[ERROR] ${message}`));
}
debug(message) {
if (this.verbose) {
console.log(chalk_1.default.gray(`[DEBUG] ${message}`));
}
}
progress(current, total, message) {
const percentage = Math.round((current / total) * 100);
const progressBar = this.createProgressBar(percentage);
if (this.verbose) {
console.log(chalk_1.default.cyan(`[PROGRESS] ${progressBar} ${percentage}% ${message || ''}`));
}
}
createProgressBar(percentage, width = 30) {
const completed = Math.round((width * percentage) / 100);
const remaining = width - completed;
return `[${'='.repeat(completed)}${' '.repeat(remaining)}]`;
}
}
exports.Logger = Logger;
//# sourceMappingURL=logger.js.map