fix(ci): publish pkg.pr.new previews with non-compact, sha-based URLs - #42
Merged
Conversation
Compact pkg.pr.new URLs resolve owner/repo through the npm `repository` field, which for `@opennextjs/cloudflare` still points at opennextjs/opennextjs-cloudflare. External testers installing `https://pkg.pr.new/@opennextjs/cloudflare@38` silently got v1.5.3 from the old repo instead of the PR build. `--no-compact` emits the long `pkg.pr.new/opennextjs/adapters-api/...` form, which cannot collide. `@opennextjs/core` was never published as a preview, so the cloudflare tarball kept a plain `0.1.0` range for it and was uninstallable outside the monorepo. pkg.pr.new only rewrites cross-package deps into pkg.pr.new URLs for packages published in the same invocation, so all packages now publish together via a single `./packages/*` glob (this also drops the stale `./packages/open-next` path, which no longer has a package.json). `--commentWithSha` keys the comment links by commit sha instead of PR number, which is the ambiguous part between the two repos. `--pnpm` is kept: pnpm-workspace.yaml defines `catalog:`/`catalogs:` and `npm pack` does not understand the `catalog:` protocol. Bumps pkg-pr-new 0.0.60 -> 0.0.86: `--commentWithSha` does not exist in 0.0.60 (it would be silently ignored) and compact mode only became the default in a later release. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
commit: |
There was a problem hiding this comment.
Pull request overview
Updates the prerelease publishing workflow to generate reliable pkg.pr.new preview URLs (non-compact, sha-based) and ensures workspace dependencies are published together so PR tarballs are installable outside the monorepo.
Changes:
- Update
pkg-pr-newpublish invocation to use--no-compact,--commentWithSha, and publish all packages in one call. - Bump
pkg-pr-newfrom^0.0.60to^0.0.86(and update lockfile accordingly). - Update README examples to use the long (owner/repo-qualified)
pkg.pr.newURLs.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| README.md | Switches documented pkg.pr.new URLs to the owner/repo-qualified form and explains why compact URLs are unsafe. |
| pnpm-lock.yaml | Updates lockfile to reflect the pkg-pr-new dependency bump and transitive changes. |
| package.json | Bumps pkg-pr-new devDependency to ^0.0.86. |
| .github/workflows/prereleases.yml | Updates publish command flags and publishes ./packages/* in a single invocation. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
Suppressed comments (1)
README.md:66
- The README claims an
experimentalprerelease is updated on pushes to theexperimentalbranch, but the workflow only publishes on pushes tomain(and on PRs). Either add anexperimentalpush trigger, or update this bullet to describe the PR sha-based prerelease link instead of a non-existent branch prerelease.
- `https://pkg.pr.new/opennextjs/adapters-api/@opennextjs/aws@experimental`
Updated with every push to the `experimental` branch, this prerelease contains the latest experimental version of the package (containing features that we want to test/experiment on before committing to).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the two bugs that make pkg.pr.new previews unusable for external testers, reported on #38.
Bug 1 — compact URLs resolve to the old repo
https://pkg.pr.new/@opennextjs/cloudflare@38served v1.5.3 fromopennextjs/opennextjs-cloudflare, not the PR build. It did not fail — it silently installed the wrong package.Cause: compact URLs carry no owner/repo, so pkg.pr.new resolves them through npm metadata, and the
repositoryfield of the published@opennextjs/cloudflarestill points at the previous repo. The workflow was passing--compactexplicitly.Fix:
--no-compact. URLs becomehttps://pkg.pr.new/opennextjs/adapters-api/@opennextjs/cloudflare@<sha>, which carries owner/repo and cannot collide.Bug 2 —
@opennextjs/corewas not published, so the tarball was uninstallableThe cloudflare package depends on
@opennextjs/corevia the workspace protocol. pkg.pr.new only rewrites cross-package deps into pkg.pr.new URLs for packages published in the same invocation; core was not in the list, so the dep stayed a plain0.1.0range that does not exist on npm, and the tarball could not be installed outside the monorepo.Fix: publish everything in one call with
'./packages/*'— one invocation, because splitting into several is what pkg.pr.new's anti-spam mechanism catches. The glob resolves to@opennextjs/aws,@opennextjs/cloudflareand@opennextjs/core; pkg-pr-new skipsprivate: truepackages (tests-e2e,tests-unit) and directories with nopackage.json. That last point also retires the stale./packages/open-nextargument — that directory lost itspackage.jsonand the argument was already a no-op.The change
--no-compactopennextjs/adapters-api— the only reliable way to avoid the old-repo collision'./packages/*'--commentWithSha--pnpm(kept)pnpm-workspace.yamldefinescatalog:andcatalogs:, andnpm packdoes not understand thecatalog:protocolDependency bump — required, not cosmetic. The lockfile pinned
pkg-pr-new@0.0.60, where--commentWithShadoes not exist (citty ignores unknown flags silently, so it would have been a no-op) andcompactis opt-in rather than the default.0.0.86has--commentWithShaandisCompact = args.compact !== false. The lockfile diff touches only pkg-pr-new and its transitive deps, most of which 0.0.86 now bundles.Triggers — already correct, unchanged
The workflow already uses a bare
pull_request:, so PRs against any base branch publish previews, including #38 targetingconico/share-build. No change was needed.Worth noting separately:
push:is restricted tobranches: [main], while the README claims pushes toexperimentalalso publish. That predates this PR and is out of scope here.Changeset
None. This is CI + README only; changesets version the packages under
packages/*, and the only manifest touched is the private rootmonorepopackage.Validation
.github/workflows/prereleases.ymlparses cleanly (actionlint is not installed on this machine; validated with a YAML parse).--no-compact/--commentWithShaverified against thepkg-pr-new@0.0.86CLI definition.Unblocks external testers on #38.
🤖 Generated with Claude Code