check-deps-versions
Advanced tools
Comparing version 0.0.7 to 0.0.8
26
index.js
@@ -25,2 +25,19 @@ const chalk = require('chalk'); | ||
const diffColorMap = { // Traffic light here :) | ||
major: 'red', | ||
minor: 'yellow', | ||
patch: 'green' | ||
}; | ||
const getDiff = (range, version) => { | ||
if (range.indexOf(' ') !== -1) { | ||
return ''; | ||
} | ||
const rangeVersion = range.replace(/^[^0-9]+/, ''); | ||
const diff = semver.diff(rangeVersion, version); | ||
return diffColorMap[diff] ? chalk[diffColorMap[diff]](diff) : diff; | ||
}; | ||
const getPackageUpdates = (packageName, localRange) => | ||
@@ -42,3 +59,4 @@ packageJson(packageName).then(result => { | ||
current: localRange, | ||
latest: latestVersion | ||
latest: latestVersion, | ||
diff: getDiff(localRange, latestVersion) | ||
}; | ||
@@ -75,3 +93,4 @@ } | ||
chalk.red.underline('current'), | ||
chalk.green.underline('latest') | ||
chalk.green.underline('latest'), | ||
'' | ||
]; | ||
@@ -90,3 +109,4 @@ | ||
updates[packageName].current, | ||
updates[packageName].latest | ||
updates[packageName].latest, | ||
updates[packageName].diff | ||
])); | ||
@@ -93,0 +113,0 @@ const tableStr = table(rows, { stringLength: coloredStringLength }); |
{ | ||
"name": "check-deps-versions", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "Check if dependencies specified in package.json are up to date with the latest available versions.", | ||
@@ -5,0 +5,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5722
100