0
0
Fork 0
mirror of https://github.com/renovatebot/renovate.git synced 2025-05-12 23:51:55 +00:00
renovatebot_renovate/lib/modules/manager/ansible-galaxy/collections-metadata.ts
renovate[bot] 55845508b6
chore(deps): update eslint monorepo to v9 (major) (#33573)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2025-02-20 11:31:13 +00:00

32 lines
1.1 KiB
TypeScript

import { GalaxyCollectionDatasource } from '../../datasource/galaxy-collection';
import type { PackageDependency } from '../types';
import { dependencyRegex, galaxyRegEx } from './util';
export function extractCollectionsMetaDataFile(
lines: string[],
): PackageDependency[] {
const deps: PackageDependency[] = [];
// in a galaxy.yml the dependency map is inside a `dependencies:` block
let foundDependencyBlock = false;
for (const line of lines) {
if (dependencyRegex.exec(line)) {
foundDependencyBlock = true;
} else if (foundDependencyBlock) {
// expects a line like this ` ansible.windows: "1.4.0"`
const galaxyRegExResult = galaxyRegEx.exec(line);
if (galaxyRegExResult?.groups) {
const dep: PackageDependency = {
depType: 'galaxy-collection',
datasource: GalaxyCollectionDatasource.id,
depName: galaxyRegExResult.groups.packageName,
currentValue: galaxyRegExResult.groups.version,
};
deps.push(dep);
} else {
// if we can not match additional lines, the block has ended.
break;
}
}
}
return deps;
}