Publish a preview of the package on every push - #3
Merged
Conversation
Every commit pushed to a branch now produces an installable tarball, so
an overlay change can be tried against a real project without a release:
npm i https://pkg.pr.new/@datocms/content-link@<commit-sha>
Nothing reaches npm, no version is spent, and there is nothing to clean
up afterwards. This replaces `npm link` and pinning a git branch by hand,
and it means a fix can be handed to whoever reported it before we cut a
release.
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 an installable tarball,
without publishing anything to npm:
Why
Overlay and stega behaviour can really only be judged in a real project, and
every one of those lives in another repository. Today that means a release or
npm link. Now it's a URL that expires on its own, and a fix can be handed towhoever reported it before we release.
This is one of ten repos getting the same workflow; the four monorepos are in
datocms/js-rest-api-clients#58 and its siblings.
Verified on this branch
The run on d4c524b published the package; installed into a throwaway project it
resolves and unpacks correctly:
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.
Node pinned at 22, not a matrix. This job only has to build a tarball, not
prove which Node versions the package supports.
This is the repo's first workflow. There is no CI here at all — no build,
lint or test on a PR. Note
npm run buildhere also runstypecheck, so thisworkflow does catch a type error, but that is a side effect, not coverage.
Adding real CI is a separate PR and worth doing.
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.