Files
renovate/lib/modules/versioning/deno/index.ts
Nahrin cc32f48c9c docs(versioning): replace bare links with descriptive markdown links in urls (#43951)
* fix(versioning): replace bare links with descriptive markdown links in urls

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor: export markdownLinkRegex from common.ts and import in test

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-15 06:30:54 +00:00

73 lines
1.9 KiB
TypeScript

import type { RangeStrategy } from '../../../types/versioning.ts';
import { api as npm } from '../npm/index.ts';
import type { NewValueConfig, VersioningApi } from '../types.ts';
export const id = 'deno';
export const displayName = 'deno';
export const urls = [
'[Deno - Package versions](https://docs.deno.com/runtime/fundamentals/modules/#package-versions)',
];
export const supportsRanges = true;
export const supportedRangeStrategies: RangeStrategy[] = [
'bump',
'pin',
'replace',
];
// If this is left as an alias, inputs like "17.04.0" throw errors
export function isValid(input: string): boolean {
// Allow "latest" as a valid version
// https://github.com/denoland/deno_semver/blob/fe7c48e72e09116d17a64f9e58e6b28d1669b8e5/src/npm.rs#L1486
if (input === 'latest') {
return true;
}
// the other, see the following test cases
// https://github.com/denoland/deno_semver/blob/fe7c48e72e09116d17a64f9e58e6b28d1669b8e5/src/npm.rs#L621
return npm.isValid(input);
}
export function getNewValue({
currentValue,
rangeStrategy,
currentVersion,
newVersion,
isReplacement,
}: NewValueConfig): string | null {
if (currentValue === 'latest') {
if (rangeStrategy === 'replace' || rangeStrategy === 'pin') {
return newVersion;
}
if (rangeStrategy === 'update-lockfile') {
return currentValue; // keep "latest" as is
}
// For other strategies (auto, future, in-range-only), treat as null
return null;
}
if (currentValue === '*') {
if (rangeStrategy === 'pin') {
return newVersion;
}
if (rangeStrategy === 'update-lockfile') {
return currentValue; // keep "*" as is
}
// For other strategies (auto, future, in-range-only), treat as null
return null;
}
return npm.getNewValue({
currentValue,
rangeStrategy,
currentVersion,
newVersion,
isReplacement,
});
}
export const api: VersioningApi = {
...npm,
isValid,
getNewValue,
};
export default api;