Skip to content

Proposal to integrate parse logic for npm configs #9

@kricsleo

Description

@kricsleo

Clear and concise description of the problem

The pickRegistry utility currently requires users to pass in already parsed npm configs:

npmConfigs: Record<string, unknown>,

Integrating the lookup and parse logic, similar to registry-url, would be convenient.
This way, other packages relying on this wouldn't have to implement it themselves. It's offen needed for packages like node-modules-inspector to determine the current npm registry URL for fetching metadata of private packages.

Suggested solution

Refactor pickRegistry to incorporate this feature, making npmConfigs optional or removing it.

export function pickRegistry(
scope: string | null | undefined,
npmConfigs: Record<string, unknown>,
defaultRegistry = NPM_REGISTRY,
): string {

For the lookup & parsing process:

Alternative

No response

Additional context

I'm willing to submit a PR for this. 🙌🏻

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions