From 95113e9dfd0ee2c68b7e21b29ca6982f22647619 Mon Sep 17 00:00:00 2001 From: Tim Yung Date: Mon, 2 Jun 2025 08:40:55 -0700 Subject: [PATCH] RN: Default `featureflags` Script to Update (#51708) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/51708 Changes `yarn featureflags` to default to `--update` when no options are supplied. Provides a way to display the available options with a new `--help` option. Changelog: [Internal] Reviewed By: sammy-SC Differential Revision: D75692119 fbshipit-source-id: 50d25c5f12c7646159872661c93ebe8c42f44788 --- .../react-native/scripts/featureflags/index.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/packages/react-native/scripts/featureflags/index.js b/packages/react-native/scripts/featureflags/index.js index 14b12078685..c88a46560de 100644 --- a/packages/react-native/scripts/featureflags/index.js +++ b/packages/react-native/scripts/featureflags/index.js @@ -19,6 +19,11 @@ if (require.main === module) { command = 'verify-unchanged'; } else if (process.argv.includes('--print')) { command = 'print'; + } else if (process.argv.includes('--help')) { + command = 'help'; + } else { + console.log('Defaulting to `--update`. See all options using `--help`.'); + command = 'update'; } switch (command) { @@ -31,10 +36,12 @@ if (require.main === module) { case 'print': require('./print').default(process.argv.includes('--json')); break; - default: - console.error( - 'Usage: node featureflags.js [--update|--verify-unchanged|--print]', + case 'help': + console.log( + 'Usage: node featureflags.js [--update|--verify-unchanged|--print|--help]', ); - process.exit(1); + break; + default: + throw new Error('Unexpected script execution.'); } }