CLI: package, publish and link
CLI reference for the React team and CI: package, publish and link. nuib package, nuib publish, and the advanced nuib link and nuib unlink: options, exit codes and what each one writes.
Run every command in the React project directory, or pass --project <dir>. Each command accepts -h or --help, which prints its options and exits with 0. An option that takes a value needs one: a missing value, or an unknown option, stops the command with exit code 1.
nuib is not on your PATH. The nitro-ui-brownfield-cli package puts it in the project’s node_modules/.bin, and it runs with Bun. Run it inside the project as bun run nuib <command>. The synopses on this page write nuib for short; the examples write the full form.
nuib package
Section titled “nuib package”Synopsis:
nuib package [--platform ios|android|all] [--variant release|dev] [--out <dir>] [--cache-dir <dir>] [--ios-slices <list>] [--android-abis <list>] [--ios-no-export-list] [--project <dir>]Packages the React project as one binary dependency per platform. It reads the contract (every registerSurface call and its props type) and generates one typed Swift and Kotlin entry per surface into the artifact.
| Output | Path | Content |
|---|---|---|
| iOS | <out>/ios/<name>/ |
A SwiftPM package whose binary target is <name>.xcframework. |
| Android | <out>/android/maven/ |
A local Maven repository with the AAR and its POM. |
| Symbols | <out>/symbols/ |
A dSYM per iOS slice, the unstripped libraries per Android ABI and the source map of the app code. The packaged binaries are stripped; the symbols stay beside the artifact, never inside it. |
| Manifest | <out>/manifest.json |
The manifest, written last. |
The previous manifest is removed first, and each platform is moved into place only after its build and checks passed. A failed run leaves no manifest, so nuib publish refuses the output.
| Option | Default | Meaning |
|---|---|---|
--platform ios|android|all |
Every platform the configuration has | What to package. The platform needs its section in the configuration; all needs both. |
--variant release|dev |
release |
release: the app’s normal dependency; it never contacts a server. dev: the same artifact and API plus the development runtime (Fast Refresh, reload, developer menu). It records http://localhost:<dev.port> and tries that dev server at launch; without an answer it starts from the embedded content. |
--out <dir> |
<project>/.nuib/out; <project>/.nuib/out-dev for dev |
The output directory. An existing directory must be empty or one that nuib package created. |
--cache-dir <dir> |
<project>/.nuib/cache |
The build caches. Must be outside the output directory. |
--ios-slices <list> |
simulator,device |
The iOS slices to build: simulator, device or both, separated by commas. |
--android-abis <list> |
arm64-v8a |
The Android ABIs to build, separated by commas. |
--ios-no-export-list |
Off | Exports every symbol of the iOS binary. For diagnostics only. |
--project <dir> |
Current directory | The React project. |
-h, --help |
Prints the help text. |
Exit codes
Section titled “Exit codes”0 when the artifacts and the manifest are written. 1 when the command is refused or fails; the reason is printed.
bun run nuib packagebun run nuib package --platform ios --ios-slices simulator --variant devnuib publish
Section titled “nuib publish”Synopsis:
nuib publish [--registry <dir>] [--force] [--out <dir>] [--project <dir>]Publishes what nuib package wrote as one version in a local registry directory. Nothing leaves the machine: the command uses no network and no credentials. Run nuib package first.
Before it writes anything, the command refuses:
- a project with a recorded link (
<project>/.nuib/links.json); clear it withnuib unlink; - a missing registry: neither
--registrynorbrownfield.registry; - an output with no
manifest.json; - a packaged output that is not the current sources’: another name, another version or another contract;
- the dev variant; only the release variant is published;
- packaged files that differ from the SHA-256 hashes the manifest records;
- a version that is already published, unless
--force; - a version that fails
nuib checkagainst the last published version, which is the highest published version lower than the one being published. The check report is printed either way.
| Option | Default | Meaning |
|---|---|---|
--registry <dir> |
brownfield.registry, relative to the project |
The registry directory. Created when missing. |
--force |
Off | Replaces a version that is already published. The old files are replaced only once the new ones are complete. |
--out <dir> |
<project>/.nuib/out |
What nuib package wrote. |
--project <dir> |
Current directory | The React project. |
-h, --help |
Prints the help text. |
What a published version contains
Section titled “What a published version contains”The registry layout:
<registry>/ registry.json index of artifacts and versions maven/<group path>/<artifact>/<version>/ the AAR and its POM maven/<group path>/<artifact>/maven-metadata.xml <name>/<version>/ manifest.json the packaged manifest size-report.json, size-report.txt sizes and the difference from the previous version swiftpm/Package.swift a binary target over the zip beside it swiftpm/<name>.xcframework.zip swiftpm/checksum.txt SHA-256 of the zip symbols/ dSYMs, unstripped libraries, source mapsExit codes
Section titled “Exit codes”0 when the version is published. 1 when it is refused or fails; the reason is printed.
bun run nuib packagebun run nuib publish --registry ../registrynuib link
Section titled “nuib link”Synopsis:
nuib link [--dev] [--platform ios|android] [--ios-slices <list>] [--project <dir>] <native app>Advanced. nuib dev ios and nuib dev android cover the normal loop. Use nuib link to put an unpublished build of the React project into a native app, for example a release build.
The command runs nuib package, then makes the native app use that local artifact instead of its published dependency. The native project files are not edited. The app must already depend on the artifact; otherwise the command refuses.
| Platform | What the link is | How to build |
|---|---|---|
| iOS | The local SwiftPM package, added to the Xcode project’s own workspace (<App>.xcodeproj/project.xcworkspace). It overrides the dependency with the artifact’s name. |
On the command line, build with -workspace <App>.xcodeproj/project.xcworkspace; -project ignores the link. |
| Android | One Gradle init script, nuib-link-<hash>.gradle, in init.d of the Gradle user home (GRADLE_USER_HOME, else ~/.gradle). It acts only on the app’s build and resolves the artifact from the local Maven repository. |
Build or sync as usual. Packaged for arm64-v8a. |
<native app> is the app’s directory. iOS: the directory that holds the one .xcodeproj, up to two levels below, or the .xcodeproj itself. Android: the directory with settings.gradle or settings.gradle.kts, or its parent. The command takes exactly one native app.
| Option | Default | Meaning |
|---|---|---|
--dev |
Off (release) | Links the dev variant. It tries the dev server at http://localhost:<dev.port> at launch; start it with nuib dev. |
--platform ios|android |
The one platform the configuration has; ios when it has both |
The platform to link. |
--ios-slices <list> |
simulator,device |
The iOS slices to package, as in nuib package. |
--project <dir> |
Current directory | The React project. |
-h, --help |
Prints the help text. |
Exit codes
Section titled “Exit codes”0 when the app is linked. 1 when the command is refused or fails; the reason is printed.
bun run nuib link ../ios-appbun run nuib link --dev --platform android ../android-appnuib unlink
Section titled “nuib unlink”Synopsis:
nuib unlink [--project <dir>] <native app>Advanced. Removes exactly what nuib link added for that native app and deletes its record from <project>/.nuib/links.json. The app resolves its published dependency again. <native app> is the path you gave to nuib link.
| Option | Default | Meaning |
|---|---|---|
--project <dir> |
Current directory | The React project. |
-h, --help |
Prints the help text. |
Exit codes
Section titled “Exit codes”0 when the link is removed. 1 when no link is recorded for that app, or on a usage error. --dev is not accepted.
bun run nuib unlink ../ios-appMore of the CLI reference
Section titled “More of the CLI reference”- CLI: dev and check: commands for development and checks.
- CLI: configuration and manifest: configuration and manifest.