deno
9aff2d53 - fix(publish): skip already-published versions before type checking (#35134)

Commit
68 days ago
fix(publish): skip already-published versions before type checking (#35134) ## Summary `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 (the `duplicateVersionPublish` path). 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: 1. Probe the registry for each package's version concurrently. 2. Drop already-published versions before preparing anything. If **every** version is already published, return early **without type checking at all**. 3. Type check + prepare the remaining packages. 4. Publish — the existing post-prepare `duplicateVersionPublish` handling 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 `duplicateVersionPublish` behavior) rather than turned into a hard error. This keeps workspace partial publishes and idempotent CI re-runs working. Only a `200 OK` is treated as "already published"; a `404` (or any other non-success status) is treated as "not published" so a transient registry error never blocks a legitimate publish. ### Other changes - Extracts shared helpers `registry::parse_package_name` and `registry::get_package_version_api_url` (also used by `publish_package`). - Fixes a missing closing quote in the invalid-package-name error message. ## Tests - New spec test `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-existence `GET` (404 by default; a reserved `already-published` scope simulates an existing version). - `registry::test_parse_package_name` unit test. - Full `cargo test specs::publish` suite (64 tests) and `specs::init` pass. Closes #30280 Closes denoland/divybot#563 --------- Co-authored-by: divybot <divybot@users.noreply.github.com> Co-authored-by: Divy Srivastava <me@littledivy.com>
Author
Parents
Loading