Skip to content

Commit

Permalink
refactor(cdnjs): Use single cache namespace (#31032)
Browse files Browse the repository at this point in the history
  • Loading branch information
zharinov committed Aug 27, 2024
1 parent 308ccdc commit 72a3b4c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
9 changes: 6 additions & 3 deletions lib/modules/datasource/cdnjs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion lib/util/cache/package/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export type PackageCacheNamespace =
| 'datasource-bazel'
| 'datasource-bitbucket-tags'
| 'datasource-bitrise'
| 'datasource-cdnjs-digest'
| 'datasource-cdnjs'
| 'datasource-conan'
| 'datasource-conda'
Expand Down

0 comments on commit 72a3b4c

Please sign in to comment.