UNPKG

foxman

Version:
30 lines (25 loc) 825 B
const { system, logger, consts } = require('@foxman/helpers'); const { checkVersion } = system; const pkg = require('../package.json'); const { ERRORTIPS } = consts; module.exports = function(upgrade = {}) { if (upgrade !== undefined && upgrade.version !== undefined) { let notify = [ `Expect foxman version to be higher than v${upgrade.version} in current project!` ]; if (upgrade.notify && upgrade.notify.length > 0) { notify = upgrade.notify; } if ( !checkVersion({ version: pkg.version, versionMin: upgrade.version }) ) { notify.forEach(logger.error); logger.error(ERRORTIPS.INSTALL_LATEST_FOXMAN); return false; } } return true; };