Skip to content

refactor: getNetworkConfigs#10458

Merged
zkochan merged 1 commit into
mainfrom
refactor-get-network-configs
Jan 14, 2026
Merged

refactor: getNetworkConfigs#10458
zkochan merged 1 commit into
mainfrom
refactor-get-network-configs

Conversation

@KSXGitHub

Copy link
Copy Markdown
Contributor

Some tests are added as a bonus

Some tests are added as a bonus
@KSXGitHub KSXGitHub marked this pull request as ready for review January 14, 2026 08:30
@KSXGitHub KSXGitHub requested a review from zkochan as a code owner January 14, 2026 08:30
Copilot AI review requested due to automatic review settings January 14, 2026 08:30

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 refactors the getNetworkConfigs function by renaming its return type interface from GetNetworkConfigsResult to NetworkConfigs, updating the function parameter type from Record<string, object> to Record<string, unknown>, modernizing type assertions, and replacing an if-check pattern with the nullish coalescing assignment operator. The PR also adds comprehensive unit tests for the function.

Changes:

  • Renamed interface GetNetworkConfigsResult to NetworkConfigs for improved naming consistency
  • Updated parameter type to use unknown instead of object and simplified type assertions
  • Modernized the sslConfigs initialization using the ??= operator
  • Added comprehensive unit tests covering both file-based and non-file-based SSL configurations

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
config/config/src/getNetworkConfigs.ts Refactored the function with improved types, renamed interface, and modernized initialization pattern
config/config/test/getNetworkConfigs.test.ts Added new test file with comprehensive test coverage for the function's behavior

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

Comment thread config/config/test/getNetworkConfigs.test.ts
@zkochan zkochan merged commit 459a336 into main Jan 14, 2026
26 of 30 checks passed
@zkochan zkochan deleted the refactor-get-network-configs branch January 14, 2026 11:31
KSXGitHub added a commit that referenced this pull request Jan 14, 2026
Some tests are added as a bonus
zkochan pushed a commit that referenced this pull request Feb 12, 2026
* chore(deps): add `libnpmpublish` to catalog

* chore(deps): install `libnpmpublish`

* feat: publishableManifest (wip)

* feat: publishableManifest (wip)

* chore(cspell): libnpmpublish

* test: fix

* feat: validate field and version

* chore: @npm/types

* chore: todo

* refactor: reorganize

* feat: transformRequiredFields

* chore(deps): patch `libnpmpublish`

* fix: `BaseManifest.config`

* fix: eslint

* chore(git): revert a patch that doesn't work

This reverts commit 45f2c6a.

We will use type casting

* feat: `engines.runtime`

* feat: normalize bin

* fix: `bin === ''`

* test: fix

* refactor: inference friendly

* feat: `peerDependenciesMeta`

* refactor: group into a directory

* refactor: use `ramda.pipe`

* refactor: less intrusive type assertion

* feat!: returning `ExportedManifest`

* refactor: remove unnecessary file

* docs: add a todo

* refactor: getNetworkConfigs (#10458)

Some tests are added as a bonus

* feat: `publishPackedPkg` (wip)

* feat: replace `\t` with 4 spaces

* fix: newline

* fix: newline

* refactor: extract `FailedToPublishError`

* test: FailedToPublishError

* feat: registryConfigKeys

* feat: `publishPackedPkg` (wip)

* feat(config/getNetworkConfigs): load auth info

* feat(config/getNetworkConfigs): load auth info (#10491)

* feat: `publishPackedPkg` (wip)

* refactor: extract a `static` function

* fix: inheritance, override, and merge

* feat: `executeTokenHelper`

* fix: use the visible `globalWarn`

* feat: add options

* feat: add more options

* docs: more links

* fix: private packages

* fix: --dry-run

* feat: log more things

* fix: name

* fix: tag

* refactor: remove extraneous `assertPublicPackage`

* feat: use `publishPackedPkg` for directories

* refactor: require only necessary fields

* refactor: extractManifestFromPacked

* fix: extractManifestFromPacked

* test: extractManifestFromPacked

* feat: isTarballPath

* feat: use `publishPackedPkg` for tarballs

* style: add an empty line for clarity

* refactor: remove unnecessary works

* feat: --otp

* feat: PNPM_CONFIG_OTP

* feat: oidc

* test: fix name collision

* fix: eslint

* test: disable a false test

* feat: set `provenance`

* docs(todo): auto provenance

* refactor: run oidc in `createPublishOptions`

* fix: correct auth keys for `libnpmpublish`

* docs: changeset

* fix: incorrect `password` field

* fix: typo, grammar

* chore(git): resolve merge conflict ahead of time

In preparation for #10385

* fix: field name

* fix(config): decoding `_password`

* fix: edge case of partial `cert`/`key`

* fix: ensure `registry` always match its config key

* fix: `_password`

* test: correct a name

* test: more specific assertions

* fix: grammar

* docs(changeset): fix grammar

* docs: fix grammar

* fix: clean up after failure

* test: fix windows

* feat(provenance): auto detect

* refactor: consistent name

* fix: correct error names

* refactor: extract the `provenance` code

* feat: show code and body of an error

* refactor: use `encodeURIComponent`

* refactor: rename a type

* refactor: use the try-catch model

* refactor: move `normalizeBinObject`

* refactor: split `oidc` into `idToken` and `authToken`

* refactor: run `next` on `stream`'s `'end'`

* fix: use the correct encoding

* feat: guard against weird names

* test: `transform/engines`

Closes #10599

* test: `transformPeerDependenciesMeta`

Closes #10600

* refactor: dependency inject the `Date` too

* refactor: export an interface

* test: oidc

Closes #10598

* refactor: re-arrange imports

* refactor: remove unnecessary type casts

* refactor: improve test
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.

3 participants