Skip to content

relizy / isVersionPublished

Function: isVersionPublished() ​

isVersionPublished(__namedParameters): Promise<boolean | null>

Defined in: src/core/npm.ts:715

Ask the registry whether pkg@version already exists. This is the primary, robust idempotency check: it relies on the standard registry metadata endpoint that every npm-compatible registry (npm, Nexus, JFrog, Verdaccio, GitHub/GitLab Packages) implements to serve install, rather than on the wording of a publish error - which varies per registry.

Strategy: for npm/pnpm, use the view command first (it inherits the full .npmrc environment - proxy, CA, scoped auth). If that is inconclusive, or for yarn/bun (no usable view), fall back to a direct HTTP request to the packument endpoint so every package manager is covered.

Returns:

  • true - the version is already published;
  • false - the package, or that specific version, is not on the registry;
  • null - the check was inconclusive (auth/network/registry error), so the caller should fall back to attempting the publish rather than skipping.

Parameters ​

__namedParameters ​

config ​

ResolvedRelizyConfig

packageManager ​

PackageManager

pkg ​

PackageBase

registryTarget ​

RegistryTarget

version ​

string

Returns ​

Promise<boolean | null>

Released under the MIT License.