import { logger } from '../../logger' ; import { api as composer } from '../../versioning/composer' ; import type { UpdateLockedConfig , UpdateLockedResult } from '../types' ; import type { ComposerLock } from './types' ; export function updateLockedDependency ( config ) { const { depName , currentVersion , newVersion , lockFile , lockFileContent } = config ; logger . debug ( `composer.updateLockedDependency: ${ depName }@${ currentVersion } -> ${ newVersion } [${ lockFile }]` ) ; try { const locked = JSON . parse ( lockFileContent ) as ComposerLock ; if ( locked . packages ?. find ( ( entry ) => entry . name === depName && composer . equals ( entry . version || '' , newVersion ) ) ) { return { status : 'already-updated' } ; } return { status : 'unsupported' } ; } catch ( err ) { logger . debug ( { err } , 'composer.updateLockedDependency() error' ) ; return { status : 'update-failed' } ; } }