dist/index.js
/**
 * Sort packages by their out of date version (major, minor, patch)
 *
 * @param {Array} packages - List of package settings from yarn outdated
 * @returns Object of packages sorted by out of date version
 */
Sort packages by their out of date version (major, minor, patch)
@param {Array} packages - List of package settings from yarn outdated
@returns Object of packages sorted by out of date version
Sort packages by their out of date version ( major minor patch ) @param { Array } packages - List of package settings from yarn outdated @returns Object of packages sorted by out of date version
function groupPackagesByOutOfDateName(packages) {
    return packages.reduce((acc, packageInfo) => {
        const current = packageInfo[1];
        const latest = packageInfo[3];
        const packageName = packageInfo[0];
        if (latest === 'exotic') {
            core.debug(`Skipping check of ${packageName} since it's latest version is "exotic" (i.e. not found in package registry)`);
            return acc;
        }
        const currentMajor = semver_1.default.major(current);
        const latestMajor = semver_1.default.major(latest);
        const currentMinor = semver_1.default.minor(current);
        const latestMinor = semver_1.default.minor(latest);
        const preMajor = currentMajor === 0 || latestMajor === 0;
        const preMinor = preMajor && (currentMinor === 0 || latestMinor === 0);
        if (currentMajor !== latestMajor) {
            acc.major.push(packageInfo);
        }
        else if (currentMinor !== latestMinor) {
            if (preMajor) {
                acc.major.push(packageInfo);
            }
            else {
                acc.minor.push(packageInfo);
            }
        }
        else if (semver_1.default.patch(current) !== semver_1.default.patch(latest)) {
            if (preMinor) {
                acc.major.push(packageInfo);
            }
            else if (preMajor) {
                acc.minor.push(packageInfo);
            }
            else {
                acc.patch.push(packageInfo);
            }
        }
        return acc;
    }, {
        major: [],
        minor: [],
        patch: [],
    });
}
function groupPackagesByOutOfDateName ( packages ) { return packages . reduce ( ( acc , packageInfo ) => { const current = packageInfo [ 1 ] ; const latest = packageInfo [ 3 ] ; const packageName = packageInfo [ 0 ] ; if ( latest === 'exotic' ) { core . debug ( ` ${ packageName } ` ) ; return acc ; } const currentMajor = semver_1 . default . major ( current ) ; const latestMajor = semver_1 . default . major ( latest ) ; const currentMinor = semver_1 . default . minor ( current ) ; const latestMinor = semver_1 . default . minor ( latest ) ; const preMajor = currentMajor === 0 || latestMajor === 0 ; const preMinor = preMajor && ( currentMinor === 0 || latestMinor === 0 ) ; if ( currentMajor !== latestMajor ) { acc . major . push ( packageInfo ) ; } else if ( currentMinor !== latestMinor ) { if ( preMajor ) { acc . major . push ( packageInfo ) ; } else { acc . minor . push ( packageInfo ) ; } } else if ( semver_1 . default . patch ( current ) !== semver_1 . default . patch ( latest ) ) { if ( preMinor ) { acc . major . push ( packageInfo ) ; } else if ( preMajor ) { acc . minor . push ( packageInfo ) ; } else { acc . patch . push ( packageInfo ) ; } } return acc ; } , { major : [ ] , minor : [ ] , patch : [ ] , } ) ; }
Sort packages by their out of date version (major, minor, patch)
 @param {Array} packages - List of package settings from yarn outdated
 @returns Object of packages sorted by out of date version
Sort packages by their out of date version ( major minor patch ) @param { Array } packages - List of package settings from yarn outdated @returns Object of packages sorted by out of date version
// TODO: Support npm outdated format or convert to match this format // Skip dependencies which have "exotic" version (can be caused by pointing to a github repo in package file) // If the major version number is zero (0.x.x), treat a change of the // minor version number as a major change. // If the major & minor version numbers are zero (0.0.x), treat a // change of the patch version number as a major change. // If the major version number is zero (0.x.x), treat a change of the // patch version number as a minor change.