Publish a preview of every package on every push - #50
Merged
Conversation
A change to the CLI or a plugin can now be run straight from a branch,
without a release:
npx https://pkg.pr.new/datocms@<commit-sha> environments:list
Nothing reaches npm, no version is spent, and there is nothing to clean
up afterwards. Also gives `@datocms/cli-utils` the `repository` field it
was missing, which is what pkg.pr.new reads to mint the short URL form —
the other four packages already had one.
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 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 installable tarballs of all
five packages, without publishing anything to npm:
Why
This is the thing a monorepo cannot give us, because our packages are spread
across several of them. Trying a CLI change against a real project, or letting
someone confirm a fix before we cut a release, currently means either a release
or
npm link. Now it's a URL that expires on its own.Verified on this branch
The run on bff0e30 published all five. Installed into a throwaway project, the
binary runs:
and the resolution splits exactly where the repo boundary is:
So oclif's
prepack— build,oclif manifest,oclif readme— survives beingrun by
npm packin CI, which was the thing most likely to break here.Also in this PR
@datocms/cli-utilswas the only package without arepositoryfield. It getsone, so its preview URLs take the short form like the other four (and so npm
shows a source link on its page).
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. 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 want fork
previews later.
This is the repo's first workflow. There is no CI here at all — no lint, no
build, no test on a PR. This one only builds and publishes; adding real CI is a
separate PR and worth doing.
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.