Skip to content

Publish init.js drop-in so unpkg.com/playhtml/init.js works - #225

Open
spencerc99 wants to merge 2 commits into
mainfrom
worktree-agent-ac2706979716bee92
Open

Publish init.js drop-in so unpkg.com/playhtml/init.js works#225
spencerc99 wants to merge 2 commits into
mainfrom
worktree-agent-ac2706979716bee92

Conversation

@spencerc99

Copy link
Copy Markdown
Owner

Summary

https://unpkg.com/playhtml/init.js has never resolved (404) — the build only emits dist/init.es.js, and the package files/exports only exposed dist/. unpkg resolves real files in the published tarball for bare paths like /playhtml/init.js, so a real file must exist at the package root. This adds it.

Closes #222.

What I did

  • Added a committed packages/playhtml/init.js at the package root that imports the built bundle and boots playhtml with defaults:
    import { playhtml } from "./dist/playhtml.es.js";
    playhtml.init({});
    (Includes the required 2-line // ABOUTME: header since it's hand-authored.)
  • Added "init.js" to package.json files so it ships in the tarball.
  • Added "./init.js": "./init.js" to the exports map so bundler imports of playhtml/init.js also resolve.
  • Added a changeset (playhtml patch).

No change to dist/init.es.js — the existing verbose path still works.

How I verified

  • Built the package clean (tsc && vite build both pass; dist/init.es.js still emitted).
  • npm pack --dry-run confirms init.js is in the published tarball:
    62B    dist/init.es.js
    16.6kB dist/main.d.ts
    372.4kB dist/playhtml.es.js
    2.1kB  dist/style.css
    238B   init.js
    1.6kB  package.json
    total files: 6
    
  • Tests: vitest run --no-typecheck207 passed (24 files), no regressions.

Docs

Per the issue, docs are intentionally unchanged in this PR. After release, apps/docs/src/content/docs/getting-started.mdx Path A (and the two prose mentions) can be simplified from https://unpkg.com/playhtml/dist/init.es.js back to the short https://unpkg.com/playhtml/init.js.

@pkg-pr-new

pkg-pr-new Bot commented Jun 28, 2026

Copy link
Copy Markdown

Open in StackBlitz

bun add https://pkg.pr.new/@playhtml/common@225
bun add https://pkg.pr.new/playhtml@225
bun add https://pkg.pr.new/@playhtml/react@225

commit: 8d85b19

@spencerc99
spencerc99 force-pushed the worktree-agent-ac2706979716bee92 branch from dc0c7f7 to 65fbbf4 Compare June 28, 2026 05:50
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 28, 2026

Copy link
Copy Markdown

Deploying playhtml with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8d85b19
Status: ✅  Deploy successful!
Preview URL: https://1e963c4c.playhtml.pages.dev
Branch Preview URL: https://worktree-agent-ac2706979716b.playhtml.pages.dev

View logs

@spencerc99

Copy link
Copy Markdown
Owner Author

Code review

  • P1 packages/playhtml/package.json:5 rolls the package version backwards. The PR head sets playhtml to 2.10.1, while the base side of this diff is 2.11.0. Because the release flow applies this changeset starting from the checked-in package version, merging this would produce a lower playhtml release line than current main instead of a patch on top of 2.11.0. Restore the package version from current main before the changeset is applied.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 1, 2026

Copy link
Copy Markdown

Deploying we-were-online-website with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8d85b19
Status: ✅  Deploy successful!
Preview URL: https://92b0c307.we-were-online-website.pages.dev
Branch Preview URL: https://worktree-agent-ac2706979716b.we-were-online-website.pages.dev

View logs

@spencerc99

Copy link
Copy Markdown
Owner Author

Code review

  • P1 packages/playhtml/package.json:5 is still based on stale package metadata and would roll back current public package state during conflict resolution. This head sets playhtml to 2.11.3 and its files/exports lists omit leafEditor, while current main is 2.13.2 and publishes the ./leafEditor entry point. Rebase or resolve the conflict by preserving current main's version, files, and exports, then add only init.js plus its export.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add init.js alias so unpkg.com/playhtml/init.js works as a drop-in

1 participant