Install
This page is for the React team. It takes a Nitro UI project to the point where bun run nuib works and the patch step is applied. The native team does not install anything from this page: it receives a packaged artifact (see the native quickstart).
Check Requirements first. Nitro UI Brownfield supports one Nitro UI version, 0.3.0, and it needs Bun.
-
Start from a Nitro UI project on the supported version.
For a new project, name the version when you run Nitro UI’s project creator. The creator writes every Nitro UI dependency at its own version, so
create-nitro-ui@0.3.0gives a project on 0.3.0.@latestgives whatever is newest, which may not be supported.Terminal window bunx create-nitro-ui@0.3.0 MyAppcd MyApp -
Pin Nitro UI exactly.
For an existing project, pin the Nitro UI packages with no range. A package manager can otherwise install a newer release, and the patch step refuses it (see Patches). Check that
package.jsonlists the versions without^or~.Terminal window bun add --exact nitro-ui-cli@0.3.0 nitro-ui-renderer@0.3.0 nitro-ui-navigation@0.3.0The patch step needs five Nitro UI packages at exactly this version:
nitro-ui-renderer,nitro-ui-navigation,nitro-ui-runtime,nitro-ui-devandnitro-ui-bundler.nitro-ui-clidepends on all five and pins each to its own version. -
Add the two Nitro UI Brownfield packages.
nitro-ui-brownfieldgoes independencies. It gives youregisterSurfaceanduseSurface.nitro-ui-brownfield-cligoes indevDependencies. It provides thenuibcommand. Both are npm packages.Terminal window bun add nitro-ui-brownfield@«NOT PUBLISHED YET: first version»bun add --dev nitro-ui-brownfield-cli@«NOT PUBLISHED YET: first version»package.json {"dependencies": {"nitro-ui-brownfield": "<version>"},"devDependencies": {"nitro-ui-brownfield-cli": "<version>"}} -
Install the dependencies.
Terminal window bun install -
Check that
nuibruns.nuibis not on yourPATH. Run it through Bun, inside the project.Terminal window bun run nuib --helpIt prints the list of commands. If it answers
Script not found "nuib", you are outside a project that listsnitro-ui-brownfield-cliindevDependencies. -
Apply the patches.
Nitro UI 0.3.0 does not have everything this library needs, so the library applies a small set of patches to some Nitro UI packages inside your
node_modules. Patches says what they change and why. Run the step from the project root.Terminal window bun run nuib patches installIt checks the Nitro UI versions first and writes nothing if one is wrong. Then it copies the patch files into the project, adds one
patchedDependenciesentry per patched package topackage.json, runsbun installand checks the patched files. To see what it would do without changing anything, add--dry-run. -
Rebuild the native caches.
After
install, the command prints a line that starts withNext: run nitro-ui prepare --clean. Run it. Nitro UI copies one file into.nitro/native/instead of linking it, and it keeps native build caches.--cleanremoves the stale ones.Terminal window bun run nitro-ui prepare --clean -
Commit the result.
Commit
package.json,bun.lockand the patch directory the command created. A teammate’s plainbun installthen applies the same patches.
Check that the patches are applied
Section titled “Check that the patches are applied”Two read-only commands report the state.
bun run nuib patches verifybun run nuib patches statusverify prints one row for each patched package, then ends with the line the Nitro UI 0.3.0 patches are installed and verified. It exits with 0 when every patched file matches, and with another code when something does not: 3 means not installed, 4 partially applied, 5 a wrong Nitro UI version, 6 that package.json, the patch directory and the state file disagree, and 7 that nitro-ui prepare --clean is needed. status prints the same report and exits with 0, unless the CLI’s own patch files cannot be read, so it is the one to run in a script that must not fail.
Every message tells you what to do next. The Patches page lists them.
The library’s native artifacts
Section titled “The library’s native artifacts”A packaged artifact from nuib package already contains the library’s native code, so the native team needs nothing from this section. These coordinates are for a team that integrates the library from a binary instead of from source.
iOS. The XCFramework is a release asset of the repository. A Swift package consumes it as a binary target with a URL and a checksum.
.binaryTarget( name: "NitroBrownfield", url: "«NOT PUBLISHED YET: release URL»", checksum: "«NOT PUBLISHED YET: checksum»")Android. The AAR is served from a static Maven repository hosted on GitHub. The Maven group is com.gamitolab.
maven { url = uri("«NOT PUBLISHED YET: Maven repository URL»") }implementation("com.gamitolab:«NOT PUBLISHED YET: artifactId»:«NOT PUBLISHED YET: first version»")License
Section titled “License”The patch files contain lines of Nitro UI source as context, so they are distributed under the Nitro UI license. The NOTICE file of the repository says what derives from Nitro UI and reproduces the license that requires it. The link works once the repository is public.
What next
Section titled “What next”- Your first surface configures the project and registers a component.
- Run and develop shows it running in the viewer.
- To remove the patches, run
bun run nuib patches undo. Patches explains what it removes.