mirror of
https://github.com/renovatebot/renovate.git
synced 2026-11-01 10:09:50 +00:00
930cf6633c
fix: Additional vi.mock path corrections and prettier formatting
31 lines
944 B
TypeScript
31 lines
944 B
TypeScript
import { regEx } from '../../../util/regex.ts';
|
|
import { GithubReleasesDatasource } from '../../datasource/github-releases/index.ts';
|
|
import * as semverVersioning from '../../versioning/semver/index.ts';
|
|
import type { PackageDependency, PackageFileContent } from '../types.ts';
|
|
|
|
const scalafmtVersionRegex = regEx(
|
|
'version *= *"?(?<version>\\d+\\.\\d+\\.\\d+)"?',
|
|
);
|
|
|
|
export function extractPackageFile(content: string): PackageFileContent | null {
|
|
const regexResult = scalafmtVersionRegex.exec(content);
|
|
const scalafmtVersion = regexResult?.groups?.version;
|
|
|
|
if (!scalafmtVersion) {
|
|
return null;
|
|
}
|
|
|
|
const scalafmtDependency: PackageDependency = {
|
|
datasource: GithubReleasesDatasource.id,
|
|
depName: 'scalafmt',
|
|
packageName: 'scalameta/scalafmt',
|
|
versioning: semverVersioning.id,
|
|
currentValue: scalafmtVersion,
|
|
extractVersion: '^v(?<version>\\S+)',
|
|
};
|
|
|
|
return {
|
|
deps: [scalafmtDependency],
|
|
};
|
|
}
|