eas-cli 24.1.0 → 24.1.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/README.md +131 -131
- package/build/commands/simulator/egress.js +1 -1
- package/build/commands/simulator/index.js +6 -8
- package/build/simulator/egress.js +4 -1
- package/build/simulator/utils.d.ts +12 -2
- package/build/simulator/utils.js +30 -28
- package/oclif.manifest.json +1790 -1790
- package/package.json +2 -2
|
@@ -44,7 +44,7 @@ class SimulatorEgress extends EasCommand_1.default {
|
|
|
44
44
|
...egress,
|
|
45
45
|
signal: abortController.signal,
|
|
46
46
|
onConnected: () => {
|
|
47
|
-
log_1.default.succeed(
|
|
47
|
+
log_1.default.succeed('Egress tunnel connected.');
|
|
48
48
|
},
|
|
49
49
|
onDisconnected: () => {
|
|
50
50
|
log_1.default.warn('Egress tunnel disconnected; reconnecting. Proxied HTTP(S) requests are unavailable until it reconnects.');
|
|
@@ -316,14 +316,15 @@ class Simulator extends EasCommand_1.default {
|
|
|
316
316
|
return;
|
|
317
317
|
}
|
|
318
318
|
log_1.default.newLine();
|
|
319
|
-
log_1.default.log((0, utils_1.formatRemoteSessionInstructions)(remoteConfig, flags['out-config-type'], {
|
|
319
|
+
log_1.default.log((0, utils_1.formatRemoteSessionInstructions)(remoteConfig, flags['out-config-type'], {
|
|
320
|
+
egressAllow,
|
|
321
|
+
egressClientRunsInline: !nonInteractive,
|
|
322
|
+
}));
|
|
320
323
|
log_1.default.newLine();
|
|
321
324
|
const localEgress = (0, utils_1.getLocalEgressConfig)(remoteConfig, egressAllow);
|
|
322
325
|
if (nonInteractive) {
|
|
323
326
|
sessionInterrupt.dispose();
|
|
324
|
-
|
|
325
|
-
log_1.default.log(`Start \`eas simulator:egress${flags['out-config-type'] === OUT_CONFIG_TYPE_VALUES.Env ? ' --config-type env' : ''}\` in another process to connect the tunnel for proxied HTTP(S) requests.`);
|
|
326
|
-
}
|
|
327
|
+
// The instructions above already tell the reader to run eas simulator:egress.
|
|
327
328
|
log_1.default.log(`When you are done, stop the session with: eas simulator:stop --id ${deviceRunSessionId}`);
|
|
328
329
|
return;
|
|
329
330
|
}
|
|
@@ -333,9 +334,6 @@ class Simulator extends EasCommand_1.default {
|
|
|
333
334
|
let egressError;
|
|
334
335
|
const egressAbortController = new AbortController();
|
|
335
336
|
if (localEgress) {
|
|
336
|
-
log_1.default.log("🔀 Running the egress client in this terminal. When connected, proxied HTTP(S) requests can use this machine's network.");
|
|
337
|
-
log_1.default.log('Press Ctrl+C to stop both the egress client and the simulator session.');
|
|
338
|
-
log_1.default.newLine();
|
|
339
337
|
sessionInterrupt.signal.addEventListener('abort', () => {
|
|
340
338
|
egressAbortController.abort();
|
|
341
339
|
}, { once: true });
|
|
@@ -343,7 +341,7 @@ class Simulator extends EasCommand_1.default {
|
|
|
343
341
|
...localEgress,
|
|
344
342
|
signal: egressAbortController.signal,
|
|
345
343
|
onConnected: () => {
|
|
346
|
-
log_1.default.succeed(
|
|
344
|
+
log_1.default.succeed('Egress tunnel connected.');
|
|
347
345
|
},
|
|
348
346
|
onDisconnected: () => {
|
|
349
347
|
log_1.default.warn('Egress tunnel disconnected; reconnecting. Proxied HTTP(S) requests are unavailable until it reconnects.');
|
|
@@ -825,7 +825,10 @@ async function runLocalEgressAsync({ url, token, fingerprint, port, allow = [],
|
|
|
825
825
|
case 'disconnected':
|
|
826
826
|
if (connected) {
|
|
827
827
|
connected = false;
|
|
828
|
-
|
|
828
|
+
// A disconnect we caused by stopping is not something to warn about.
|
|
829
|
+
if (!signal.aborted) {
|
|
830
|
+
onDisconnected?.(line);
|
|
831
|
+
}
|
|
829
832
|
}
|
|
830
833
|
break;
|
|
831
834
|
case 'other':
|
|
@@ -27,6 +27,12 @@ export type LocalEgressConfig = {
|
|
|
27
27
|
};
|
|
28
28
|
export type LocalEgressOptions = {
|
|
29
29
|
egressAllow?: readonly string[];
|
|
30
|
+
/**
|
|
31
|
+
* Whether the calling command runs the egress client itself in the current
|
|
32
|
+
* terminal, as interactive `simulator:start` does. When false the reader must
|
|
33
|
+
* start `eas simulator:egress` in another process.
|
|
34
|
+
*/
|
|
35
|
+
egressClientRunsInline?: boolean;
|
|
30
36
|
};
|
|
31
37
|
/**
|
|
32
38
|
* Connection details for the local egress client, present only for sessions
|
|
@@ -51,7 +57,11 @@ export type LoopbackForwardPlan = {
|
|
|
51
57
|
* port is already taken by the tunnel server, so those entries are skipped.
|
|
52
58
|
*/
|
|
53
59
|
export declare function getLoopbackForwardPlan(allow: readonly string[], proxyPort: number): LoopbackForwardPlan;
|
|
54
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Only the exception is worth a line: forwarded ports just work, but an entry
|
|
62
|
+
* the device host will not forward changes what the reader would expect.
|
|
63
|
+
*/
|
|
64
|
+
export declare function formatLoopbackForwardNotice({ skipped }: LoopbackForwardPlan): string[];
|
|
55
65
|
export declare function getLocalEgressEnvironmentVariables(egress: LocalEgressConfig | null): Record<string, string>;
|
|
56
66
|
export declare function getRemoteSessionEnvironmentVariables(remoteConfig: DeviceRunSessionRemoteConfig, { egressAllow }?: LocalEgressOptions): Record<string, string>;
|
|
57
67
|
type RemoteSessionInstructionsConfigType = 'env' | 'dotenv';
|
|
@@ -66,5 +76,5 @@ export declare function formatPreviewUrl(url: string, token: string | null | und
|
|
|
66
76
|
* it has to know to combine.
|
|
67
77
|
*/
|
|
68
78
|
export declare function sanitizeRemoteConfigForJson(remoteConfig: DeviceRunSessionRemoteConfig): DeviceRunSessionRemoteConfig;
|
|
69
|
-
export declare function formatRemoteSessionInstructions(remoteConfig: DeviceRunSessionRemoteConfig, configType: RemoteSessionInstructionsConfigType, { egressAllow }?: LocalEgressOptions): string;
|
|
79
|
+
export declare function formatRemoteSessionInstructions(remoteConfig: DeviceRunSessionRemoteConfig, configType: RemoteSessionInstructionsConfigType, { egressAllow, egressClientRunsInline }?: LocalEgressOptions): string;
|
|
70
80
|
export {};
|
package/build/simulator/utils.js
CHANGED
|
@@ -89,19 +89,18 @@ function getLoopbackForwardPlan(allow, proxyPort) {
|
|
|
89
89
|
}
|
|
90
90
|
return { ports: [...ports].sort((a, b) => a - b), skipped };
|
|
91
91
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
if (skipped.length > 0) {
|
|
101
|
-
lines.push(`${skipped.join(', ')} ${skipped.length === 1 ? 'is' : 'are'} reachable by name only: ` +
|
|
102
|
-
'privileged ports and the egress proxy port are not forwarded to 127.0.0.1 in the simulator.');
|
|
92
|
+
/**
|
|
93
|
+
* Only the exception is worth a line: forwarded ports just work, but an entry
|
|
94
|
+
* the device host will not forward changes what the reader would expect.
|
|
95
|
+
*/
|
|
96
|
+
function formatLoopbackForwardNotice({ skipped }) {
|
|
97
|
+
if (skipped.length === 0) {
|
|
98
|
+
return [];
|
|
103
99
|
}
|
|
104
|
-
return
|
|
100
|
+
return [
|
|
101
|
+
`${skipped.join(', ')} ${skipped.length === 1 ? 'is' : 'are'} reachable by name only: ` +
|
|
102
|
+
'privileged ports and the egress proxy port are not forwarded to 127.0.0.1 in the simulator.',
|
|
103
|
+
];
|
|
105
104
|
}
|
|
106
105
|
function getLocalEgressEnvironmentVariables(egress) {
|
|
107
106
|
if (!egress) {
|
|
@@ -180,31 +179,34 @@ function sanitizeRemoteConfigForJson(remoteConfig) {
|
|
|
180
179
|
}
|
|
181
180
|
}
|
|
182
181
|
}
|
|
183
|
-
function formatRemoteSessionInstructions(remoteConfig, configType, { egressAllow } = {}) {
|
|
182
|
+
function formatRemoteSessionInstructions(remoteConfig, configType, { egressAllow, egressClientRunsInline = false } = {}) {
|
|
184
183
|
const instructions = formatControllerInstructions(remoteConfig, configType);
|
|
185
184
|
const egress = getLocalEgressConfig(remoteConfig, egressAllow);
|
|
186
185
|
if (!egress) {
|
|
187
186
|
return instructions;
|
|
188
187
|
}
|
|
188
|
+
const egressCommand = configType === 'env' ? 'eas simulator:egress --config-type env' : 'eas simulator:egress';
|
|
189
|
+
const summary = "🔀 Local egress: the simulator's HTTP(S) traffic exits from this machine." +
|
|
190
|
+
(egress.allow.length > 0 ? ` It can also reach ${egress.allow.join(', ')}.` : '');
|
|
189
191
|
return [
|
|
190
192
|
instructions,
|
|
191
193
|
'',
|
|
192
|
-
|
|
193
|
-
...(
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
194
|
+
summary,
|
|
195
|
+
...formatLoopbackForwardNotice(getLoopbackForwardPlan(egress.allow, egress.port)),
|
|
196
|
+
// In interactive mode the client starts in this terminal once the session is
|
|
197
|
+
// ready and stops with it, so there is nothing for the reader to run.
|
|
198
|
+
...(egressClientRunsInline
|
|
199
|
+
? []
|
|
200
|
+
: [
|
|
201
|
+
...(configType === 'env'
|
|
202
|
+
? Object.entries(getLocalEgressEnvironmentVariables(egress)).map(([key, value]) => `export ${key}='${value}'`)
|
|
203
|
+
: []),
|
|
204
|
+
'Run the egress client to connect the tunnel:',
|
|
205
|
+
'',
|
|
206
|
+
egressCommand,
|
|
203
207
|
'',
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
]
|
|
207
|
-
: []),
|
|
208
|
+
'Keep it running for the life of the session.',
|
|
209
|
+
]),
|
|
208
210
|
].join('\n');
|
|
209
211
|
}
|
|
210
212
|
function formatControllerInstructions(remoteConfig, configType) {
|