Repository navigation
fix(miniapp-shell): build design-system consumers before the chrome theme projection - #3508
Merged
Merged
Conversation
…heme projection `prepare:miniapp-shell` runs before Tauri's frontend build, and the web-ui prebuild is what owns `design-system/packages/*/dist`. A fresh checkout therefore has no design-tokens dist when the shell projects its chrome theme, so every Desktop Package platform failed with ERR_MODULE_NOT_FOUND: design-system/packages/design-tokens/dist/index.js Nightly kept passing only because it type-checks the web UI first, and local workspaces mask it with a pre-warmed dist. Build the consumer packages from the shell preparation step whenever their built entries are missing, so release packaging, nightly, and a cold local `desktop:build` share one working path. The build is skipped when the dist is already present, which keeps incremental desktop builds unchanged. Co-authored-by: OpenBitFun <318544290+bitfun-ai@users.noreply.github.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.
Why
Desktop Packagefor v1.0.7 failed on every platform within ~2 minutes with:Run: https://github.com/GCWing/OpenBitFun/actions/runs/39593197901 (Package (linux-x64), plus macos/windows identical)
Root cause
scripts/desktop-tauri-build.mjscallsprepareMiniAppShell()before Tauri's frontend build. Thedesign-system/packages/*/distentries thatscripts/generate-miniapp-chrome-theme.mjsimports are produced by the web-uiprebuild(prepare:design-system:build), i.e. later in the same build. So a fresh checkout has no dist at shell-preparation time.This regressed with #3426 (native MiniApp shells). It stayed invisible because:
type-check:web(whosepretype-checkbuilds the design-system packages) beforedesktop:build:*;desktop:build.The last
Desktop Packagerun (v1.0.6, Oct 15) predates the change, so v1.0.7 is the first release to hit it.Change
prepare-miniapp-shell.mjsnow builds the consumer packages (pnpm --dir design-system run prepare:consumer-dev, ~2s) when their built entries are missing, and skips it when dist is already present, so incremental desktop builds are unchanged. Tests cover both the cold and warm path.Verification
node --test scripts/prepare-miniapp-shell.test.mjs— 11 pass (2 new assertions/paths)node --test scripts/desktop-tauri-build.test.mjs scripts/generate-miniapp-chat-styles.test.mjs— 24 passgenerate-miniapp-chrome-theme.mjs --checkreports no drift against the committedsrc/shared/miniapp-chrome/generated/theme.css