UNPKG

lerna-changelog

Version:

Generate a changelog for a lerna monorepo

40 lines (39 loc) 948 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const chalk = 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.hex("#0366d6")("█"), incomplete: chalk.level > 0 ? chalk.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();