Skip to content

Commit

Permalink
refactor: dep
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins committed Sep 18, 2023
1 parent 8781921 commit f1ff591
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
10 changes: 0 additions & 10 deletions lib/modules/manager/npm/extract/common/dep-name.ts

This file was deleted.

9 changes: 9 additions & 0 deletions lib/modules/manager/npm/extract/common/dependency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/npm/extract/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

0 comments on commit f1ff591

Please sign in to comment.