@rnue/cli
Command line utilities to help with React Native for Unreal Engine development workflows.
On this pageSimple usage
@rnue/cli is a command line utility toolbelt.
Currently its main function is the link command that installs native TurboModules as plugins in your Unreal project.
Simple usage
The simplest way to start using @rnue/cli is by calling in in an rnue app:
npx @rnue/cli linkThe link command will prompt you interactively for the options it needs in order to properly link the native modules to your Unreal project.
Once invoked the link command will perform the following operations:
- Discover all native modules in the dependencies of a
rnueapp. - Validate requirements put forth by the configuration.
- Place the native modules as Unreal plugins in the specified Unreal project.
- Modify the
.uprojectfile to enable the added plugins. - Write managed state to
Saved/RNUE/LinkState.json.
Reference
You can also provide all the options as commandline options and run the command headlessly.
npx @rnue/cli link [uproject-path] [options]Option | Description |
|---|---|
--uproject <path> | Path to the Unreal project's .uproject file or the folder that contains it. This option overrides the positional path. |
--plugins-folder <path> | The preferred plugins folder. This option is only relevant if the target .uproject file has defined a AdditionalPluginDirectories setting. |
--mode link|copy | Placement mode. |
--dry-run | Show planned changes without writing files. |
--prune | Remove plugins that rnue manages but no longer exist as dependencies of the rnue app. This option also restores their managed .uproject entries. |
--accept-uproject-rewrite | Permit a noninteractive rewrite of the .uproject JSON document. |
@rnue/cli link re-serializes the complete .uproject JSON document when plugin references change. This operation can change whitespace. Without --accept-uproject-rewrite, an interactive terminal will ask for approval. A noninteractive terminal will stop without writing anything to the target Unreal project.
Advanced usage
You can run @rnue/cli manually. A package script is more convenient for repeated use in a production environment.
Pin a specific
@rnue/cliversion as a development dependencyInstall the package as a development dependency of the
rnueapp to make it discoverable by your package manager:npm i --save-dev @rnue/cli@0.0.3You can refer to it in the
scriptssection asrnue:package.json { "scripts": { "link:unreal": "rnue link" } }In order to be discovered, a native module must be listed as a dependency in the
package.jsonof thernueapp. Additionally, areact-native.config.jsfile must be present in the native module's package.Field Default Description pluginPathRequired An Unreal Engine plugin generated by @rnue/codegen. buildModulesAll descriptor modules Unreal modules that the package exposes for build integration. Each name must exist in the plugin descriptor. turboModules[]TurboModule names that this package provides. The linker will use this field to reject collisions. fabricComponents[]Fabric component names that this package provides. The linker uses this field to reject collisions. requiresPackages{}Required JavaScript packages and semantic-version ranges. The linker will validate those against the application's dependencies listed in package.json.Here is an example configuration:
react-native.config.js "use strict"; module.exports = { dependency: { platforms: { unreal: { pluginPath: "./unreal/ExampleNative", buildModules: ["ExampleNative"], turboModules: ["ExampleNative"], fabricComponents: ["ExampleNativeView"], requiresPackages: {}, }, }, }, };Configure the location of the target Unreal project
Create an
rnue.config.tsfile in the root of yourrnueapp:Relative paths start from the directory that contains the configuration file.
rnue.config.ts export default { link: { uprojectPath: "/Path/To/Game/MyGame.uproject", pluginsFolder: "/Path/To/Game/Plugins", mode: "link", }, };You can also use environment variables in the config file to make this configuration portable between multiple development and build environments.
Supported alternatives for the configuration filename
The following filenames are correctly discovered by
@rnue/cli:rnue.config.tsrnue.config.mtsrnue.config.ctsrnue.config.jsrnue.config.mjsrnue.config.cjs
Putting configuration in package.json
Another alternative is putting the configuration in
package.jsonunder thernueConfigkey:package.json { "rnueConfig": { "link": { "uprojectPath": "/Path/To/Game/MyGame.uproject", "pluginsFolder": "/Path/To/Game/Plugins", "mode": "copy" } } }Order of configuration resolution
The CLI resolves each configuration field in the following order:
- Command line options
- The nearest
rnue.config.*file - The nearest
package.jsonfile with arnueConfig - Interactively prompted options
rnue.config.tsreferenceField Default Description uprojectPathInteractive prompt A .uprojectfile or a directory that contains exactly one.uprojectfile.pluginsFolderProject Pluginsdirectory or promptThe project Pluginsdirectory or an existingAdditionalPluginDirectoriesentry in the.uprojectfile. If this value is not provided and multiple options exist, the CLI will interactively prompt for a specific choice.modelinklinkorcopy. The plugin placement mode.Placement Modes
Mode Behavior linkCreates a symbolic link from the plugin located in the JavaScript dependencies to the provided Unreal project Pluginsfolder. This is especially useful during active development of a native module.copyThe CLI creates a physical plugin copy. Run the linker again after the package source changes. On macOS and Linux,
linkcreates a project-local plugin directory with links to package-owned entries. Unreal writes generated state inside the project.On Windows,
linkcreates a directory junction to the package plugin.Running the link command
Run the package script from the
rnueapp:npm exec -- rnue link
Managed state and safety
@rnue/cli link uses Saved/RNUE/LinkState.json to identify the plugin directories and project entries that it manages.
The linker will refuse to replace an unmanaged directory or a managed plugin that changed outside of rnue.
The linker stages plugin updates before installation. It restores applied updates when an operation fails.
--prune only removes plugins recorded in managed state. Without this option, undiscovered managed plugins remain in place.
The command can edit the following items:
- Plugin directories under the selected destination
- The
Pluginsentries in the.uprojectfile Saved/RNUE/LinkState.json
The command does not edit Unreal source files, module rules, or target files. It does not add plugin search directories.