Skip to content

feat(config.reader): export getNetworkConfigs and getDefaultCreds#11471

Merged
zkochan merged 1 commit into
mainfrom
export-network-configs
May 5, 2026
Merged

feat(config.reader): export getNetworkConfigs and getDefaultCreds#11471
zkochan merged 1 commit into
mainfrom
export-network-configs

Conversation

@zkochan

@zkochan zkochan commented May 5, 2026

Copy link
Copy Markdown
Member

Summary

  • Re-export getNetworkConfigs, getDefaultCreds, and the NetworkConfigs type from @pnpm/config.reader.
  • Both helpers already exist in getNetworkConfigs.ts and are used internally by getConfig to build pnpmConfig.configByUri. They're shipped to lib/ but blocked from deep imports by the package's exports field.

Motivation

Downstream consumers of @pnpm/installing.client and @pnpm/store.connection-manager need to provide a configByUri: Record<string, RegistryConfig> argument. The only way to derive that map from a flat npmrc-style auth dict (the shape returned by, e.g., bit's getAuthConfig) is to re-implement pnpm's parsing logic, which keeps drifting out of sync with the canonical implementation. Exporting the existing helpers lets consumers stay aligned with pnpm's behaviour for free.

Test plan

  • pnpm --filter @pnpm/config.reader run compile — passes (lint warning is pre-existing).
  • Bit imports the new exports and drops its local copy (separate PR; gated on a published @pnpm/config.reader release).

Summary by CodeRabbit

  • New Features
    • Extended the public API of @pnpm/config.reader with new exports: getNetworkConfigs and getDefaultCreds functions, plus the NetworkConfigs type.

Expose the helpers that build the `configByUri` registry-config map
from a flat rawConfig-style auth dict so that downstream consumers
(e.g. third-party clients of `@pnpm/installing.client` /
`@pnpm/store.connection-manager`) can produce the same configByUri
shape pnpm itself uses, without re-implementing the parsing logic.
@coderabbitai

coderabbitai Bot commented May 5, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c729d16b-42c3-4928-bd24-93b6fce3dd39

📥 Commits

Reviewing files that changed from the base of the PR and between d74ddaa and 572edd9.

📒 Files selected for processing (2)
  • .changeset/export-network-configs.md
  • config/reader/src/index.ts

📝 Walkthrough

Walkthrough

This PR exposes three previously internal utilities from @pnpm/config.reader: getNetworkConfigs, getDefaultCreds, and the NetworkConfigs type. Consumers can now import these functions to parse network authentication configurations without duplicating existing logic.

Changes

Public API Exports

Layer / File(s) Summary
Public API Surface
config/reader/src/index.ts
Re-exports getDefaultCreds, getNetworkConfigs, and NetworkConfigs type from ./getNetworkConfigs.js to make them available to external consumers.
Release Documentation
.changeset/export-network-configs.md
Changeset entry for @pnpm/config.reader minor release documents the newly exported utilities and their use case for building configByUri mappings.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 Three functions hop into the light,
No more hidden from the world's sight,
Parse your configs, auth so bright,
The public API grows just right! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and specifically describes the main change: exporting getNetworkConfigs and getDefaultCreds from the config.reader package, which is exactly what the changeset implements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch export-network-configs

Comment @coderabbitai help to get the list of available commands and usage tips.

@zkochan zkochan marked this pull request as ready for review May 5, 2026 15:01
Copilot AI review requested due to automatic review settings May 5, 2026 15:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR makes existing, internally-used network/auth parsing helpers from @pnpm/config.reader available via the package’s public entrypoint, so downstream packages can build a configByUri map (and default creds) without re-implementing pnpm’s npmrc auth parsing logic.

Changes:

  • Re-export getNetworkConfigs, getDefaultCreds, and the NetworkConfigs type from config/reader/src/index.ts.
  • Add a changeset to publish @pnpm/config.reader as a minor version bump reflecting the new public exports.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
config/reader/src/index.ts Re-exports network config helpers/types from the public module entrypoint.
.changeset/export-network-configs.md Declares a minor release and documents the newly exported API surface.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@zkochan zkochan merged commit 6bed8ac into main May 5, 2026
15 of 17 checks passed
@zkochan zkochan deleted the export-network-configs branch May 5, 2026 16:58
zkochan added a commit that referenced this pull request May 5, 2026
…1471)

Expose the helpers that build the `configByUri` registry-config map
from a flat rawConfig-style auth dict so that downstream consumers
(e.g. third-party clients of `@pnpm/installing.client` /
`@pnpm/store.connection-manager`) can produce the same configByUri
shape pnpm itself uses, without re-implementing the parsing logic.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants