Skip to content
Preview: packages are not published yet.

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.

  1. 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.0 gives a project on 0.3.0. @latest gives whatever is newest, which may not be supported.

    Terminal window
    bunx create-nitro-ui@0.3.0 MyApp
    cd MyApp
  2. 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.json lists 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.0

    The patch step needs five Nitro UI packages at exactly this version: nitro-ui-renderer, nitro-ui-navigation, nitro-ui-runtime, nitro-ui-dev and nitro-ui-bundler. nitro-ui-cli depends on all five and pins each to its own version.

  3. Add the two Nitro UI Brownfield packages.

    nitro-ui-brownfield goes in dependencies. It gives you registerSurface and useSurface. nitro-ui-brownfield-cli goes in devDependencies. It provides the nuib command. 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>"
    }
    }
  4. Install the dependencies.

    Terminal window
    bun install
  5. Check that nuib runs.

    nuib is not on your PATH. Run it through Bun, inside the project.

    Terminal window
    bun run nuib --help

    It prints the list of commands. If it answers Script not found "nuib", you are outside a project that lists nitro-ui-brownfield-cli in devDependencies.

  6. 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 install

    It checks the Nitro UI versions first and writes nothing if one is wrong. Then it copies the patch files into the project, adds one patchedDependencies entry per patched package to package.json, runs bun install and checks the patched files. To see what it would do without changing anything, add --dry-run.

  7. Rebuild the native caches.

    After install, the command prints a line that starts with Next: 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. --clean removes the stale ones.

    Terminal window
    bun run nitro-ui prepare --clean
  8. Commit the result.

    Commit package.json, bun.lock and the patch directory the command created. A teammate’s plain bun install then applies the same patches.

Two read-only commands report the state.

Terminal window
bun run nuib patches verify
bun run nuib patches status

verify 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.

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.

Package.swift
.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.

settings.gradle.kts
maven { url = uri("«NOT PUBLISHED YET: Maven repository URL»") }
build.gradle.kts
implementation("com.gamitolab:«NOT PUBLISHED YET: artifactId»:«NOT PUBLISHED YET: first version»")

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.

  • 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.