soccer-go
Version:
Soccer CLI for stats and results.
26 lines (25 loc) • 934 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.checkForUpdates = checkForUpdates;
const picocolors_1 = __importDefault(require("picocolors"));
const update_check_1 = __importDefault(require("update-check"));
let didCheckForUpdate = false;
async function checkForUpdates(manifest) {
if (didCheckForUpdate)
return;
try {
const result = await (0, update_check_1.default)(manifest);
if (result) {
console.log('\n', picocolors_1.default.bgRed(picocolors_1.default.bold(' UPDATE ')), `📦 Update available for ${picocolors_1.default.bold('soccer-go')}: ${manifest.version} → ${result.latest}\n`);
}
}
catch {
// Don't do anything
}
finally {
didCheckForUpdate = true;
}
}