Publish a preview of every package on every push - #58
Merged
Conversation
A change to a client can now be tried inside a consumer that lives in
another repository — `cms`, a demo, a customer project — by installing a
real tarball built from the branch:
npm i https://pkg.pr.new/@datocms/cma-client@<commit-sha>
Nothing reaches npm, no version is spent, and there is nothing to clean
up afterwards. This replaces pinning a git branch by hand, which is what
we have been doing (datocms/cms#365) and which nobody remembers to undo.
Runs only on pushes to branches of this repo, so a fork cannot mint a URL
under our namespace without a maintainer pushing the code first.
Claude-Session: https://claude.ai/code/session_01TbxhxyU1XBsSKtoCJXwAoD
This was referenced Aug 31, 2026
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.
Every commit pushed to a branch here now produces an installable tarball of
every package, without publishing anything to npm:
Why
This is the thing a monorepo cannot give us, because our packages are spread
across several of them. Today, trying a client change inside a consumer that
lives in another repository means pinning a git branch by hand — see
datocms/cms#365 — which works, is invisible to review, and nobody remembers to
undo.
npm linkis the other option, and it breaks in its own ways.Verified end-to-end on this branch
The run on commit 38b0774 published all 9 packages. Installing one of them in a
throwaway project resolves the siblings from the same commit, not from npm:
while
datocms-structured-text-utilsstill comes from npm, correctly — itlives in another repo. So a change spanning several packages can be tried as
one coherent set.
Choices worth reviewing
Pushes only, no fork pull requests. The workflow runs on pushes to branches
of this repo, which only people with write access can make. A fork PR publishes
nothing. This is deliberate: pkg.pr.new URLs carry our namespace, and the
tarballs are served unauthenticated, so an unreviewed fork should not be able to
mint one. pkg.pr.new documents an "approved pull requests only" recipe if we
ever want fork previews gated behind a maintainer's review — easy follow-up.
A separate workflow, not a step in
node.js.yml. That one runs a matrix oftwo Node versions and needs the API secrets; pkg-pr-new must run exactly once
per workflow run, and a preview is worth having even when the live-API suite is
red.
No changeset. Nothing about the published packages changes.
One thing to know
Previews are throwaway and the URLs stop resolving after a while. They must
never end up in a
package.jsonthat ships — same rule as the git-branch pinsthey replace, but at least these are obviously temporary.