Skip to content

Commit

Permalink
feat(datasource)!: default to the central default versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
secustor committed Jun 28, 2023
1 parent e5574c6 commit 37a7e25
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/modules/datasource/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
});

Expand Down
5 changes: 3 additions & 2 deletions lib/modules/datasource/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import * as packageCache from '../../util/cache/package';
import { clone } from '../../util/clone';
import { regEx } from '../../util/regex';
import { trimTrailingSlash } from '../../util/url';
import { defaultVersioning } from '../versioning';
import * as allVersioning from '../versioning';
import datasources from './api';
import { addMetaData } from './metadata';
Expand Down Expand Up @@ -239,14 +240,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(
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/versioning/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type { VersioningApi, VersioningApiConstructor } from './types';

export * from './types';

const defaultVersioning = semverCoerced;
export const defaultVersioning = semverCoerced;

export const getVersioningList = (): string[] => Array.from(versionings.keys());
/**
Expand Down

0 comments on commit 37a7e25

Please sign in to comment.