@deeeed/metamask-harness 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.2 - 2026-07-04
4
+
5
+ ### Fixed
6
+ - **IMP-21: FORCE_COLOR-safe pod install** — the mobile pod-triggering leaves (`yarn-setup.sh` running `yarn setup`, and `open-device.sh` running the native `yarn start:ios|android` build) now run with `FORCE_COLOR=0` / `NO_COLOR=1`. VisionCamera's podspec probes `node --print require.resolve('react-native-worklets-core')` and treats any output other than the exact string `undefined` as "found"; an inherited `FORCE_COLOR` made node emit a colorized `undefined`, enabling FrameProcessors and hard-failing on the missing worklets pod. Setup/native builds are now reliable from a `FORCE_COLOR` shell.
7
+ - **IMP-22: `--watcher-port` beats `.js.env WATCHER_PORT`** — `verify.sh` port resolution now honors an explicit `WATCHER_PORT` in the process env (which carries `mm-harness launch --watcher-port N`) over the target's `.js.env`. Precedence is flag > process env > `.js.env` > `8081` default, so a run can be pointed at an alternate Metro/CDP port without editing a shared slot's `.js.env`.
8
+
3
9
  ## 0.3.1 - 2026-07-03
4
10
 
5
11
  ### Fixed
@@ -174,14 +174,21 @@ watcher_port() {
174
174
  const fs = require('fs');
175
175
  const path = require('path');
176
176
  const target = process.env.TARGET_FOR_WATCHER_PORT;
177
- let port = process.env.WATCHER_PORT || '8081';
178
- for (const file of ['.js.env', '.env', '.env.local']) {
179
- const full = path.join(target, file);
180
- if (!fs.existsSync(full)) continue;
181
- const text = fs.readFileSync(full, 'utf8');
182
- const match = text.match(/^\s*(?:export\s+)?WATCHER_PORT=(["']?)([0-9]+)\1/m);
183
- if (match) { port = match[2]; break; }
177
+ // Precedence: an explicit WATCHER_PORT in the process env (which carries the
178
+ // --watcher-port flag applied by launch) wins over the slot's .js.env, which wins
179
+ // over the 8081 default. This lets a run be pointed at an alternate Metro without
180
+ // editing a shared slot .js.env.
181
+ let port = process.env.WATCHER_PORT || '';
182
+ if (!port) {
183
+ for (const file of ['.js.env', '.env', '.env.local']) {
184
+ const full = path.join(target, file);
185
+ if (!fs.existsSync(full)) continue;
186
+ const text = fs.readFileSync(full, 'utf8');
187
+ const match = text.match(/^\s*(?:export\s+)?WATCHER_PORT=(["']?)([0-9]+)\1/m);
188
+ if (match) { port = match[2]; break; }
189
+ }
184
190
  }
191
+ if (!port) port = '8081';
185
192
  console.log(port);
186
193
  NODE
187
194
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deeeed/metamask-harness",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mm-harness": "bin/mm-harness"
@@ -18,6 +18,14 @@ import {
18
18
 
19
19
  export { type MobileRuntimeDecisionReport };
20
20
 
21
+ // Pod install (run by `yarn setup` and by the native `yarn start:ios|android`
22
+ // build) shells `node --print require.resolve('react-native-worklets-core')` and
23
+ // treats any output other than the exact string `undefined` as "module found".
24
+ // An inherited FORCE_COLOR makes node emit a colorized `undefined`, so VisionCamera
25
+ // misdetects the worklets pod, enables FrameProcessors, and fails on the missing
26
+ // pod. Force plain output for pod-triggering spawns so the probe reads `undefined`.
27
+ const POD_PROBE_ENV: Record<string, string> = { FORCE_COLOR: '0', NO_COLOR: '1' };
28
+
21
29
  export interface PrepareMobileOptions extends MobileRuntimeDecisionOptions {
22
30
  /** Pass through to leaf-script spawnScript calls so output is suppressed in --json mode. */
23
31
  json?: boolean;
@@ -159,9 +167,9 @@ function dispatchAction(
159
167
  const cwd = action.cwd ?? target;
160
168
  switch (action.id) {
161
169
  case 'yarn-setup': {
162
- // Leaf: install node_modules (deps missing or stale).
170
+ // Leaf: install node_modules (deps missing or stale); `yarn setup` runs pods.
163
171
  const leaf = path.join(runnerDir, 'adapters/mobile/yarn-setup.sh');
164
- return spawnScript(leaf, ['--target', cwd], target, json);
172
+ return spawnScript(leaf, ['--target', cwd], target, json, POD_PROBE_ENV);
165
173
  }
166
174
  case 'start-metro': {
167
175
  // Leaf: ensure Metro is running; argv may carry --clear for cache reset.
@@ -185,13 +193,16 @@ function dispatchAction(
185
193
  return spawnScript(leaf, ['--target', cwd, '--clear'], target, json);
186
194
  }
187
195
  case 'launch-mobile-runtime': {
188
- // Leaf: open the MetaMask Mobile dev client on the simulator/device.
196
+ // Leaf: open the MetaMask Mobile dev client on the simulator/device. In
197
+ // auto/rebuild modes this runs the native build (`yarn start:*`), which
198
+ // triggers pod install — pass the pod-probe env so it stays FORCE_COLOR-safe.
189
199
  const leaf = path.join(runnerDir, 'adapters/mobile/open-device.sh');
190
200
  return spawnScript(
191
201
  leaf,
192
202
  ['--platform', platform, '--target', cwd, '--preflight-mode', preflightMode],
193
203
  target,
194
204
  json,
205
+ POD_PROBE_ENV,
195
206
  );
196
207
  }
197
208
  case 'rebuild-native-dev-client': {
@@ -95,12 +95,14 @@ export interface ScriptResult {
95
95
 
96
96
  // Compose an adapters/ script directly. Output is always captured (needed for
97
97
  // heal classification) and, in human mode, forwarded to stderr. --json keeps
98
- // stdout clean for the machine summary.
98
+ // stdout clean for the machine summary. `env` overlays extra vars onto the
99
+ // inherited environment for spawns that need a scoped variable (e.g. color mode).
99
100
  export function spawnScript(
100
101
  script: string,
101
102
  args: string[],
102
103
  cwd: string,
103
104
  json: boolean,
105
+ env?: Record<string, string>,
104
106
  ): ScriptResult {
105
107
  // For node invocations (script === process.execPath) the seam stem is derived
106
108
  // from args[0] so each spawned script has its own override key.
@@ -114,7 +116,7 @@ export function spawnScript(
114
116
  const result = spawnSync(bin, spawnArgs, {
115
117
  cwd,
116
118
  encoding: 'utf8',
117
- env: process.env,
119
+ env: env ? { ...process.env, ...env } : process.env,
118
120
  maxBuffer: 64 * 1024 * 1024,
119
121
  });
120
122
  if (result.error) {