Skip to main content

Napacitor CLI - nap init

Initialize your app, writing a napacitor.config.json file to the project root. The command is non-interactive: missing arguments fall back to defaults.

npx nap init [appId] [appName] [--web-dir <dir>]

Inputs:

  • appId (optional): the app's reverse-domain identifier (e.g. com.example.app). Defaults to com.napacitor.app. Written to the host's <ApplicationId>.
  • appName (optional): the app's display name. Defaults to the folder name. Written to the host's <ApplicationTitle>.

Options:

  • --web-dir <dir>: directory of the web app's build output, relative to the app root (default: dist).

Example:

npx nap init com.example.app "My App" --web-dir dist

This creates:

{
"appId": "com.example.app",
"appName": "My App",
"webDir": "dist",
"maui": {
"hostDir": "maui"
}
}

If napacitor.config.json already exists, the command fails. Delete the file first if you need to re-initialize.