From e2d1eeb3a5c7591dd9e7ce28cfe3d73506def139 Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Fri, 24 Apr 2020 17:12:20 +0200 Subject: [PATCH] fix(npm): cache known publicly-scoped packages --- lib/datasource/npm/get.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/datasource/npm/get.ts b/lib/datasource/npm/get.ts index dc670aa132..862ff3e21d 100644 --- a/lib/datasource/npm/get.ts +++ b/lib/datasource/npm/get.ts @@ -207,7 +207,17 @@ export async function getDependency( const cacheMinutes = process.env.RENOVATE_CACHE_NPM_MINUTES ? parseInt(process.env.RENOVATE_CACHE_NPM_MINUTES, 10) : 5; - if (!packageName.startsWith('@')) { + // TODO: use dynamic detection of public repos instead of a static list + const whitelistedPublicScopes = [ + '@graphql-codegen', + '@storybook', + '@types', + '@typescript-eslint', + ]; + if ( + whitelistedPublicScopes.includes(scope) || + !packageName.startsWith('@') + ) { await renovateCache.set(cacheNamespace, pkgUrl, dep, cacheMinutes); } return dep; -- GitLab