mirror of
https://github.com/hanzoai/gui.git
synced 2026-11-03 00:13:54 +00:00
This repo could never sync. There was NO merge-base with tamagui — 372 commits
here against 15,791 there, unrelated histories — because it began as a
copy-paste rebrand with a flattened layout. Every "sync" since was a hand
re-application that drifted, which is why the tree sat on 7.3.1 while upstream
shipped fixes we then rediscovered by hand.
This commit's PARENT IS TAMAGUI. A future sync is `git merge tama/main` then
`node scripts/rebrand.mjs` — a real merge, because the history is now shared.
174 packages: 166 upstream, our 8 restored (chrome, shell, telemetry, recipes,
get, font-geist-{sans,mono}, @hanzo/booker), bento-get gained. 170/170 build.
Our patches to files UPSTREAM ALSO OWNS are carried, which the package-level
delta missed and which was where the value actually was:
- useMedia's server snapshot (`initState ?? getMedia()`). Upstream still
returns undefined there, so every Tamagui Dialog kills a prerender — the
exact crash hanzo.app spent a day on.
- data-slot on web host nodes, absent upstream entirely.
Both applied ONTO upstream's newer files (it rewrote useMedia +150/-63 and
createComponent +160/-55), marked `PATCH (ours, carried across the transplant)`.
Seven traps are encoded in scripts/rebrand.mjs, each found by a gate:
skip itself and lockfiles; special-case the double-branded names in BOTH scoped
and bare form; map path strings, not just paths; drop a level for the flattened
group; check disk rather than a stale index.
Rust build artifacts are NOT committed. An earlier draft of this commit swept
apps/desktop/src-tauri/target/debug in via `git add -A` — 3,859 files including
a 272MB .a, over GitHub's 100MB cap, so the push could never have landed. They
are gitignored now.
Co-Authored-By: Hanzo Dev <[email protected]>
186 lines
6.3 KiB
JavaScript
186 lines
6.3 KiB
JavaScript
// force single worker - multiple workers cause ECOMPROMISED lock file errors
|
|
// see: https://github.com/wix/Detox/issues/4210
|
|
const { execFileSync } = require('node:child_process')
|
|
const { existsSync } = require('node:fs')
|
|
const { join } = require('node:path')
|
|
|
|
const maxWorkers = 1
|
|
// dedicated detox metro port - both platforms route through it.
|
|
// Android: app reads from android/app/src/main/res/values/integers.xml
|
|
// iOS: launchArgs.RCT_jsLocation tells RCTBundleURLProvider where metro is
|
|
const detoxMetroPort = process.env.DETOX_METRO_PORT || '9034'
|
|
const defaultAndroidSdkRoot =
|
|
process.env.ANDROID_SDK_ROOT ||
|
|
process.env.ANDROID_HOME ||
|
|
join(process.env.HOME || '', 'Library/Android/sdk')
|
|
const simulatorDevice = process.env.DETOX_DEVICE_UDID
|
|
? { id: process.env.DETOX_DEVICE_UDID }
|
|
: { type: process.env.DETOX_DEVICE || 'iPhone 16' }
|
|
|
|
function detectLocalAvdName() {
|
|
if (process.env.DETOX_AVD_NAME) {
|
|
return process.env.DETOX_AVD_NAME
|
|
}
|
|
|
|
const sdkRoot =
|
|
process.env.ANDROID_SDK_ROOT ||
|
|
process.env.ANDROID_HOME ||
|
|
join(process.env.HOME || '', 'Library/Android/sdk')
|
|
const emulatorPath = join(sdkRoot, 'emulator', 'emulator')
|
|
|
|
if (!existsSync(emulatorPath)) {
|
|
return 'Pixel_6_API_33_8GB'
|
|
}
|
|
|
|
try {
|
|
const avds = execFileSync(emulatorPath, ['-list-avds'], {
|
|
encoding: 'utf8',
|
|
stdio: ['ignore', 'pipe', 'ignore'],
|
|
})
|
|
.split('\n')
|
|
.map((line) => line.trim())
|
|
.filter(Boolean)
|
|
|
|
const preferred = ['Pixel_6_API_33_8GB', 'Pixel_6_API_31', 'Medium_Phone_API_36.1']
|
|
|
|
return (
|
|
preferred.find((name) => avds.includes(name)) || avds[0] || 'Pixel_6_API_33_8GB'
|
|
)
|
|
} catch {
|
|
return 'Pixel_6_API_33_8GB'
|
|
}
|
|
}
|
|
|
|
const localAndroidAvdName = detectLocalAvdName()
|
|
|
|
/** @type {Detox.DetoxConfig} */
|
|
module.exports = {
|
|
testRunner: {
|
|
args: {
|
|
$0: 'jest',
|
|
config: 'e2e/jest.config.js',
|
|
maxWorkers,
|
|
},
|
|
jest: {
|
|
setupTimeout: 300000, // 5 minutes - slow CI runners can exceed 180s, especially for tests that compile in beforeAll
|
|
// no whole-file retry: detox --retries re-runs the entire spec file (beforeAll +
|
|
// every test again), which is the 2x wall-time variance we're killing. individual
|
|
// flaky tests retry in-place via jest.retryTimes (see e2e/jest.setup.ts), which
|
|
// re-runs just the test + its beforeEach (fresh app) - far cheaper.
|
|
},
|
|
},
|
|
artifacts: {
|
|
rootDir: './e2e/artifacts',
|
|
plugins: {
|
|
screenshot: 'failing',
|
|
uiHierarchy: 'enabled',
|
|
},
|
|
},
|
|
behavior: {
|
|
init: {
|
|
exposeGlobals: true,
|
|
},
|
|
// NOTE: do NOT set launchApp: 'manual' here. In detox 'manual' does not mean
|
|
// "the test calls device.launchApp itself" (that's always allowed) - it makes
|
|
// RuntimeDevice.launchApp route through waitForAppLaunch, which printLaunchHint()
|
|
// + pressAnyKey() and crashes in CI ('process.stdin.setRawMode is not a function')
|
|
// since stdin isn't a TTY. Leave it at the default 'auto'.
|
|
},
|
|
apps: {
|
|
'ios.debug': {
|
|
type: 'ios.app',
|
|
// CI uses 'build/' (set via env var), local uses global DerivedData
|
|
// note: -derivedDataPath is ignored when Xcode has IDEBuildLocationStyle=Custom
|
|
// so we use BUILT_PRODUCTS_DIR to force the output location
|
|
binaryPath:
|
|
process.env.DETOX_IOS_APP_PATH ||
|
|
'ios/build/Build/Products/Debug-iphonesimulator/hanzoguikitchensink.app',
|
|
build:
|
|
'xcodebuild -workspace ios/hanzoguikitchensink.xcworkspace -scheme hanzoguikitchensink -configuration Debug -sdk iphonesimulator SYMROOT="$(pwd)/ios/build/Build/Products" OBJROOT="$(pwd)/ios/build/Build/Intermediates.noindex"',
|
|
// tell RCTBundleURLProvider where metro is (auto-detection fails with dev-client)
|
|
launchArgs: {
|
|
RCT_jsLocation: `localhost:${detoxMetroPort}`,
|
|
},
|
|
},
|
|
'ios.release': {
|
|
type: 'ios.app',
|
|
binaryPath:
|
|
process.env.DETOX_IOS_APP_PATH ||
|
|
'ios/build/Build/Products/Release-iphonesimulator/hanzoguikitchensink.app',
|
|
build:
|
|
'xcodebuild -workspace ios/hanzoguikitchensink.xcworkspace -scheme hanzoguikitchensink -configuration Release -sdk iphonesimulator SYMROOT="$(pwd)/ios/build/Build/Products" OBJROOT="$(pwd)/ios/build/Build/Intermediates.noindex"',
|
|
},
|
|
'android.debug': {
|
|
type: 'android.apk',
|
|
binaryPath: 'android/app/build/outputs/apk/debug/app-debug.apk',
|
|
testBinaryPath:
|
|
'android/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk',
|
|
build: `cd android && ANDROID_SDK_ROOT="${defaultAndroidSdkRoot}" ANDROID_HOME="${defaultAndroidSdkRoot}" ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug --init-script init.gradle`,
|
|
// Dedicated Metro port for Detox plus the Detox server port.
|
|
reversePorts: [Number(detoxMetroPort), 8099],
|
|
},
|
|
'android.release': {
|
|
type: 'android.apk',
|
|
binaryPath: 'android/app/build/outputs/apk/release/app-release.apk',
|
|
build: `cd android && ANDROID_SDK_ROOT="${defaultAndroidSdkRoot}" ANDROID_HOME="${defaultAndroidSdkRoot}" ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release`,
|
|
},
|
|
},
|
|
devices: {
|
|
simulator: {
|
|
type: 'ios.simulator',
|
|
device: simulatorDevice,
|
|
},
|
|
attached: {
|
|
type: 'android.attached',
|
|
device: {
|
|
adbName: '.*',
|
|
},
|
|
},
|
|
emulator: {
|
|
type: 'android.emulator',
|
|
device: {
|
|
// Local development - use your own AVD name (default matches what native-ci expects)
|
|
avdName: localAndroidAvdName,
|
|
},
|
|
},
|
|
// CI emulator - created by reactivecircus/android-emulator-runner
|
|
'emulator.ci': {
|
|
type: 'android.emulator',
|
|
device: {
|
|
avdName: 'test',
|
|
},
|
|
},
|
|
},
|
|
configurations: {
|
|
'ios.sim.debug': {
|
|
device: 'simulator',
|
|
app: 'ios.debug',
|
|
},
|
|
'ios.sim.release': {
|
|
device: 'simulator',
|
|
app: 'ios.release',
|
|
},
|
|
'android.att.debug': {
|
|
device: 'attached',
|
|
app: 'android.debug',
|
|
},
|
|
'android.att.release': {
|
|
device: 'attached',
|
|
app: 'android.release',
|
|
},
|
|
'android.emu.debug': {
|
|
device: 'emulator',
|
|
app: 'android.debug',
|
|
},
|
|
'android.emu.release': {
|
|
device: 'emulator',
|
|
app: 'android.release',
|
|
},
|
|
// CI configurations
|
|
'android.emu.ci.debug': {
|
|
device: 'emulator.ci',
|
|
app: 'android.debug',
|
|
},
|
|
},
|
|
}
|