Publish a preview of every package on every push - #40
Merged
Conversation
A renderer or util change can now be installed into a real site straight
from a branch, without a release:
npm i https://pkg.pr.new/datocms-structured-text-utils@<commit-sha>
Nothing reaches npm, no version is spent, and there is nothing to clean
up afterwards. Installing one preview pulls in the previews of its
siblings from the same commit, which matters here: the renderers all sit
on top of `utils` and `generic-html-renderer`.
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
ten 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. The consumers of these renderers —
react-datocms,vue-datocms, the demos, customer sites — all live elsewhere, so trying arendering change against one currently means a release or
npm link.Verified on this branch
The run on 32c6ed5 published all ten. Installing just the top of the chain in a
throwaway project brings the whole chain from the same commit:
and it runs:
That chain is the reason this is worth having here specifically: the renderers
all sit on
utilsandgeneric-html-renderer, and with independent versioninga change usually spans several of them. A preview of one package alone would
have been useless.
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.
A separate workflow, not a step in
node.js.yml. That one runs a matrix oftwo Node versions; pkg-pr-new must run exactly once per workflow run.
Actions pinned at v4, matching
node.js.yml. The other repos are on v6/v7 —bumping all of them is a separate, unrelated PR.
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.