"use strict";
/* IMPORT */
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
const utils_1 = __importDefault(require("./utils"));
/* MAIN */
//TODO: Provide command suggestion for updating
//TODO: Check if using yarn
//TODO: Check if installed globally
//TODO: Check if installed as a dev dependency
//TODO: Check if installed as peer dependency
//TODO: Check for updates less often
//TODO: Annoy the user less
//TODO: Account for non-latest releases
//TODO: Don't output anything if the output is being piped somewhere
const updater = async ({ name, version }) => {
    const latest = await utils_1.default.getLatestVersion(name).catch(() => undefined);
    if (!latest)
        return false;
    if (!utils_1.default.isUpdateAvailable(version, latest))
        return false;
    utils_1.default.notify(name, version, latest);
    return true;
};
/* EXPORT */
module.exports = updater;
module.exports.default = updater;
Object.defineProperty(module.exports, "__esModule", { value: true });
