Skip to content

Commit 23f7328

Browse files
committed
chore: add support for simulator
1 parent 4c0489c commit 23f7328

4 files changed

Lines changed: 7 additions & 6 deletions

File tree

packages/repack/src/commands/common/__tests__/setupInteractions.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ describe('setupInteractions', () => {
277277
);
278278
expect(mockProcess.stdout.write).toHaveBeenNthCalledWith(
279279
6,
280-
' s: Open iOS Simulator\n'
280+
' s: Open iOS Simulator (unsupported, on non-macOS platforms)\n'
281281
);
282282
expect(mockProcess.stdout.write).toHaveBeenNthCalledWith(
283283
7,

packages/repack/src/commands/common/openEmulator.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { execSync, spawn } from 'node:child_process';
2+
import { isCancel, log, select } from '@clack/prompts';
23

34
function getRunningEmulators(): string[] {
45
try {
@@ -36,8 +37,6 @@ export async function openEmulator() {
3637
throw new Error('No Android Virtual Device found');
3738
}
3839

39-
const { select, isCancel, log } = await import('@clack/prompts');
40-
4140
const runningEmulators = getRunningEmulators();
4241

4342
if (runningEmulators.length > 0) {

packages/repack/src/commands/common/openSimulator.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { execSync } from 'node:child_process';
2+
import { isCancel, log, select } from '@clack/prompts';
23

34
interface Simulator {
45
name: string;
@@ -41,8 +42,6 @@ export async function openSimulator() {
4142
});
4243
}
4344

44-
const { select, isCancel, log } = await import('@clack/prompts');
45-
4645
// Log running simulators
4746
if (runningSimulators.length > 0) {
4847
log.info('Running simulators:');

packages/repack/src/commands/common/setupInteractions.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,12 @@ export function setupInteractions(
111111
helpName: 'Open Android Emulator',
112112
},
113113
s: {
114-
action: handlers.onOpenSimulator,
114+
action:
115+
process.platform === 'darwin' ? handlers.onOpenSimulator : undefined,
115116
postPerformMessage: 'Opening iOS Simulator',
116117
helpName: 'Open iOS Simulator',
118+
actionUnsupportedExplanation:
119+
process.platform !== 'darwin' ? 'on non-macOS platforms' : undefined,
117120
},
118121
};
119122

0 commit comments

Comments
 (0)