feat: load an arbitrary build in the playground via ?package=#93
Open
StephenTangCook wants to merge 4 commits into
Open
feat: load an arbitrary build in the playground via ?package=#93StephenTangCook wants to merge 4 commits into
StephenTangCook wants to merge 4 commits into
Conversation
Add an optional `?package=` query param to the playground that overrides the bundled local source with a published or preview build, loaded at runtime via esm.sh. Accepts a version string (`1.1.0`) or a full ESM URL. The override renders in its own React root (react/react-dom pinned to 18.3.1 so esm.sh shares one instance), keeping it isolated from the playground's React. The PR-preview comment now links straight to the playground with the PR's pkg.pr.new build pre-loaded via esm.sh's /pr/ endpoint, so reviewers get a one-click live render of the exact PR. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
|
👋 Thanks for the PR, @StephenTangCook! You can try these changes live, before any release — no install needed. 🛝 Playground: https://slack-block-to-jsx-playground.vercel.app/ Paste the build URL into the Library package field (or hit the pkg.pr #93 preset) and click Load build — your blocks render against this exact PR. 🎉 |
commit: |
Add a "Library package" text field, a "Load build" button, a "Use local build" reset, and a ?pr-driven "pkg.pr #N" preset to the toolbar. The field accepts a version, a pkg.pr.new build URL (routed through esm.sh), or any ESM URL; the active build mirrors to ?package= so the URL stays shareable. The PR-preview comment now links with ?package=<build>&pr=<n> and keeps the field/preset/Load-build instructions, which are now accurate. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add a heading to the comment body and rename the workflow to match, so the auto-posted PR comment is identifiable (the bot author stays github-actions). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
What
The playground now accepts an optional
?package=query param that overrides the bundled local source and renders a different build of the library instead — loaded at runtime via esm.sh.?package=1.1.0→ a released version?package=<full ESM url>→ used as-is (e.g. an esm.sh/pr/preview build)The PR-preview bot comment (
playground-comment.yml) now links straight to the playground with the PR's build pre-loaded, so a reviewer gets a one-click live render of the exact PR — no install, no field to paste into.Why
Previously the comment pointed reviewers at a "Library package field / Load build" UI that didn't exist. This wires up the real capability and makes the preview link self-contained.
How it works
https://esm.sh/slack-blocks-to-jsx@<version>; a full URL is passed through. Both get?deps=react@18.3.1,react-dom@18.3.1appended.../srcwith HMR) is unchanged when no param is present./pr/<owner>/<repo>/<pkg>@<pr-number>endpoint takes the PR number directly and resolves it to that PR's pkg.pr.new build — verified against this repo.Reviewer notes
../src/style.css(class names are stable), so a PR that changes CSS won't be fully reflected. Out of scope here.pnpm playground:build(tsc -b) currently fails with ~32 errors from a stale@types/react@17bump (dependabot chore(deps-dev): bump @types/react from 17.0.88 to 17.0.93 #81), present before this change. Vite bundling is clean.