UNPKG

@kazupon/lerna-changelog

Version:

Generate a changelog for a lerna monorepo

43 lines (42 loc) 1.14 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const chalk_1 = __importDefault(require("chalk")); const ProgressBar = require('progress'); class ProgressBarController { constructor() { this.bar = null; } init(title, total) { if (this.bar) { this.terminate(); } if (!process.stdout.isTTY) { return; } this.bar = new ProgressBar(`:bar ${title} (:percent)`, { total, complete: chalk_1.default.hex('#0366d6')('█'), incomplete: chalk_1.default.level > 0 ? chalk_1.default.gray('█') : '░', clear: true, width: 20 }); } tick() { if (this.bar) { this.bar.tick(1); } } clear() { if (this.bar) { this.bar.terminate(); } } terminate() { this.clear(); this.bar = null; } } exports.default = new ProgressBarController();