Repository navigation
feat(publish): skip already-published versions before type checking - #35134
Conversation
`deno publish` previously type checked and prepared every package before attempting to publish, only discovering that a version was already published when the registry rejected the upload. For packages whose version is already on the registry this wasted the entire (expensive) type-check and tarball step. Now `deno publish` probes the registry for each package's version up front and drops already-published versions before preparing anything. When every version is already published it returns early without type checking at all. Matching the existing `duplicateVersionPublish` behavior, already-published versions are skipped with a warning rather than erroring, so re-running after a partial or concurrent publish still succeeds. The post-prepare publish step still handles the race where another publish lands a version in the meantime. Also extracts a shared `registry::parse_package_name` / `get_package_version_api_url` and fixes a missing quote in the invalid package name error message. Co-Authored-By: Divy Srivastava <me@littledivy.com>
|
The |
Co-Authored-By: Divy Srivastava <me@littledivy.com>
|
Update on the
That's the CI runner failing to pull the Autobahn Docker image (Docker Hub network/rate-limit), not anything in this change β this PR only touches |
Co-Authored-By: Divy Srivastava <me@littledivy.com>
Summary
deno publishpreviously type checked and prepared every package before attempting to publish, only discovering that a version was already published when the registry rejected the upload (theduplicateVersionPublishpath). For packages whose version is already on the registry this wasted the entire β and expensive β type-check + tarball step.This adds the up-front check requested in #30280:
duplicateVersionPublishhandling still covers the race where another CI run lands the same version in the meantime.Skip-and-continue, not bail
Following the feedback on the earlier #30347, already-published versions are skipped with a warning (matching today's idempotent
duplicateVersionPublishbehavior) rather than turned into a hard error. This keeps workspace partial publishes and idempotent CI re-runs working. Only a200 OKis treated as "already published"; a404(or any other non-success status) is treated as "not published" so a transient registry error never blocks a legitimate publish.Other changes
registry::parse_package_nameandregistry::get_package_version_api_url(also used bypublish_package).Tests
tests/specs/publish/already_publishedβ publishing an already-published version skips it and exits successfully without type checking. The fake JSR registry now answers the version-existenceGET(404 by default; a reservedalready-publishedscope simulates an existing version).registry::test_parse_package_nameunit test.cargo test specs::publishsuite (64 tests) andspecs::initpass.Closes #30280
Closes denoland/divybot#563