fix(widget): build SDK before widget in publish-widget so types resolve#40
Merged
lukeocodes merged 1 commit intomainfrom May 1, 2026
Merged
fix(widget): build SDK before widget in publish-widget so types resolve#40lukeocodes merged 1 commit intomainfrom
lukeocodes merged 1 commit intomainfrom
Conversation
@deepgram/agents-widget@0.1.1 was tagged but publish-widget failed with:
src/types.ts(7,8): error TS2307: Cannot find module '@deepgram/agents'
src/widget.tsx(2,59): error TS2307: Cannot find module '@deepgram/agents'
widget's build runs tsc --noEmit which needs SDK's emitted dist/index.d.ts
to resolve @deepgram/agents. publish-widget was running
`bun run --filter '@deepgram/agents-widget' build` which only builds
widget, never SDK. ci.yml had this fixed back in #36 by running the root
build script (which builds in topological order). publish-widget needs
the same fix.
switch publish-widget to `bun run build` (root script: builds @deepgram/
agents first, then @deepgram/agents-widget). this is what publish-sdk
already does.
side fixes on the widget package.json that double as the path-based
release-please trigger:
- description: drop the misleading 'CDN widget' framing now that we
don't have a CDN bucket. say what it actually is.
- keywords: add 'preact' (the widget bundles preact internally, useful
for npm search).
lukeocodes
pushed a commit
that referenced
this pull request
May 1, 2026
🤖 I have created a release *beep* *boop* --- ## [0.1.2](agents-widget-v0.1.1...agents-widget-v0.1.2) (2026-05-01) ### Bug Fixes * **widget:** build SDK before widget in publish-widget so types resolve ([#40](#40)) ([2246e93](2246e93)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
5 tasks
lukeocodes
added a commit
that referenced
this pull request
May 1, 2026
…tep (#42) ## Summary `@deepgram/agents-widget@0.1.2` was tagged after #40 + #41 merged, then [publish-widget failed again](https://github.com/deepgram/agent/actions/runs/25229336585/job/73980727441) at the Pin step: ``` ReferenceError: SDK_VERSION is not defined at [eval]:4:42 ``` ## Root cause the Pin step had a latent bash-to-JS interpolation bug: ```bash SDK_VERSION=$(node -e "...") # bash var node -e " pkg.dependencies['@deepgram/agents'] = SDK_VERSION; # treated as JS identifier, not interpolated " ``` `SDK_VERSION` inside `node -e "..."` is a JS identifier, not a bash variable. it should have been `'$SDK_VERSION'` or `process.env.SDK_VERSION`. the bug pre-existed in the workflow before today's launch, but never executed: the original publish-widget always failed earlier on the broken sibling-checkout. now that the rest of the job works, this bites. ## The right fix isn't to repair the Pin step widget releases are independent of SDK releases. widget should declare a real semver range on `@deepgram/agents` the same way `@deepgram/react` and `@deepgram/ui` do for their cross-package deps. bun resolves widget's `@deepgram/agents` to the workspace SDK locally because workspace SDK 0.1.x satisfies `^0.1.1`, so dev workflow is unchanged. at publish time the range publishes as-is. ## Changes - `packages/widget/package.json`: `@deepgram/agents` goes from `workspace:*` to `^0.1.1`. matches the pattern `@deepgram/react` and `@deepgram/ui` use for their cross-package deps. - `.github/workflows/npm-publish.yml`: drop the Pin step entirely. replaced with a defensive guard that fails publish if any `workspace:` string is still present in widget dependencies, so npm doesn't accidentally publish a tarball with workspace-protocol strings. ## Local verification (fully clean checkout) ``` $ rm -rf node_modules packages/*/node_modules examples/node_modules bun.lock $ bun install 522 packages installed $ ls -la packages/widget/node_modules/@deepgram/agents lrwxr-xr-x ... agents -> ../../../sdk $ bun run build ✓ widget.umd.js 384.30 kB │ gzip: 90.06 kB $ bun run test 107 pass / 0 fail (78 SDK + 29 widget) ``` bun symlinks widget's `@deepgram/agents` to the workspace SDK because the workspace SDK version (0.1.1) satisfies `^0.1.1`. dev workflow unchanged. ## State on main - `agents-widget-v0.1.2` GitHub release exists ✅ - `@deepgram/agents-widget@0.1.2` is **not** on npm ❌ - after this PR merges, release-please opens `release agents-widget 0.1.3`. merging that runs the (now actually fixed) publish-widget and `@deepgram/agents-widget@0.1.3` lands on npm with provenance. ## Why we don't keep republishing the failed tag each release-please flow attaches a GitHub release to the merged commit. the publish failure is local to that workflow run; the release tag and version remain. simplest forward path is to let release-please cut a fresh patch each time. once the pipeline is actually green end-to-end, this stops happening. ## Defensive guard explained the new guard is intentionally pessimistic. if anything regresses widget's deps to `workspace:` syntax (a refactor, a copy-paste, etc.), the publish job hard-fails before `npm publish` instead of pushing a broken tarball. there is no scenario where we want to publish a package containing `workspace:` strings. ## Test plan - [x] clean repo + clean install + clean build + tests - [x] bun resolves widget's @deepgram/agents to the workspace SDK - [ ] CI green on this PR - [ ] release-please opens `release agents-widget 0.1.3` - [ ] merge that PR -> `@deepgram/agents-widget@0.1.3` on npm with provenance
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.
Summary
@deepgram/agents-widget@0.1.1was tagged after #38 + #39 merged, but the publish-widget job failed with TS2307:Root cause
widget's
buildscript runstsc --noEmit && vite build.tsc --noEmitneeds SDK's emitteddist/index.d.tsto resolve@deepgram/agents.publish-widgetwas runningbun run --filter '@deepgram/agents-widget' buildwhich only builds the widget package and skips the SDK build that emits those types.ci.ymlalready fixed this back in #36 by running the rootbun run buildscript, which builds packages in topological order (SDK first, widget second).publish-widgetwas missed in that pass.publish-sdkhappens to dodge the bug because it also runs the rootbun run build.Fix
publish-widgetnow runsbun run build(same root script). builds SDK first, emits dist files, then widget builds and types resolve.Side fixes
bundled in because release-please needs a path-based touch on
packages/widgetto bump the patch version:description: drops the now-misleading "CDN widget" framing. Says what the package actually is.keywords: addspreact(the widget bundles preact internally, makes the package findable on npm).State on main
agents-widget-v0.1.1GitHub release exists ✅@deepgram/agents-widget@0.1.1is not on npm ❌release agents-widget 0.1.2. merging that runs the (now fixed) publish-widget and@deepgram/agents-widget@0.1.2lands on npm with provenance.Why skip 0.1.1 on npm rather than republish
same reasoning as the 0.1.0 -> 0.1.1 bump: republishing the same tag would need either
workflow_dispatch(the workflow doesn't have it) or a localnpm publish(forfeits provenance). cleanest path is to let release-please cut a fresh patch through the green pipeline.Test plan
bun install,bun run buildfrom clean state — both packages build, no TS2307release agents-widget 0.1.2after merge@deepgram/agents-widget@0.1.2on npm with provenanceFollow-up
once
@deepgram/agents-widget@0.1.2is live:deepgram/deepgram-docs#777(Browser Agent docs) drops theDo Not Merge 🙅label