Skip to content

UI5 CLI

Requirements

Installation

Install the CLI using the npm package manager:

npm install --global @ui5/cli

# Verify installation
ui5 --help

Usage/Syntax

ui5 <command> [options]

The CLI automatically checks for updates using update-notifier. While this is skipped in CI environments, you might also opt-out manually by following the steps described here.

Common options

These options you can use with each command.

Option Description Details
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
--config Path to configuration file [string]
--translator, --t8r Translator to use. Including optional colon separated translator parameters. [string] [default: "npm"]
--verbose Enable verbose logging. [boolean]
--loglevel, --log-level Set the logging level (error|warn|info|verbose|silly). [string] [default: "info"]

Examples

Execute command using a "static" translator with translator parameters

ui5 <command> --translator static:/path/to/projectDependencies.yaml
Execute command using a project configuration from custom path
ui5 <command> --config /path/to/ui5.yaml

Commands

ui5 add

Description

Add SAPUI5/OpenUI5 framework libraries to the project configuration.

Usage

ui5 add [--development] [--optional] <framework-libraries..>

Options

Option Description Details
-D, --development, --dev Add as development dependency [boolean] [default: false]
-O, --optional Add as optional dependency [boolean] [default: false]

Positionals

Positional Description Details
framework-libraries Framework library names [array] [required] [default: []]

Examples

Add the framework libraries sap.ui.core and sap.m as dependencies

ui5 add sap.ui.core sap.m
Add the framework library sap.ui.support as development dependency
ui5 add -D sap.ui.support
Add the framework library themelib_sap_fiori_3 as optional dependency
ui5 add --optional themelib_sap_fiori_3

ui5 build

Description

Build project in current directory

Usage

ui5 build

Child Commands

Command Description
ui5 build dev Dev build: Skips non-essential and time-intensive tasks during build
ui5 build jsdoc Build JSDoc resources
ui5 build preload (default) Build project and create preload bundles
ui5 build self-contained Build project and create self-contained bundle. Recommended to be used in conjunction with --all

Options

Option Description Details
-a, --all Include all project dependencies into build process [boolean] [default: false]
--include-dependency A list of dependencies to be included into the build process. You can use the asterisk '*' as an alias for including all dependencies into the build process. The listed dependencies cannot be overruled by dependencies defined in 'exclude-dependency'. [array]
--include-dependency-regexp A list of regular expressions defining dependencies to be included into the build process. This list is prioritized like 'include-dependency'. [array]
--include-dependency-tree A list of dependencies to be included into the build process. Transitive dependencies are implicitly included and do not need to be part of this list. These dependencies overrule the selection of 'exclude-dependency-tree' but can be overruled by 'exclude-dependency'. [array]
--exclude-dependency A list of dependencies to be excluded from the build process. The listed dependencies can be overruled by dependencies defined in 'include-dependency'. [array]
--exclude-dependency-regexp A list of regular expressions defining dependencies to be excluded from the build process. This list is prioritized like 'exclude-dependency'. [array]
--exclude-dependency-tree A list of dependencies to be excluded from the build process. Transitive dependencies are implicitly included and do not need to be part of this list. [array]
--dest Path of build destination [string] [default: "./dist"]
--clean-dest If present, clean the destination directory before building [boolean] [default: false]
--dev-exclude-project A list of specific projects to be excluded from dev mode (dev mode must be active for this to be effective) [array]
--include-task A list of specific tasks to be included to the default/dev set [array]
--exclude-task A list of specific tasks to be excluded from default/dev set [array]
--framework-version Overrides the framework version defined by the project [string]

Examples

Preload build for project without dependencies

ui5 build
Self-contained build for project including dependencies
ui5 build self-contained --all
Build project and dependencies but only apply the createDebugFiles- and generateAppPreload tasks
ui5 build --all --exclude-task=* --include-task=createDebugFiles generateAppPreload
Build project and dependencies by applying all default tasks including the createDebugFiles task and excluding the generateAppPreload task
ui5 build --all --include-task=createDebugFiles --exclude-task=generateAppPreload
Build project and dependencies in dev mode, except "sap.ui.core" and "sap.m" (useful in combination with --include-task)
ui5 build dev --all --dev-exclude-project=sap.ui.core sap.m
Build project and dependencies in dev mode. Only a set of essential tasks is executed.
ui5 build dev

ui5 init

Description

Initialize the UI5 Tooling configuration for an application or library project.

Usage

ui5 init

ui5 remove

Description

Remove SAPUI5/OpenUI5 framework libraries from the project configuration.

Usage

ui5 remove <framework-libraries..>

Positionals

Positional Description Details
framework-libraries Framework library names [array] [required] [default: []]

Examples

Remove the framework libraries sap.ui.core and sap.m as dependencies

ui5 remove sap.ui.core sap.m

ui5 serve

Description

Start a web server for the current project

Usage

ui5 serve

Options

Option Description Details
-p, --port Port to bind on (default for HTTP: 8080, HTTP/2: 8443) [number]
-o, --open Open web server root directory in default browser. Optionally, supplied relative path will be appended to the root URL [string]
--h2 Shortcut for enabling the HTTP/2 protocol for the web server [boolean] [default: false]
--simple-index Use a simplified view for the server directory listing [boolean] [default: false]
--accept-remote-connections Accept remote connections. By default the server only accepts connections from localhost [boolean] [default: false]
--key Path to the private key [string] [default: "/home/runner/.ui5/server/server.key"]
--cert Path to the certificate [string] [default: "/home/runner/.ui5/server/server.crt"]
--sap-csp-policies Always send content security policies 'sap-target-level-1' and 'sap-target-level-2' in report-only mode [boolean] [default: false]
--serve-csp-reports Collects and serves CSP reports upon request to '/.ui5/csp/csp-reports.json' [boolean] [default: false]
--framework-version Overrides the framework version defined by the project [string]

Examples

Start a web server for the current project

ui5 serve
Enable the HTTP/2 protocol for the web server (requires SSL certificate)
ui5 serve --h2
Use the project configuration from a custom path
ui5 serve --config /path/to/ui5.yaml
Use a "static" translator with translator parameters.
ui5 serve --translator static:/path/to/projectDependencies.yaml
Listen to port 1337 and launch default browser with http://localhost:1337/test/QUnit.html
ui5 serve --port 1337 --open tests/QUnit.html

ui5 tree

Description

Outputs the dependency tree of the current project to stdout. It takes all relevant parameters of ui5 build into account.

Usage

ui5 tree

Options

Option Description Details
--full Include more information (currently the project configuration) [boolean] [default: false]
--json Output tree as formatted JSON string [boolean] [default: false]
--dedupe Remove duplicate projects from project tree [boolean] [default: false]
--framework-version Overrides the framework version defined by the project. Only supported in combination with --full [string]

Examples

Pipes the dependency tree into a new file "tree.txt"

ui5 tree > tree.txt
Pipes the dependency tree into a new file "tree.json"
ui5 tree --json > tree.json

ui5 use

Description

Initialize or update the project's framework configuration.

Usage

ui5 use <framework-info>

Positionals

Positional Description Details
framework-info Framework name, version or both (name@version).
Name can be "SAPUI5" or "OpenUI5" (case-insensitive).
Version can be "latest" (default), "1.xx" or "1.xx.x".
[string] [required]

Examples

Use SAPUI5 in the latest available version

ui5 use sapui5@latest
Use OpenUI5 in the latest available 1.76 patch version
ui5 use openui5@1.76
Use the latest available version of the configured framework
ui5 use latest
Use OpenUI5 in the latest available version
ui5 use openui5

ui5 versions

Description

Shows the versions of all UI5 Tooling modules

Usage

ui5 versions

Local vs. Global Installation

In general, we recommend a global installation of the UI5 CLI (npm install --global @ui5/cli).

However, it makes sense to add the UI5 CLI as a devDependency (npm install --save-dev @ui5/cli) to a project's package.json. This ensures that every developer working on the project uses the same version of the UI5 CLI and your continuous integration environments also uses this version.

In case you have both, a local installation in one of your projects as well as a global installation, the UI5 CLI will always try to invoke the local installation. This is in part because npm scripts defined in your package.json will also always invoke the local installation.

This behavior can be disabled by setting the environment variable UI5_CLI_NO_LOCAL.

Example
You have a project located in the directory /my-application.

You have installed the UI5 CLI globally. In addition, the project's package.json defines a devDependency to @ui5/cli and a start script "ui5 serve". This means there are at least two installations of @ui5/cli on your system. Their versions might not match.

This table illustrates which of the two installations is used in different scenarios. Note how the UI5 CLI always tries to prefer the version installed in the project.

Current Working Directory Command Global UI5 CLI Local UI5 CLI
/  ui5 --version enabled
/my-application  ui5 --version enabled
/my-application  ui5 serve enabled
/my-application  UI5_CLI_NO_LOCAL=X ui5 serve enabled
/my-application  npm start enabled
/my-application  UI5_CLI_NO_LOCAL=X npm start enabled