Skip to content

fix(ci): publish pkg.pr.new previews with non-compact, sha-based URLs - #42

Merged
conico974 merged 1 commit into
mainfrom
fix/pkg-pr-new-preview-urls
Aug 2, 2026
Merged

fix(ci): publish pkg.pr.new previews with non-compact, sha-based URLs#42
conico974 merged 1 commit into
mainfrom
fix/pkg-pr-new-preview-urls

Conversation

@conico974

@conico974 conico974 commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

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@38 served v1.5.3 from opennextjs/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 repository field of the published @opennextjs/cloudflare still points at the previous repo. The workflow was passing --compact explicitly.

Fix: --no-compact. URLs become https://pkg.pr.new/opennextjs/adapters-api/@opennextjs/cloudflare@<sha>, which carries owner/repo and cannot collide.

Bug 2 — @opennextjs/core was not published, so the tarball was uninstallable

The cloudflare package depends on @opennextjs/core via 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 plain 0.1.0 range 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/cloudflare and @opennextjs/core; pkg-pr-new skips private: true packages (tests-e2e, tests-unit) and directories with no package.json. That last point also retires the stale ./packages/open-next argument — that directory lost its package.json and the argument was already a no-op.

The change

-run: pnpm exec pkg-pr-new publish --pnpm --compact './packages/cloudflare' './packages/open-next'
+run: pnpm exec pkg-pr-new publish --pnpm --no-compact --commentWithSha './packages/*'
flag effect
--no-compact long URLs including opennextjs/adapters-api — the only reliable way to avoid the old-repo collision
'./packages/*' publishes core + cloudflare + aws together so workspace deps are rewritten to pkg.pr.new URLs
--commentWithSha comment links keyed by commit sha instead of PR number; the number is exactly the ambiguous part between repos, and #38's branch has been force-pushed several times
--pnpm (kept) pnpm-workspace.yaml defines catalog: and catalogs:, and npm pack does not understand the catalog: protocol

Dependency bump — required, not cosmetic. The lockfile pinned pkg-pr-new@0.0.60, where --commentWithSha does not exist (citty ignores unknown flags silently, so it would have been a no-op) and compact is opt-in rather than the default. 0.0.86 has --commentWithSha and isCompact = 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 targeting conico/share-build. No change was needed.

Worth noting separately: push: is restricted to branches: [main], while the README claims pushes to experimental also 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 root monorepo package.

Validation

  • .github/workflows/prereleases.yml parses cleanly (actionlint is not installed on this machine; validated with a YAML parse).
  • --no-compact / --commentWithSha verified against the pkg-pr-new@0.0.86 CLI definition.

Unblocks external testers on #38.

🤖 Generated with Claude Code


Open in Devin Review

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>
Copilot AI review requested due to automatic review settings August 2, 2026 09:15
@pkg-pr-new

pkg-pr-new Bot commented Aug 2, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/opennextjs/adapters-api/@opennextjs/aws@edef975
npm i https://pkg.pr.new/opennextjs/adapters-api/@opennextjs/cloudflare@edef975
npm i https://pkg.pr.new/opennextjs/adapters-api/@opennextjs/core@edef975

commit: edef975

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-new publish invocation to use --no-compact, --commentWithSha, and publish all packages in one call.
  • Bump pkg-pr-new from ^0.0.60 to ^0.0.86 (and update lockfile accordingly).
  • Update README examples to use the long (owner/repo-qualified) pkg.pr.new URLs.

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 experimental prerelease is updated on pushes to the experimental branch, but the workflow only publishes on pushes to main (and on PRs). Either add an experimental push 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.

Comment thread README.md
@conico974
conico974 merged commit 8f5a0f1 into main Aug 2, 2026
10 checks passed
@conico974
conico974 deleted the fix/pkg-pr-new-preview-urls branch August 2, 2026 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants