Skip to content

fix(miniapp-shell): build design-system consumers before the chrome theme projection - #3508

Merged
wgqqqqq merged 1 commit into
mainfrom
wgq/fix-miniapp-shell-design-tokens
Oct 21, 2026
Merged

wgqqqqq merged 1 commit into
mainfrom
wgq/fix-miniapp-shell-design-tokens

Conversation

@wgqqqqq

@wgqqqqq wgqqqqq commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator

Why

Desktop Package for v1.0.7 failed on every platform within ~2 minutes with:

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '.../design-system/packages/design-tokens/dist/index.js'
imported from .../scripts/generate-miniapp-chrome-theme.mjs
Error: MiniApp shell preparation failed: 1

Run: https://github.com/GCWing/OpenBitFun/actions/runs/39593197901 (Package (linux-x64), plus macos/windows identical)

Root cause

scripts/desktop-tauri-build.mjs calls prepareMiniAppShell() before Tauri's frontend build. The design-system/packages/*/dist entries that scripts/generate-miniapp-chrome-theme.mjs imports are produced by the web-ui prebuild (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:

  • nightly passes — it runs type-check:web (whose pretype-check builds the design-system packages) before desktop:build:*;
  • local workspaces have a pre-warmed dist;
  • PR CI never runs desktop:build.

The last Desktop Package run (v1.0.6, Oct 15) predates the change, so v1.0.7 is the first release to hit it.

Change

prepare-miniapp-shell.mjs now 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 pass
  • Reproduced the CI failure locally by removing both dist dirs, then confirmed the generator succeeds after the guard runs, and that generate-miniapp-chrome-theme.mjs --check reports no drift against the committed src/shared/miniapp-chrome/generated/theme.css

…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>
@wgqqqqq
wgqqqqq merged commit db7d365 into main Oct 21, 2026
13 checks passed
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.

1 participant