From 4d367241fa8f9536fab21da94f052d94aca9bebf Mon Sep 17 00:00:00 2001 From: Alex Hunt Date: Mon, 21 Aug 2023 05:26:45 -0700 Subject: [PATCH] Bump community-cli-plugin and dev-middleware, sync changes (#39074) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/39074 Changelog: [Internal] Publish new versions of `react-native/community-cli-plugin` and `react-native/dev-middleware` (which are now in a minimum viable state) for early integrators. Also syncs final upstream changes from CLI: - https://github.com/react-native-community/cli/pull/2035 - https://github.com/react-native-community/cli/pull/2052 #publish-packages-to-npm bypass-github-export-checks Reviewed By: motiz88 Differential Revision: D48465522 fbshipit-source-id: 8f92a125aaa6c9268b716fdfa7fac3191c844eca --- packages/community-cli-plugin/README.md | 6 ++-- packages/community-cli-plugin/package.json | 2 +- .../src/commands/start/attachKeyHandlers.js | 36 ++++++++++++------- packages/dev-middleware/package.json | 2 +- 4 files changed, 29 insertions(+), 17 deletions(-) diff --git a/packages/community-cli-plugin/README.md b/packages/community-cli-plugin/README.md index 2f39b8770ecf64..423512ee9ceb32 100644 --- a/packages/community-cli-plugin/README.md +++ b/packages/community-cli-plugin/README.md @@ -15,7 +15,7 @@ Start the React Native development server. #### Usage ```sh -react-native start [options] +npx react-native start [options] ``` #### Options @@ -45,7 +45,7 @@ Build the bundle for the provided JavaScript entry file. #### Usage ```sh -react-native bundle --entry-file [options] +npx react-native bundle --entry-file [options] ``` #### Options @@ -75,7 +75,7 @@ Build the [RAM bundle](https://reactnative.dev/docs/ram-bundles-inline-requires) #### Usage ```sh -react-native ram-bundle --entry-file [options] +npx react-native ram-bundle --entry-file [options] ``` #### Options diff --git a/packages/community-cli-plugin/package.json b/packages/community-cli-plugin/package.json index 881a5bc68fba0a..ed13c21b34ac6e 100644 --- a/packages/community-cli-plugin/package.json +++ b/packages/community-cli-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@react-native/community-cli-plugin", - "version": "0.73.0", + "version": "0.73.1", "description": "Core CLI commands for React Native", "keywords": [ "react-native", diff --git a/packages/community-cli-plugin/src/commands/start/attachKeyHandlers.js b/packages/community-cli-plugin/src/commands/start/attachKeyHandlers.js index 970441abe710b4..3622815d3d462f 100644 --- a/packages/community-cli-plugin/src/commands/start/attachKeyHandlers.js +++ b/packages/community-cli-plugin/src/commands/start/attachKeyHandlers.js @@ -38,7 +38,11 @@ export default function attachKeyHandlers( // $FlowIgnore[prop-missing] process.stdin.setRawMode(true); - const onPressAsync = async (key: string) => { + const execaOptions = { + env: {FORCE_COLOR: chalk.supportsColor ? 'true' : 'false'}, + }; + + const onPress = async (key: string) => { switch (key) { case 'r': messageSocket.broadcast('reload', null); @@ -50,19 +54,27 @@ export default function attachKeyHandlers( break; case 'i': logger.info('Opening app on iOS...'); - execa('npx', [ - 'react-native', - 'run-ios', - ...(cliConfig.project.ios?.watchModeCommandParams ?? []), - ]).stdout?.pipe(process.stdout); + execa( + 'npx', + [ + 'react-native', + 'run-ios', + ...(cliConfig.project.ios?.watchModeCommandParams ?? []), + ], + execaOptions, + ).stdout?.pipe(process.stdout); break; case 'a': logger.info('Opening app on Android...'); - execa('npx', [ - 'react-native', - 'run-android', - ...(cliConfig.project.android?.watchModeCommandParams ?? []), - ]).stdout?.pipe(process.stdout); + execa( + 'npx', + [ + 'react-native', + 'run-android', + ...(cliConfig.project.android?.watchModeCommandParams ?? []), + ], + execaOptions, + ).stdout?.pipe(process.stdout); break; case CTRL_Z: process.emit('SIGTSTP', 'SIGTSTP'); @@ -72,7 +84,7 @@ export default function attachKeyHandlers( } }; - const keyPressHandler = new KeyPressHandler(onPressAsync); + const keyPressHandler = new KeyPressHandler(onPress); const listener = keyPressHandler.createInteractionListener(); addInteractionListener(listener); keyPressHandler.startInterceptingKeyStrokes(); diff --git a/packages/dev-middleware/package.json b/packages/dev-middleware/package.json index f32f164ebb67ff..4dae54297bb4fe 100644 --- a/packages/dev-middleware/package.json +++ b/packages/dev-middleware/package.json @@ -1,6 +1,6 @@ { "name": "@react-native/dev-middleware", - "version": "0.73.0", + "version": "0.73.1", "description": "Dev server middleware for React Native", "keywords": [ "react-native",