patch-pulse
Version:
Check for outdated npm dependencies
26 lines • 969 B
JavaScript
import { parseVersion } from './parseVersion.js';
/**
* Checks if the current version is outdated compared to the latest version
* @returns True if the current version is outdated, false otherwise
*/
export function isVersionOutdated({ current, latest, }) {
try {
const currentVersion = parseVersion(current);
const latestVersion = parseVersion(latest);
// Compare major, minor, and patch versions
if (latestVersion.major > currentVersion.major)
return true;
if (latestVersion.major < currentVersion.major)
return false;
if (latestVersion.minor > currentVersion.minor)
return true;
if (latestVersion.minor < currentVersion.minor)
return false;
return latestVersion.patch > currentVersion.patch;
}
catch {
// If version parsing fails, assume it's not outdated
return false;
}
}
//# sourceMappingURL=isVersionOutdated.js.map