From 72a3b4ceeb7ee5f40b21b1a79a2de5a8c14a08f5 Mon Sep 17 00:00:00 2001 From: Sergei Zharinov <zharinov@users.noreply.github.com> Date: Tue, 27 Aug 2024 15:02:39 -0300 Subject: [PATCH] refactor(cdnjs): Use single cache namespace (#31032) --- lib/modules/datasource/cdnjs/index.ts | 9 ++++++--- lib/util/cache/package/types.ts | 1 - 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/modules/datasource/cdnjs/index.ts b/lib/modules/datasource/cdnjs/index.ts index f6730ff55c..85be4238d9 100644 --- a/lib/modules/datasource/cdnjs/index.ts +++ b/lib/modules/datasource/cdnjs/index.ts @@ -34,7 +34,10 @@ export class CdnjsDatasource extends Datasource { @cache({ namespace: `datasource-${CdnjsDatasource.id}`, - key: ({ packageName }: GetReleasesConfig) => packageName.split('/')[0], + key: ({ packageName }: GetReleasesConfig) => { + const library = packageName.split('/')[0]; + return `getReleases:${library}`; + }, }) async getReleases(config: GetReleasesConfig): Promise<ReleaseResult | null> { const result = Result.parse(config, ReleasesConfig) @@ -76,9 +79,9 @@ export class CdnjsDatasource extends Datasource { } @cache({ - namespace: `datasource-${CdnjsDatasource.id}-digest`, + namespace: `datasource-${CdnjsDatasource.id}`, key: ({ registryUrl, packageName }: DigestConfig, newValue: string) => - `${registryUrl}:${packageName}:${newValue}}`, + `getDigest:${registryUrl}:${packageName}:${newValue}}`, }) override async getDigest( config: DigestConfig, diff --git a/lib/util/cache/package/types.ts b/lib/util/cache/package/types.ts index 9d27504b69..c86caea8eb 100644 --- a/lib/util/cache/package/types.ts +++ b/lib/util/cache/package/types.ts @@ -34,7 +34,6 @@ export type PackageCacheNamespace = | 'datasource-bazel' | 'datasource-bitbucket-tags' | 'datasource-bitrise' - | 'datasource-cdnjs-digest' | 'datasource-cdnjs' | 'datasource-conan' | 'datasource-conda' -- GitLab