From 3bfb2bd0942907afd1fd4120f4083fe41f41d5d1 Mon Sep 17 00:00:00 2001 From: Oleksandr Suvorov Date: Wed, 28 Oct 2026 14:27:25 +0200 Subject: [PATCH] fix(build): explain missing mobile/ deps instead of failing build:mobile-web (#24325) mobile/ is a separate pnpm project, so the root pnpm install leaves mobile/node_modules empty and pnpm build failed in build:mobile-web with hundreds of unexplained esbuild "Could not resolve" errors. build-mobile-web-app-bundle now checks for mobile/node_modules first and exits with the one command that fixes it. The probe path is shared with the bundle tests' dependency check. CONTRIBUTING documents the install in Local Setup and points "Before Opening a PR" at it. Fixes #24324 Co-authored-by: Neil --- .github/CONTRIBUTING.md | 11 ++++++++++- config/scripts/build-mobile-web-app-bundle.mjs | 9 ++++++++- .../mobile-web-app-bundle-dependencies.mjs | 11 ++++++++--- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 97590bd251a..f791a59c63e 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -53,6 +53,15 @@ pnpm install pnpm dev ``` +`mobile/` is a separate pnpm project with its own lockfile, so the root `pnpm install` leaves its +dependencies uninstalled. `pnpm build` (`build:mobile-web` fails without them) and the lint +passes that cover `mobile/` need them. Install them before building or linting, and again +when `mobile/pnpm-lock.yaml` changes: + +```bash +pnpm -C mobile install --frozen-lockfile +``` + ### Dev Profiles and Parallel Instances `pnpm dev` in a linked Git worktree uses its own userData profile, renderer port, and remote @@ -170,7 +179,7 @@ Avoid vague names like `test`, `misc`, or `changes`. ## Before Opening a PR -Run the same checks that CI runs: +Run the same checks that CI runs, after the `mobile/` install from [Local Setup](#local-setup): ```bash pnpm lint diff --git a/config/scripts/build-mobile-web-app-bundle.mjs b/config/scripts/build-mobile-web-app-bundle.mjs index 4f2d0a32b17..d7ec945614d 100644 --- a/config/scripts/build-mobile-web-app-bundle.mjs +++ b/config/scripts/build-mobile-web-app-bundle.mjs @@ -1,6 +1,7 @@ import { readFile } from 'node:fs/promises' import { readRouteSnapshot } from './mobile-web-app/mobile-web-app-route-snapshot.mjs' -import { realpathSync } from 'node:fs' +import { MOBILE_WEB_APP_DEPENDENCY_PATH } from './mobile-web-app/mobile-web-app-bundle-dependencies.mjs' +import { existsSync, realpathSync } from 'node:fs' import { basename, extname, join, resolve } from 'node:path' import { createRequire } from 'node:module' import { fileURLToPath } from 'node:url' @@ -503,6 +504,12 @@ export async function buildMobileWebAppBundle({ } if (isDirectInvocation(import.meta.url, process.argv[1])) { + if (!existsSync(MOBILE_WEB_APP_DEPENDENCY_PATH)) { + console.error( + '[build-mobile-web-app-bundle] mobile/ dependencies are not installed; run `pnpm -C mobile install --frozen-lockfile`' + ) + process.exit(1) + } try { const { manifest, outDir, routeKeys, entryStaticBytes, chunkCount } = await buildMobileWebAppBundle() diff --git a/config/scripts/mobile-web-app/mobile-web-app-bundle-dependencies.mjs b/config/scripts/mobile-web-app/mobile-web-app-bundle-dependencies.mjs index 36465dbfa1b..4d6dd232805 100644 --- a/config/scripts/mobile-web-app/mobile-web-app-bundle-dependencies.mjs +++ b/config/scripts/mobile-web-app/mobile-web-app-bundle-dependencies.mjs @@ -7,14 +7,19 @@ const projectDir = fileURLToPath(new URL('../../..', import.meta.url)) // Mobile CI requires dependencies so broken installs fail instead of silently skipping their tests. export const MOBILE_WEB_APP_DEPENDENCIES_REQUIRED_ENV = 'ORCA_MOBILE_WEB_APP_DEPS_REQUIRED' +export const MOBILE_WEB_APP_DEPENDENCY_PATH = join( + projectDir, + 'mobile', + 'node_modules', + 'react-native-web' +) + const SKIP_NOTICE = '[mobile-web-app] skipping the bundling tests: mobile/node_modules/react-native-web is absent. ' + 'They run for real in pr.yml, in the mobile_web_app job, which installs mobile dependencies.' // Sharded root tests omit mobile/node_modules; check availability before bundling react-native-web pages. -export function mobileWebAppDependenciesPresent( - modulePath = join(projectDir, 'mobile', 'node_modules', 'react-native-web') -) { +export function mobileWebAppDependenciesPresent(modulePath = MOBILE_WEB_APP_DEPENDENCY_PATH) { if (existsSync(modulePath)) { return true }