CLI

Custom platforms

Declare platforms and templates of your own, such as an embedded display, in the root package.json.

The built-in platforms cover web, mobile and desktop. Anything else your project builds more than once, such as a wall display, a kiosk or a point-of-sale terminal, can be a platform too. Then platform add copies it with its scripts, and platform init runs its setup steps, the same way as for the built-ins.

Declare it

Platforms and templates go in the frigear field of the root package.json:

package.json
{
  "frigear": {
    "templates": {
      "kiosk": "gh:acme/templates/kiosk#main"
    },
    "platforms": {
      "display": {
        "template": "kiosk",
        "description": "A wall display",
        "scripts": {
          "dev:<name>": "pnpm --filter <dir> dev",
          "<name>:flash": "pnpm --filter <dir> run flash"
        },
        "nextSteps": ["  plug in the display, then: pnpm <name>:flash"],
        "targets": {
          "flash": { "description": "Write the image to the device", "script": "flash", "bin": ["kiosk-cli", "flash"] }
        }
      }
    }
  }
}

Then:

pnpx @frigear-nu/cli platform add display lobby   # apps/lobby, with dev:lobby and lobby:flash
pnpx @frigear-nu/cli platform add display bar     # apps/bar, with dev:bar and bar:flash
pnpx @frigear-nu/cli platform init flash --app bar

Fields

frigear.templates maps a template name to a giget source. Use the name in a platform's template or in --template. A name of a built-in template (web, mobile, ...) replaces it.

Each entry of frigear.platforms:

FieldPurpose
templateA template name or a giget source. Without it, platform add needs --template.
descriptionShown by platform list.
defaultAppNameThe app's folder when no name is given; default: the platform's name.
scriptsRoot scripts added for each app. In keys and values <name> is the app's folder name and <dir> its path from the root (./apps/lobby).
nextStepsLines printed after the app is added; <name>, <dir> and <package> are replaced.
targetsWhat platform init <target> runs in an app of this platform: see below.

A platform with a built-in's name (mobile, desktop, ...) is merged over it: set only the fields you want to change, such as a template of your own, and keep the built-in's scripts and targets.

Each target:

FieldPurpose
scriptA script of the app's package.json to run.
binA binary of the app's dependencies and its first arguments, run when the app has no script of that name.
argsArguments added after the script or binary. Flags after -- on the command line come after these.
aliasesOther names for the target, such as watchos for apple-watch.
descriptionShown by platform list.

Without declaring it

platform add <name> --template <template> works for a platform that is not declared: it copies the template, renames the package and records the platform, but adds no scripts and knows no targets. Declare the platform once you add a second app of it.

In code

definePlatform takes the same fields, and nextSteps and detect may be functions there. See From code.

Next steps

  • Platforms – the built-in platforms and how platform add and init behave.
  • From code – add apps of a platform from a script.
Copyright © 2026