Skip to content

Commit

Permalink
Introduce "npx react-native codegen" command (#41925)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #41925

This diff introduces the `npx react-native codegen` command.
It runs the codegen for the `package.json` file in current working directory.

Changelog: [General][Added] - Introduce "npx react-native codegen" command.

Reviewed By: cipolleschi

Differential Revision: D51495465

fbshipit-source-id: 1fd4c3645235a12f68f9032349a443b92b4764b8
  • Loading branch information
dmytrorykun authored and facebook-github-bot committed Dec 21, 2023
1 parent 07a159f commit a612053
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions packages/react-native/react-native.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,41 @@ const {
startCommand,
} = require('@react-native/community-cli-plugin');

const codegenCommand = {
name: 'codegen',
options: [
{
name: '--path <path>',
description: 'Path to the React Native project root.',
default: process.cwd(),
},
{
name: '--platform <string>',
description:
'Target platform. Supported values: "android", "ios", "all".',
default: 'all',
},
{
name: '--outputPath <path>',
description: 'Path where generated artifacts will be output to.',
},
],
func: (argv, config, args) =>
require('./scripts/codegen/generate-artifacts-executor').execute(
args.path,
args.platform,
args.outputPath,
),
};

module.exports = {
commands: [
...ios.commands,
...android.commands,
bundleCommand,
ramBundleCommand,
startCommand,
codegenCommand,
],
platforms: {
ios: {
Expand Down

0 comments on commit a612053

Please sign in to comment.