Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/releasing.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ The releaser accepts these flags:
- `--tag <tag>` -- publish with a specific npm dist-tag (e.g., `canary`, `snapshot`); defaults to `latest`
- `--version <version>` -- override the version read from `package.json`

All publishes are idempotent -- the script checks the registry before publishing and skips already-published versions, and a publish that npm rejects because the version already exists counts as done. The check reads the per-version document (`registry.npmjs.org/<name>/<version>`), which the registry CDN does not cache, so a version published seconds earlier is visible right away. Before publishing the `clerk` wrapper, the script waits (up to five minutes) for every platform package to be readable. If one platform publish fails, the others still run to completion before the job exits, so a re-run only has to publish what is actually missing.
All publishes are idempotent -- the script checks the registry before publishing and skips already-published versions, and a publish that npm rejects because the version already exists counts as done. The check reads the per-version document (`registry.npmjs.org/<name>/<version>`), which the registry CDN does not cache, but npm can still take several minutes to serve a new version back. Before publishing the `clerk` wrapper, the script waits up to two minutes for every platform package to be readable; if one is still unreadable after that, it logs a warning and publishes the wrapper anyway, because npm already accepted every platform publish. If one platform publish fails, the others still run to completion before the job exits, so a re-run only has to publish what is actually missing.

#### Environment Variables

Expand Down
19 changes: 14 additions & 5 deletions scripts/releaser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,21 @@ await publishDependenciesBeforePackage(
waitUntilAvailable: dryRun
? undefined
: async () => {
// Best effort. npm accepted the publish, so the version exists; the
// registry can take several minutes to serve it back (observed
// >5 min on the uncached per-version endpoint). Failing here only
// strands the wrapper, which is subject to the same read lag.
console.log(`Waiting for ${name}@${version} to become available on npm...`);
await waitUntilPublished(name, version, {
intervalMs: 5_000,
timeoutMs: 300_000,
isPublished,
});
try {
await waitUntilPublished(name, version, {
intervalMs: 5_000,
timeoutMs: 120_000,
isPublished,
});
} catch (error) {
const reason = error instanceof Error ? error.message : String(error);
console.log(`::warning::${reason}; continuing because npm accepted the publish`);
Comment thread
coderabbitai[bot] marked this conversation as resolved.
}
},
};
}),
Expand Down
Loading