mirror of
https://github.com/stablyai/orca.git
synced 2026-10-30 16:47:34 +00:00
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 <neil@stably.ai>
This commit is contained in:
co-authored by
Neil
parent
daf806bb41
commit
3bfb2bd094
+10
-1
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user