renovate/lib/modules/manager/batect-wrapper/extract.ts
Rhys Arkins dca3418bbd refactor: lib/modules (#14488)
Moves datasource, manager, platform and versioning code from lib/ into new lib/modules/

BREAKING CHANGE: External tools must update paths to datasource, manager, platform and versioning
2022-03-04 09:04:02 +01:00

28 lines
885 B
TypeScript

import { logger } from '../../../logger';
import { regEx } from '../../../util/regex';
import { GithubReleasesDatasource } from '../../datasource/github-releases';
import { id as semverVersioning } from '../../versioning/semver';
import type { PackageDependency, PackageFile } from '../types';
const VERSION_REGEX = regEx(/^\s+VERSION="(.*)"$/m);
export function extractPackageFile(fileContent: string): PackageFile | null {
logger.trace('batect.extractPackageFile()');
const match = VERSION_REGEX.exec(fileContent);
if (match === null) {
return null;
}
const dependency: PackageDependency = {
depName: 'batect/batect',
commitMessageTopic: 'Batect',
currentValue: match[1],
datasource: GithubReleasesDatasource.id,
versioning: semverVersioning,
};
logger.trace(dependency, 'Found Batect wrapper version');
return { deps: [dependency] };
}