diff --git a/bin/lifion-verify-deps.js b/bin/lifion-verify-deps.js index c062267..f1dc34d 100755 --- a/bin/lifion-verify-deps.js +++ b/bin/lifion-verify-deps.js @@ -4,12 +4,13 @@ const argv = require('minimist')(process.argv.slice(2)); const verifyDeps = require('../lib'); +const { name } = require('../package.json'); if (argv.help) { console.log( [ '', - 'Usage: lifion-verify-deps [options]', + `Usage: ${name} [options]`, '', 'Checks existing dependencies for available updates', '', @@ -18,11 +19,11 @@ if (argv.help) { '-u --auto-upgrade Automatically run all suggested upgrades' ].join('\n') ); + return; } async function run() { - const { 'auto-upgrade': autoUpgradeLong, u: autoUpgradeShort } = argv; - const autoUpgrade = autoUpgradeLong || autoUpgradeShort; + const autoUpgrade = argv['auto-upgrade'] || argv.u; try { await verifyDeps({ autoUpgrade, dir: process.cwd() }); process.exit(0); diff --git a/lib/index.js b/lib/index.js index a3c879c..dc42b27 100644 --- a/lib/index.js +++ b/lib/index.js @@ -71,7 +71,6 @@ function getPkgIds(filteredPkgs) { * @param {string} [options.dir] - The path where to look for the package.json file. * @param {object} [options.logger] - A logger instance, with a similar API as the console object. */ - async function verifyDeps({ autoUpgrade = false, dir, logger = console } = {}) { const { dependencies, devDependencies } = require(path.join(dir, 'package.json')); logger.info(blue('Checking NPM module versions…\n')); @@ -93,12 +92,12 @@ async function verifyDeps({ autoUpgrade = false, dir, logger = console } = {}) { } if (autoUpgrade) { - logger.info('UPGRADING...'); + logger.info('UPGRADING…'); logger.info(upgradePackages); const prodResult = await execAsync(`npm i ${getPkgIds(prodPkgs)}`); const devResult = await execAsync(`npm i -D ${getPkgIds(devPkgs)}`); - logger.info(`${green(`${bold('Upgraded Dependencies:\n')}${prodResult.stdout}`)}`); - logger.info(`${green(`${bold('Upgraded Dev Dependencies:\n')}${devResult.stdout}`)}`); + logger.info(`${green(`${bold('Upgraded dependencies:\n')}${prodResult.stdout}`)}`); + logger.info(`${green(`${bold('Upgraded development dependencies:\n')}${devResult.stdout}`)}`); } else { logger.info(`\n${bold('To resolve this, run:')}`); logger.info(upgradePackages); diff --git a/lib/index.test.js b/lib/index.test.js index aa9928a..c0ddbdd 100644 --- a/lib/index.test.js +++ b/lib/index.test.js @@ -284,13 +284,13 @@ describe('lib/index', () => { 3, `${outdatedDevDep} is outdated: ${olderVersion} → ${newerVersion}` ); - expect(logger.info).toHaveBeenNthCalledWith(4, 'UPGRADING...'); + expect(logger.info).toHaveBeenNthCalledWith(4, 'UPGRADING…'); expect(logger.info).toHaveBeenNthCalledWith( 5, `npm i ${outdatedDep}@1.0.1 \nnpm i -D ${outdatedDevDep}@1.0.1 ` ); - expect(logger.info).toHaveBeenNthCalledWith(6, `Upgraded Dependencies:\n["1.0.0"]`); - expect(logger.info).toHaveBeenNthCalledWith(7, `Upgraded Dev Dependencies:\n["1.0.0"]`); + expect(logger.info).toHaveBeenNthCalledWith(6, `Upgraded dependencies:\n["1.0.0"]`); + expect(logger.info).toHaveBeenNthCalledWith(7, `Upgraded development dependencies:\n["1.0.0"]`); }); }); diff --git a/package-lock.json b/package-lock.json index be0a0b0..bc7dc72 100644 --- a/package-lock.json +++ b/package-lock.json @@ -947,8 +947,8 @@ }, "agent-base": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.3.0.tgz", - "integrity": "sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==", + "resolved": "https://artifactory.lifion.oneadp.com:443/artifactory/api/npm/ohcm-npms/agent-base/-/agent-base-4.3.0.tgz", + "integrity": "sha1-gWXwHENgCbzK0LHRIvBe13Dvxu4=", "dev": true, "requires": { "es6-promisify": "^5.0.0" @@ -1085,7 +1085,7 @@ }, "argv": { "version": "0.0.2", - "resolved": "https://registry.npmjs.org/argv/-/argv-0.0.2.tgz", + "resolved": "https://artifactory.lifion.oneadp.com:443/artifactory/api/npm/ohcm-npms/argv/-/argv-0.0.2.tgz", "integrity": "sha1-7L0W+JSbFXGDcRsb2jNPN4QBhas=", "dev": true }, @@ -1886,7 +1886,7 @@ }, "check-engines": { "version": "1.5.0", - "resolved": "https://registry.npmjs.org/check-engines/-/check-engines-1.5.0.tgz", + "resolved": "https://artifactory.lifion.oneadp.com:443/artifactory/api/npm/ohcm-npms/check-engines/-/check-engines-1.5.0.tgz", "integrity": "sha1-L3TqlJ3wnFEPh3rFGai5HBx7F6Q=", "dev": true, "requires": { @@ -2125,16 +2125,17 @@ "dev": true }, "codecov": { - "version": "3.6.1", - "resolved": "https://registry.npmjs.org/codecov/-/codecov-3.6.1.tgz", - "integrity": "sha512-IUJB6WG47nWK7o50etF8jBadxdMw7DmoQg05yIljstXFBGB6clOZsIj6iD4P82T2YaIU3qq+FFu8K9pxgkCJDQ==", + "version": "3.6.2", + "resolved": "https://artifactory.lifion.oneadp.com:443/artifactory/api/npm/ohcm-npms/codecov/-/codecov-3.6.2.tgz", + "integrity": "sha1-lQNTPXRCM/aGT48+rZQ10oXtP0c=", "dev": true, "requires": { "argv": "^0.0.2", "ignore-walk": "^3.0.1", "js-yaml": "^3.13.1", "teeny-request": "^3.11.3", - "urlgrey": "^0.4.4" + "urlgrey": "^0.4.4", + "validator": "^12.1.0" } }, "collect-all": { @@ -2778,13 +2779,13 @@ }, "es6-promise": { "version": "4.2.8", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", - "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==", + "resolved": "https://artifactory.lifion.oneadp.com:443/artifactory/api/npm/ohcm-npms/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha1-TrIVlMlyvEBVPSduUQU5FD21Pgo=", "dev": true }, "es6-promisify": { "version": "5.0.0", - "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", + "resolved": "https://artifactory.lifion.oneadp.com:443/artifactory/api/npm/ohcm-npms/es6-promisify/-/es6-promisify-5.0.0.tgz", "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", "dev": true, "requires": { @@ -4902,8 +4903,8 @@ }, "https-proxy-agent": { "version": "2.2.4", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz", - "integrity": "sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg==", + "resolved": "https://artifactory.lifion.oneadp.com:443/artifactory/api/npm/ohcm-npms/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz", + "integrity": "sha1-TuenN6vZJniik9mzShr00NCMeHs=", "dev": true, "requires": { "agent-base": "^4.3.0", @@ -5098,8 +5099,8 @@ }, "ignore-walk": { "version": "3.0.3", - "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.3.tgz", - "integrity": "sha512-m7o6xuOaT1aqheYHKf8W6J5pYH85ZI9w077erOzLje3JsB1gkafkAhHHY19dqjulgIZHFm32Cp5uNZgcQqdJKw==", + "resolved": "https://artifactory.lifion.oneadp.com:443/artifactory/api/npm/ohcm-npms/ignore-walk/-/ignore-walk-3.0.3.tgz", + "integrity": "sha1-AX4kRxhL/q3nwjjkrv3R6PlbHjc=", "dev": true, "requires": { "minimatch": "^3.0.4" @@ -8112,7 +8113,7 @@ }, "minimist": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "resolved": "https://artifactory.lifion.oneadp.com:443/artifactory/api/npm/ohcm-npms/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" }, "mixin-deep": { @@ -9568,8 +9569,8 @@ }, "semver": { "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" + "resolved": "https://artifactory.lifion.oneadp.com:443/artifactory/api/npm/ohcm-npms/semver/-/semver-6.3.0.tgz", + "integrity": "sha1-7gpkyK9ejO6mdoexM3YeG+y9HT0=" }, "semver-compare": { "version": "1.0.0", @@ -10238,8 +10239,8 @@ }, "teeny-request": { "version": "3.11.3", - "resolved": "https://registry.npmjs.org/teeny-request/-/teeny-request-3.11.3.tgz", - "integrity": "sha512-CKncqSF7sH6p4rzCgkb/z/Pcos5efl0DmolzvlqRQUNcpRIruOhY9+T1FsIlyEbfWd7MsFpodROOwHYh2BaXzw==", + "resolved": "https://artifactory.lifion.oneadp.com:443/artifactory/api/npm/ohcm-npms/teeny-request/-/teeny-request-3.11.3.tgz", + "integrity": "sha1-M1xin3ZF5dZZk2LfLzIwxMvCOlU=", "dev": true, "requires": { "https-proxy-agent": "^2.2.1", @@ -10839,7 +10840,7 @@ }, "urlgrey": { "version": "0.4.4", - "resolved": "https://registry.npmjs.org/urlgrey/-/urlgrey-0.4.4.tgz", + "resolved": "https://artifactory.lifion.oneadp.com:443/artifactory/api/npm/ohcm-npms/urlgrey/-/urlgrey-0.4.4.tgz", "integrity": "sha1-iS/pWWCAXoVRnxzUOJ8stMu3ZS8=", "dev": true }, @@ -10887,6 +10888,12 @@ "spdx-expression-parse": "^3.0.0" } }, + "validator": { + "version": "12.1.0", + "resolved": "https://artifactory.lifion.oneadp.com:443/artifactory/api/npm/ohcm-npms/validator/-/validator-12.1.0.tgz", + "integrity": "sha1-o6cxXVI4y8FeRq2NXkear6cRmSU=", + "dev": true + }, "verror": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", diff --git a/package.json b/package.json index f63c470..21d151d 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "auto-changelog": "^1.16.2", "chance": "^1.1.4", "check-engines": "^1.5.0", - "codecov": "^3.6.1", + "codecov": "^3.6.2", "eslint": "^6.8.0", "eslint-config-lifion": "^1.3.3", "husky": "^3.1.0",