mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-13 15:36:25 +00:00
feat(datasource)!: default to the central default versioning (#23020)
BREAKING CHANGE: semver-coerced is now the default versioning
This commit is contained in:
parent
f9e3e80e0c
commit
8ccb0eaae2
5 changed files with 13 additions and 3 deletions
|
@ -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<ReleaseResult | null> {
|
||||
|
|
|
@ -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) =>
|
||||
|
|
|
@ -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');
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue