Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 22 additions & 10 deletions packages/cli-plugin-metro/src/commands/start/watchMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ function enableWatchMode(messageSocket: any, ctx: Config) {
}
});

const execaOptions = {
env: {FORCE_COLOR: chalk.supportsColor ? 'true' : 'false'},
};

const onPress = (key: string) => {
switch (key) {
case 'r':
Expand All @@ -53,19 +57,27 @@ function enableWatchMode(messageSocket: any, ctx: Config) {
break;
case 'i':
logger.info('Opening app on iOS...');
execa('npx', [
'react-native',
'run-ios',
...(ctx.project.ios?.watchModeCommandParams ?? []),
]).stdout?.pipe(process.stdout);
execa(
'npx',
[
'react-native',
'run-ios',
...(ctx.project.ios?.watchModeCommandParams ?? []),
],
execaOptions,
).stdout?.pipe(process.stdout);
break;
case 'a':
logger.info('Opening app on Android...');
execa('npx', [
'react-native',
'run-android',
...(ctx.project.android?.watchModeCommandParams ?? []),
]).stdout?.pipe(process.stdout);
execa(
'npx',
[
'react-native',
'run-android',
...(ctx.project.android?.watchModeCommandParams ?? []),
],
execaOptions,
).stdout?.pipe(process.stdout);
break;
case CTRL_Z:
process.emit('SIGTSTP', 'SIGTSTP');
Expand Down