dist/index.js
/**
 * Get output of yarn outdated command parsed as JSON
 * Item format: [packageName, current, wanted, latest, depTypeListName]
 *
 * @param {string} basePath - Base path of package.json
 * @returns Output of outdated command in JSON format
 */
Get output of yarn outdated command parsed as JSON
Item format: [packageName, current, wanted, latest, depTypeListName]

@param {string} basePath - Base path of package.json
@returns Output of outdated command in JSON format
Get output of yarn outdated command parsed as JSON Item format : [ packageName current wanted latest depTypeListName ] @param { string } basePath - Base path of package . json @returns Output of outdated command in JSON format
async function yarnOutdated(basePath) {
    const args = ['outdated', '--json'];
    if (basePath) {
        args.push('--cwd');
        args.push(basePath);
    }
    let outputData = '';
    let errorData = '';
    try {
        const options = {
            listeners: {
                stdout: (data) => {
                    outputData += data.toString();
                },
                stderr: (data) => {
                    errorData += data.toString();
                },
            },
        };
        await exec.exec('yarn', args, options);
        if (errorData) {
            core.error(`Yarn outdated command emitted an error: ${errorData}`);
            throw new Error(errorData);
        }
        return [];
    }
    catch (err) {
        try {
            const outdatedDataStr = outputData.match(/{"type":"table"(.*}})/)?.[0] || '';
            core.debug(`Output of parsing yarn outdated command: ${outdatedDataStr}`);
            const outdatedData = JSON.parse(outdatedDataStr);
            return outdatedData?.data?.body || [];
        }
        catch (err2) {
            const { message } = err2;
            core.error(`Error parsing results of yarn outdated command: ${message}`);
            throw err2;
        }
    }
}
async function yarnOutdated ( basePath ) { const args = [ 'outdated' , '--json' ] ; if ( basePath ) { args . push ( '--cwd' ) ; args . push ( basePath ) ; } let outputData = '' ; let errorData = '' ; try { const options = { listeners : { stdout : ( data ) => { outputData += data . toString ( ) ; } , stderr : ( data ) => { errorData += data . toString ( ) ; } , } , } ; await exec . exec ( 'yarn' , args , options ) ; if ( errorData ) { core . error ( ` ${ errorData } ` ) ; throw new Error ( errorData ) ; } return [ ] ; } catch ( err ) { try { const outdatedDataStr = outputData . match ( / {"type":"table"(.*}}) / ) ?. [ 0 ] || '' ; core . debug ( ` ${ outdatedDataStr } ` ) ; const outdatedData = JSON . parse ( outdatedDataStr ) ; return outdatedData ?. data ?. body || [ ] ; } catch ( err2 ) { const { message } = err2 ; core . error ( ` ${ message } ` ) ; throw err2 ; } } }
Get output of yarn outdated command parsed as JSON
 Item format: [packageName, current, wanted, latest, depTypeListName]
Get output of yarn outdated command parsed as JSON Item format : [ packageName current wanted latest depTypeListName ]
// Handle errors thrown in outdated command // If command doesn't throw, then there are no packages out of date // Output is in json-lines format - use Regex to handle different newline characters