mirror of
https://github.com/expo/eas-cli.git
synced 2026-11-14 10:08:06 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9d77b2ac50 | ||
|
|
bcf7f3d892 | ||
|
|
0dc37b07d2 | ||
|
|
05a485e80e |
No files matched your search
@@ -10,6 +10,8 @@ This is the log of notable changes to EAS CLI and related packages.
|
||||
|
||||
### 🐛 Bug fixes
|
||||
|
||||
- [eas-cli] Stop telling interactive `eas simulator:start --egress local` users to run `eas simulator:egress` when the egress client already runs in the same terminal. ([#4382](https://github.com/expo/eas-cli/pull/4382) by [@brentvatne](https://github.com/brentvatne))
|
||||
|
||||
### 🧹 Chores
|
||||
|
||||
## [24.1.0](https://github.com/expo/eas-cli/releases/tag/v24.1.0) - 2026-09-10
|
||||
|
||||
@@ -59,9 +59,7 @@ export default class SimulatorEgress extends EasCommand {
|
||||
...egress,
|
||||
signal: abortController.signal,
|
||||
onConnected: () => {
|
||||
Log.succeed(
|
||||
"Egress tunnel connected. Proxied HTTP(S) requests can use this machine's network."
|
||||
);
|
||||
Log.succeed('Egress tunnel connected.');
|
||||
},
|
||||
onDisconnected: () => {
|
||||
Log.warn(
|
||||
|
||||
@@ -419,7 +419,10 @@ export default class Simulator extends EasCommand {
|
||||
|
||||
Log.newLine();
|
||||
Log.log(
|
||||
formatRemoteSessionInstructions(remoteConfig, flags['out-config-type'], { egressAllow })
|
||||
formatRemoteSessionInstructions(remoteConfig, flags['out-config-type'], {
|
||||
egressAllow,
|
||||
egressClientRunsInline: !nonInteractive,
|
||||
})
|
||||
);
|
||||
Log.newLine();
|
||||
|
||||
@@ -444,11 +447,6 @@ export default class Simulator extends EasCommand {
|
||||
let egressError: Error | undefined;
|
||||
const egressAbortController = new AbortController();
|
||||
if (localEgress) {
|
||||
Log.log(
|
||||
"🔀 Running the egress client in this terminal. When connected, proxied HTTP(S) requests can use this machine's network."
|
||||
);
|
||||
Log.log('Press Ctrl+C to stop both the egress client and the simulator session.');
|
||||
Log.newLine();
|
||||
sessionInterrupt.signal.addEventListener(
|
||||
'abort',
|
||||
() => {
|
||||
@@ -460,9 +458,7 @@ export default class Simulator extends EasCommand {
|
||||
...localEgress,
|
||||
signal: egressAbortController.signal,
|
||||
onConnected: () => {
|
||||
Log.succeed(
|
||||
"Egress tunnel connected. Proxied HTTP(S) requests can use this machine's network."
|
||||
);
|
||||
Log.succeed('Egress tunnel connected.');
|
||||
},
|
||||
onDisconnected: () => {
|
||||
Log.warn(
|
||||
|
||||
@@ -61,14 +61,37 @@ describe('local egress configuration', () => {
|
||||
EAS_SIMULATOR_EGRESS_ALLOW: '',
|
||||
});
|
||||
const instructions = formatRemoteSessionInstructions(agentDeviceConfigWithEgress, 'dotenv');
|
||||
expect(instructions).toContain('eas simulator:egress');
|
||||
expect(instructions).toContain(
|
||||
"🔀 Local egress: the simulator's HTTP(S) traffic exits from this machine.\n"
|
||||
);
|
||||
expect(instructions).toContain('Run the egress client to connect the tunnel');
|
||||
expect(instructions).not.toContain('may reach');
|
||||
expect(instructions).toContain('eas simulator:egress');
|
||||
expect(instructions).toContain('Keep it running for the life of the session.');
|
||||
expect(instructions).not.toContain('It can also reach');
|
||||
expect(formatRemoteSessionInstructions(agentDeviceConfigWithEgress, 'env')).toContain(
|
||||
"export EAS_SIMULATOR_EGRESS_ALLOW=''"
|
||||
);
|
||||
});
|
||||
|
||||
it('says nothing about starting the client when it runs inline', () => {
|
||||
for (const configType of ['dotenv', 'env'] as const) {
|
||||
const instructions = formatRemoteSessionInstructions(
|
||||
agentDeviceConfigWithEgress,
|
||||
configType,
|
||||
{
|
||||
egressClientRunsInline: true,
|
||||
}
|
||||
);
|
||||
expect(instructions).toContain(
|
||||
"🔀 Local egress: the simulator's HTTP(S) traffic exits from this machine."
|
||||
);
|
||||
expect(instructions).not.toContain('eas simulator:egress');
|
||||
expect(instructions).not.toContain('Run the egress client');
|
||||
expect(instructions).not.toContain('Keep it running');
|
||||
expect(instructions).not.toContain('export EAS_SIMULATOR_EGRESS');
|
||||
}
|
||||
});
|
||||
|
||||
it('carries the allowed local destinations into the config, env file and instructions', () => {
|
||||
const egressAllow = ['localhost:3000', '192.168.1.20:8080'];
|
||||
expect(getLocalEgressConfig(agentDeviceConfigWithEgress, egressAllow)?.allow).toEqual(
|
||||
@@ -84,19 +107,19 @@ describe('local egress configuration', () => {
|
||||
egressAllow,
|
||||
});
|
||||
expect(instructions).toContain(
|
||||
"The simulator may reach localhost:3000, 192.168.1.20:8080 on this machine's network."
|
||||
);
|
||||
expect(instructions).toContain(
|
||||
'127.0.0.1:3000 in the simulator reaches the same port on this machine (like adb reverse)'
|
||||
"🔀 Local egress: the simulator's HTTP(S) traffic exits from this machine. It can also reach localhost:3000, 192.168.1.20:8080."
|
||||
);
|
||||
expect(instructions).not.toContain('reachable by name only');
|
||||
});
|
||||
|
||||
it('omits the loopback forwarding notice when no allowed destination is loopback', () => {
|
||||
it('warns only about loopback entries the device host will not forward', () => {
|
||||
expect(
|
||||
formatRemoteSessionInstructions(agentDeviceConfigWithEgress, 'dotenv', {
|
||||
egressAllow: ['192.168.1.20:8080'],
|
||||
egressAllow: ['localhost:80', 'localhost:3000'],
|
||||
})
|
||||
).not.toContain('adb reverse');
|
||||
).toContain(
|
||||
'localhost:80 is reachable by name only: privileged ports and the egress proxy port are not forwarded to 127.0.0.1 in the simulator.'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -122,13 +145,13 @@ describe(getLoopbackForwardPlan, () => {
|
||||
});
|
||||
|
||||
describe(formatLoopbackForwardNotice, () => {
|
||||
it('describes forwarded ports and name-only entries', () => {
|
||||
it('describes name-only entries and stays silent about forwarded ports', () => {
|
||||
expect(formatLoopbackForwardNotice({ ports: [3000, 8082], skipped: ['localhost:80'] })).toEqual(
|
||||
[
|
||||
'127.0.0.1:3000, 127.0.0.1:8082 in the simulator reach the same ports on this machine (like adb reverse), so dev server URLs that use 127.0.0.1 work.',
|
||||
'localhost:80 is reachable by name only: privileged ports and the egress proxy port are not forwarded to 127.0.0.1 in the simulator.',
|
||||
]
|
||||
);
|
||||
expect(formatLoopbackForwardNotice({ ports: [3000], skipped: [] })).toEqual([]);
|
||||
expect(formatLoopbackForwardNotice({ ports: [], skipped: [] })).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -81,6 +81,12 @@ export type LocalEgressConfig = {
|
||||
|
||||
export type LocalEgressOptions = {
|
||||
egressAllow?: readonly string[];
|
||||
/**
|
||||
* Whether the calling command runs the egress client itself in the current
|
||||
* terminal, as interactive `simulator:start` does. When false the reader must
|
||||
* start `eas simulator:egress` in another process.
|
||||
*/
|
||||
egressClientRunsInline?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -143,23 +149,18 @@ export function getLoopbackForwardPlan(
|
||||
return { ports: [...ports].sort((a, b) => a - b), skipped };
|
||||
}
|
||||
|
||||
export function formatLoopbackForwardNotice({ ports, skipped }: LoopbackForwardPlan): string[] {
|
||||
const lines: string[] = [];
|
||||
if (ports.length > 0) {
|
||||
const addresses = ports.map(port => `127.0.0.1:${port}`).join(', ');
|
||||
lines.push(
|
||||
`${addresses} in the simulator ${ports.length === 1 ? 'reaches' : 'reach'} the same ` +
|
||||
`${ports.length === 1 ? 'port' : 'ports'} on this machine (like adb reverse), so dev server ` +
|
||||
'URLs that use 127.0.0.1 work.'
|
||||
);
|
||||
/**
|
||||
* Only the exception is worth a line: forwarded ports just work, but an entry
|
||||
* the device host will not forward changes what the reader would expect.
|
||||
*/
|
||||
export function formatLoopbackForwardNotice({ skipped }: LoopbackForwardPlan): string[] {
|
||||
if (skipped.length === 0) {
|
||||
return [];
|
||||
}
|
||||
if (skipped.length > 0) {
|
||||
lines.push(
|
||||
`${skipped.join(', ')} ${skipped.length === 1 ? 'is' : 'are'} reachable by name only: ` +
|
||||
'privileged ports and the egress proxy port are not forwarded to 127.0.0.1 in the simulator.'
|
||||
);
|
||||
}
|
||||
return lines;
|
||||
return [
|
||||
`${skipped.join(', ')} ${skipped.length === 1 ? 'is' : 'are'} reachable by name only: ` +
|
||||
'privileged ports and the egress proxy port are not forwarded to 127.0.0.1 in the simulator.',
|
||||
];
|
||||
}
|
||||
|
||||
export function getLocalEgressEnvironmentVariables(
|
||||
@@ -258,34 +259,39 @@ export function sanitizeRemoteConfigForJson(
|
||||
export function formatRemoteSessionInstructions(
|
||||
remoteConfig: DeviceRunSessionRemoteConfig,
|
||||
configType: RemoteSessionInstructionsConfigType,
|
||||
{ egressAllow }: LocalEgressOptions = {}
|
||||
{ egressAllow, egressClientRunsInline = false }: LocalEgressOptions = {}
|
||||
): string {
|
||||
const instructions = formatControllerInstructions(remoteConfig, configType);
|
||||
const egress = getLocalEgressConfig(remoteConfig, egressAllow);
|
||||
if (!egress) {
|
||||
return instructions;
|
||||
}
|
||||
const egressCommand =
|
||||
configType === 'env' ? 'eas simulator:egress --config-type env' : 'eas simulator:egress';
|
||||
const summary =
|
||||
"🔀 Local egress: the simulator's HTTP(S) traffic exits from this machine." +
|
||||
(egress.allow.length > 0 ? ` It can also reach ${egress.allow.join(', ')}.` : '');
|
||||
return [
|
||||
instructions,
|
||||
'',
|
||||
'🔀 This session can route proxied HTTP(S) requests through this machine.',
|
||||
...(configType === 'env'
|
||||
? Object.entries(getLocalEgressEnvironmentVariables(egress)).map(
|
||||
([key, value]) => `export ${key}='${value}'`
|
||||
)
|
||||
: []),
|
||||
'Run the egress client to connect the tunnel:',
|
||||
'',
|
||||
configType === 'env' ? 'eas simulator:egress --config-type env' : 'eas simulator:egress',
|
||||
'',
|
||||
'Keep it running for the life of the session.',
|
||||
...(egress.allow.length > 0
|
||||
? [
|
||||
summary,
|
||||
...formatLoopbackForwardNotice(getLoopbackForwardPlan(egress.allow, egress.port)),
|
||||
// In interactive mode the client starts in this terminal once the session is
|
||||
// ready and stops with it, so there is nothing for the reader to run.
|
||||
...(egressClientRunsInline
|
||||
? []
|
||||
: [
|
||||
...(configType === 'env'
|
||||
? Object.entries(getLocalEgressEnvironmentVariables(egress)).map(
|
||||
([key, value]) => `export ${key}='${value}'`
|
||||
)
|
||||
: []),
|
||||
'Run the egress client to connect the tunnel:',
|
||||
'',
|
||||
`The simulator may reach ${egress.allow.join(', ')} on this machine's network.`,
|
||||
...formatLoopbackForwardNotice(getLoopbackForwardPlan(egress.allow, egress.port)),
|
||||
]
|
||||
: []),
|
||||
egressCommand,
|
||||
'',
|
||||
'Keep it running for the life of the session.',
|
||||
]),
|
||||
].join('\n');
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user