import { GalaxyCollectionDatasource } from '../../datasource/galaxy-collection' ; import type { PackageDependency } from '../types' ; import { dependencyRegex , galaxyRegEx } from './util' ; export function extractCollectionsMetaDataFile ( lines ) { const deps = [ ] ; let foundDependencyBlock = false ; for ( let lineNumber = 0 ; lineNumber < lines . length ; lineNumber += 1 ) { const line = lines [ lineNumber ] ; if ( dependencyRegex . exec ( line ) ) { foundDependencyBlock = true ; } else if ( foundDependencyBlock ) { const galaxyRegExResult = galaxyRegEx . exec ( line ) ; if ( galaxyRegExResult ) { const dep = { depType : 'galaxy-collection' , datasource : GalaxyCollectionDatasource . id , depName : galaxyRegExResult . groups . lookupName , currentValue : galaxyRegExResult . groups . version , } ; deps . push ( dep ) ; } else { break ; } } } return deps ; }