diff --git a/lib/modules/datasource/flutter-version/index.ts b/lib/modules/datasource/flutter-version/index.ts index a28bb1839d08a7e..803da054fa0cbc1 100644 --- a/lib/modules/datasource/flutter-version/index.ts +++ b/lib/modules/datasource/flutter-version/index.ts @@ -1,4 +1,5 @@ import { regEx } from '../../../util/regex'; +import { id as semverId } from '../../versioning/semver'; import { Datasource } from '../datasource'; import type { GetReleasesConfig, ReleaseResult } from '../types'; import type { FlutterResponse } from './types'; @@ -18,6 +19,8 @@ export class FlutterVersionDatasource extends Datasource { override readonly caching = true; + override readonly defaultVersioning = semverId; + async getReleases({ registryUrl, }: GetReleasesConfig): Promise { diff --git a/lib/modules/datasource/hexpm-bob/index.ts b/lib/modules/datasource/hexpm-bob/index.ts index b298cf39a94af62..fb07083aa1d51f3 100644 --- a/lib/modules/datasource/hexpm-bob/index.ts +++ b/lib/modules/datasource/hexpm-bob/index.ts @@ -3,6 +3,7 @@ import { logger } from '../../../logger'; import { ExternalHostError } from '../../../types/errors/external-host-error'; import { cache } from '../../../util/cache/package/decorator'; import { HttpError } from '../../../util/http'; +import { id as semverId } from '../../versioning/semver'; import { Datasource } from '../datasource'; import type { GetReleasesConfig, ReleaseResult } from '../types'; import { datasource, defaultRegistryUrl } from './common'; @@ -21,6 +22,8 @@ export class HexpmBobDatasource extends Datasource { override readonly caching = true; + override readonly defaultVersioning = semverId; + @cache({ namespace: `datasource-${datasource}`, key: ({ registryUrl, packageName }: GetReleasesConfig) => diff --git a/lib/modules/datasource/index.spec.ts b/lib/modules/datasource/index.spec.ts index 8b8dac55d090c1a..e5c91e2c88e8a23 100644 --- a/lib/modules/datasource/index.spec.ts +++ b/lib/modules/datasource/index.spec.ts @@ -114,7 +114,7 @@ describe('modules/datasource/index', () => { describe('getDefaultVersioning()', () => { it('returns semver if undefined', () => { - expect(getDefaultVersioning(undefined)).toBe('semver'); + expect(getDefaultVersioning(undefined)).toBe('semver-coerced'); }); }); diff --git a/lib/modules/datasource/index.ts b/lib/modules/datasource/index.ts index f9529ddfe1c6128..1daa4630569d727 100644 --- a/lib/modules/datasource/index.ts +++ b/lib/modules/datasource/index.ts @@ -10,6 +10,7 @@ import { regEx } from '../../util/regex'; import { Result } from '../../util/result'; import { uniq } from '../../util/uniq'; import { trimTrailingSlash } from '../../util/url'; +import { defaultVersioning } from '../versioning'; import * as allVersioning from '../versioning'; import datasources from './api'; import { addMetaData } from './metadata'; @@ -241,14 +242,14 @@ export function getDefaultVersioning( datasourceName: string | undefined ): string { if (!datasourceName) { - return 'semver'; + return defaultVersioning.id; } const datasource = getDatasourceFor(datasourceName); // istanbul ignore if: wrong regex manager config? if (!datasource) { logger.warn({ datasourceName }, 'Missing datasource!'); } - return datasource?.defaultVersioning ?? 'semver'; + return datasource?.defaultVersioning ?? defaultVersioning.id; } function applyReplacements( diff --git a/lib/modules/versioning/index.ts b/lib/modules/versioning/index.ts index 0346a213a622a6d..893d05a68de8642 100644 --- a/lib/modules/versioning/index.ts +++ b/lib/modules/versioning/index.ts @@ -1,9 +1,12 @@ import versionings from './api'; import { Versioning } from './schema'; +import * as semverCoerced from './semver-coerced'; import type { VersioningApi, VersioningApiConstructor } from './types'; export * from './types'; +export const defaultVersioning = semverCoerced; + export const getVersioningList = (): string[] => Array.from(versionings.keys()); /** * Get versioning map. Can be used to dynamically add new versioning type