From f1ff59173cc32ac5a447299344969ff2d7f8740d Mon Sep 17 00:00:00 2001 From: Rhys Arkins Date: Fri, 15 Sep 2023 13:19:00 +0200 Subject: [PATCH] refactor: dep --- lib/modules/manager/npm/extract/common/dep-name.ts | 10 ---------- lib/modules/manager/npm/extract/common/dependency.ts | 9 +++++++++ lib/modules/manager/npm/extract/index.ts | 2 +- 3 files changed, 10 insertions(+), 11 deletions(-) delete mode 100644 lib/modules/manager/npm/extract/common/dep-name.ts diff --git a/lib/modules/manager/npm/extract/common/dep-name.ts b/lib/modules/manager/npm/extract/common/dep-name.ts deleted file mode 100644 index 77e8361db65e97..00000000000000 --- a/lib/modules/manager/npm/extract/common/dep-name.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { regEx } from '../../../../../util/regex'; - -export function parseDepName(depType: string, key: string): string { - if (depType !== 'resolutions') { - return key; - } - - const [, depName] = regEx(/((?:@[^/]+\/)?[^/@]+)$/).exec(key) ?? []; - return depName; -} diff --git a/lib/modules/manager/npm/extract/common/dependency.ts b/lib/modules/manager/npm/extract/common/dependency.ts index 8b92af905212eb..c83b669d65dbd2 100644 --- a/lib/modules/manager/npm/extract/common/dependency.ts +++ b/lib/modules/manager/npm/extract/common/dependency.ts @@ -12,6 +12,15 @@ const RE_REPOSITORY_GITHUB_SSH_FORMAT = regEx( /(?:git@)github.com:([^/]+)\/([^/.]+)(?:\.git)?/ ); +export function parseDepName(depType: string, key: string): string { + if (depType !== 'resolutions') { + return key; + } + + const [, depName] = regEx(/((?:@[^/]+\/)?[^/@]+)$/).exec(key) ?? []; + return depName; +} + export function extractDependency( depType: string, depName: string, diff --git a/lib/modules/manager/npm/extract/index.ts b/lib/modules/manager/npm/extract/index.ts index ebc63a3a47df4e..7f4cd8353f046f 100644 --- a/lib/modules/manager/npm/extract/index.ts +++ b/lib/modules/manager/npm/extract/index.ts @@ -15,8 +15,8 @@ import type { NpmLockFiles, NpmManagerData } from '../types'; import { extractDependency, getExtractedConstraints, + parseDepName, } from './common/dependency'; -import { parseDepName } from './common/dep-name'; import { setNodeCommitTopic } from './common/node'; import { extractOverrideDepsRec } from './common/overrides'; import { postExtract } from './post';