Command Line Interface (CLI)
Run, build, package, and manage your project with the MōBrowser CLI.
Commands
To see the list of available commands, run the following command in your project directory:
npm run mobrowser -- --help
This will display the help message with the list of available commands and their descriptions.
The MōBrowser command line tool
Usage:
mobrowser [flags]
mobrowser [command]
Available Commands:
add Add a feature to an existing project
build Build and pack application for production
dev Build and run application in development mode
gen Generate TypeScript and C++ code from Protobuf definitions
help Help about any command
icon Generate the application icon
pack Create the installer from already-built application
sbom Generate the application CycloneDX SBOM
Flags:
-h, --help help for mobrowser
--version print version
Use "mobrowser [command] --help" for more information about a command.
add
npm run mobrowser add
This command adds a feature to an existing project. Features are normally chosen when the project is generated, but requirements change.
Run it without a feature name to pick one interactively.
Add a feature to an existing project.
Usage:
mobrowser add [flags]
mobrowser add [command]
Available Commands:
github-actions Add the GitHub Actions release workflow
native Add a native C++ module
Flags:
-h, --help help for add
--verbose enable verbose mode, providing additional details during execution
Use "mobrowser add [command] --help" for more information about a command.
build
npm run mobrowser build
This command builds the application and packages it into a native executable for the current platform.
Build and pack application for production
Usage:
mobrowser build [flags]
Flags:
-h, --help help for build
--verbose enable verbose mode, providing additional details during execution
dev
npm run mobrowser dev
This command will build and run the application in development mode. In the development mode, the application frontend is running on the localhost server with Hot Module Replacement (HMR) using Vite.
It allows you to modify the frontend code and see the changes immediately in the running application without rebuilding the application.
Build and run application in development mode
Usage:
mobrowser dev [flags]
Flags:
-h, --help help for dev
--inspect int the port for debugging the main process
--remote-debugging-port int the port for debugging the renderer process
--verbose enable verbose mode, providing additional details during execution
gen
npm run mobrowser gen
This command will generate TypeScript and C++ code from Protobuf definitions. The command makes sense only if you have a native C++ module in your project.
Generate TypeScript and C++ code from Protobuf definitions
Usage:
mobrowser gen [flags]
Flags:
-h, --help help for gen
--verbose enable verbose mode, providing additional details during execution
icon
npm run mobrowser icon -- --source <path-to-directory> --out app.ico
This command will generate the application icon.
Generate the application icon
Usage:
mobrowser icon [flags]
Flags:
-h, --help help for icon
--output string the path to the output icon file (default "assets/app.ico")
--sources string the directory with the source PNG files to generate the icon from
pack
npm run mobrowser pack
This command creates an installer and update packages from an application that has already been built. It keeps packages from earlier versions in the output directory so they can be used to generate delta updates.
Create the installer from already-built application
Usage:
mobrowser pack [flags]
Flags:
--force replace the artifacts this pack run produces if they already exist
-h, --help help for pack
--releases string absolute path to a directory with previous releases
--verbose enable verbose mode
The generated project’s pack script provides the shorter form used in packaging workflows:
npm run pack
Use npm run pack -- --force to recreate the current version’s artifacts. Packages for other versions are preserved.
sbom
npm run sbom
This command generates a target-specific CycloneDX 1.7 SBOM for the application and its runtime components. It writes the JSON document and a SHA-256 checksum to build/dist/<target>/sbom/.
Generate the application CycloneDX SBOM
Usage:
mobrowser sbom [flags]
Flags:
-h, --help help for sbom
--verbose enable verbose mode
Projects created with an earlier MōBrowser version might not have the sbom script. In those projects, run:
npm run mobrowser sbom