Skip to content

Commit 18322da

Browse files
chrfalchclaude
andcommitted
CI: fix Flow errors in the SwiftPM e2e scripts
- spm-ios-e2e.js: build the execFileSync `env` from process.env's string entries only (process.env is Flow-typed to allow numbers, which the execFileSync `env` option rejects), and omit `env` entirely when there is no override so the child inherits process.env as-is. - Both scripts: suppress the parseArgs [incompatible-type] error with the standard "Natural Inference rollout" $FlowFixMe, matching set-version.js and init-project-e2e.js. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent da5340e commit 18322da

2 files changed

Lines changed: 33 additions & 7 deletions

File tree

scripts/e2e/spm-ios-e2e.js

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,18 +109,36 @@ function step(msg /*: string */) {
109109
console.log(`\n\x1b[35m==> ${msg}\x1b[0m`);
110110
}
111111

112+
// process.env is typed to allow numbers, but execFileSync's `env` option wants
113+
// string values only — copy across just the string entries.
114+
function stringEnv() /*: {[string]: string} */ {
115+
const out /*: {[string]: string} */ = {};
116+
for (const key of Object.keys(process.env)) {
117+
const value = process.env[key];
118+
if (typeof value === 'string') {
119+
out[key] = value;
120+
}
121+
}
122+
return out;
123+
}
124+
112125
function run(
113126
cmd /*: string */,
114127
args /*: Array<string> */,
115128
cwd /*: string */,
116129
env /*:: ?: {[string]: string} */,
117130
) /*: void */ {
118131
console.log(`$ (cd ${cwd} && ${cmd} ${args.join(' ')})`);
119-
execFileSync(cmd, args, {
120-
cwd,
121-
stdio: 'inherit',
122-
env: env != null ? {...process.env, ...env} : process.env,
123-
});
132+
// With no override, omit `env` so execFileSync inherits process.env as-is.
133+
if (env != null) {
134+
execFileSync(cmd, args, {
135+
cwd,
136+
stdio: 'inherit',
137+
env: {...stringEnv(), ...env},
138+
});
139+
} else {
140+
execFileSync(cmd, args, {cwd, stdio: 'inherit'});
141+
}
124142
}
125143

126144
function resolveInRepoApp(app /*: 'rntester' | 'helloworld' */) /*: AppMeta */ {
@@ -375,7 +393,11 @@ function assertEmbeddedFlavor(
375393
}
376394

377395
async function main() /*: Promise<void> */ {
378-
const {values} = parseArgs(config);
396+
const {
397+
values,
398+
/* $FlowFixMe[incompatible-type] Natural Inference rollout. See
399+
* https://fburl.com/workplace/6291gfvu */
400+
} = parseArgs(config);
379401

380402
if (values.help) {
381403
console.log(HELP);

scripts/e2e/spm-prime-artifacts.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,11 @@ const config = {
100100
};
101101

102102
async function main() /*: Promise<void> */ {
103-
const {values} = parseArgs(config);
103+
const {
104+
values,
105+
/* $FlowFixMe[incompatible-type] Natural Inference rollout. See
106+
* https://fburl.com/workplace/6291gfvu */
107+
} = parseArgs(config);
104108

105109
if (values.help) {
106110
console.log(HELP);

0 commit comments

Comments
 (0)