renovate/lib/manager/batect-wrapper/extract.ts

29 lines
880 B
TypeScript
Raw Normal View History

import { id as githubReleaseDatasource } from '../../datasource/github-releases';
import { logger } from '../../logger';
import { regEx } from '../../util/regex';
import { id as semverVersioning } from '../../versioning/semver';
2021-03-02 20:44:55 +00:00
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: githubReleaseDatasource,
versioning: semverVersioning,
};
logger.trace(dependency, 'Found Batect wrapper version');
return { deps: [dependency] };
}