mirror of
https://github.com/renovatebot/renovate.git
synced 2024-12-22 21:48:32 +00:00
29 lines
789 B
TypeScript
29 lines
789 B
TypeScript
import { regEx } from '../../../util/regex';
|
|
import type { GenericVersion } from '../generic';
|
|
import { GenericVersioningApi } from '../generic';
|
|
import type { VersioningApi } from '../types';
|
|
|
|
export const id = 'git';
|
|
export const displayName = 'git';
|
|
export const urls = ['https://git-scm.com/'];
|
|
export const supportsRanges = false;
|
|
|
|
const regex = regEx('^[0-9a-f]{7,40}$', 'i');
|
|
|
|
class GitVersioningApi extends GenericVersioningApi {
|
|
protected _parse(version: string): GenericVersion | null {
|
|
if (version?.match(regex)) {
|
|
return { release: [1, 0, 0], suffix: version };
|
|
}
|
|
return null;
|
|
}
|
|
|
|
protected override _compare(_version: string, _other: string): number {
|
|
return -1;
|
|
}
|
|
}
|
|
|
|
export const api: VersioningApi = new GitVersioningApi();
|
|
|
|
export default api;
|