Skip to content

UI5 CLI

Requirements

  • Node.js Version v20.11.0, v22.0.0 or higher
  • npm Version v8.0.0 or higher

Installation

Install the CLI using the npm package manager:

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

OptionDescriptionDetails
-h, --helpShow help[boolean]
-v, --versionShow version number[boolean]
-c, --configPath to project configuration file in YAML format[string]
--dependency-definitionPath to a YAML file containing the project's dependency tree. This option will disable resolution of node package dependencies.[string]
--workspace-configPath to workspace configuration file in YAML format[string]
-w, --workspaceName of the workspace configuration to use[string] [default: "default"]
--loglevel, --log-levelSet the logging level[string] [choices: "silent", "error", "warn", "info", "perf", "verbose", "silly"] [default: "info"]
--verboseEnable verbose logging.[boolean] [default: false]
--perfEnable performance measurements and related logging.[boolean] [default: false]
--silentDisable all log output.[boolean] [default: false]

Examples

Execute command using a static dependency tree instead of resolving node package dependencies

ui5 <command> --dependency-definition /path/to/projectDependencies.yaml

Execute command using a project configuration from custom path

ui5 <command> --config /path/to/ui5.yaml

Execute command using the 'dolphin' workspace of a ui5-workspace.yaml

ui5 <command> --workspace dolphin

Execute command with the maximum log output

ui5 <command> --log-level silly

Commands

ui5 add

Description

Add SAPUI5/OpenUI5 framework libraries to the project configuration.

Usage

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

Options

OptionDescriptionDetails
-D, --development, --devAdd as development dependency[boolean] [default: false]
-O, --optionalAdd as optional dependency[boolean] [default: false]

Positionals

PositionalDescriptionDetails
framework-librariesFramework 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

CommandDescription
ui5 build jsdocBuild JSDoc resources
ui5 build preload(default) Build project and create preload bundles
ui5 build self-containedBuild project and create self-contained bundle. Recommended to be used in conjunction with --include-all-dependencies

Options

OptionDescriptionDetails
-a, --include-all-dependencies, --allInclude all dependencies in the build result. This is equivalent to '--include-dependency "*"'[boolean] [default: false]
--include-dependencyA list of dependencies to be included in the build result. You can use the asterisk '*' as an alias for including all dependencies in the build result. The listed dependencies cannot be overruled by dependencies defined in 'exclude-dependency'. The provided name must match with the dependency name shown in 'ui5 ls --flat'[array]
--include-dependency-regexpA list of regular expressions defining dependencies to be included in the build result. This list is prioritized like 'include-dependency'.[array]
--include-dependency-treeA list of dependencies to be included in the build result. 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-dependencyA list of dependencies to be excluded from the build result. The listed dependencies can be overruled by dependencies defined in 'include-dependency'. The provided name must match with the dependency name shown in 'ui5 ls --flat'[array]
--exclude-dependency-regexpA list of regular expressions defining dependencies to be excluded from the build result. This list is prioritized like 'exclude-dependency'.[array]
--exclude-dependency-treeA list of dependencies to be excluded from the build result. Transitive dependencies are implicitly included and do not need to be part of this list.[array]
--destPath of build destination[string] [default: "./dist"]
--clean-destIf present, clean the destination directory before building[boolean] [default: false]
--create-build-manifestStore build metadata in a '.ui5' directory in the build destination, allowing reuse of the build result in other builds[boolean] [default: false]
--include-taskA list of tasks to be added to the default execution set. This option takes precedence over any excludes.[array]
--exclude-taskA list of tasks to be excluded from the default task execution set[array]
--framework-versionOverrides the framework version defined by the project. Takes the same value as the version part of "ui5 use"[string]
--cache-modeCache mode to use when consuming SNAPSHOT versions of framework dependencies. The 'Default' behavior is to invalidate the cache after 9 hours. 'Force' uses the cache only and does not create any requests. 'Off' invalidates any existing cache and updates from the repository[string] [choices: "Default", "Force", "Off"] [default: "Default"]
--experimental-css-variablesGenerate CSS variables (css-variables.css, css-variables.source.less) and skeleton (library-skeleton(-RTL).css) for all themes[boolean] [default: false]
--output-styleProcesses build results into a specific directory structure.
- Flat: Omits the project namespace and the "resources" directory.
- Namespace: Respects the project namespace and the "resources" directory, maintaining the original structure.
- Default: The default directory structure for every project type. For applications, this is identical to "Flat", and for libraries, it is "Namespace". Other types have a more distinct default output style.[string] [choices: "Default", "Flat", "Namespace"] [default: "Default"]

Examples

Preload build for project without dependencies

ui5 build

Self-contained build for project

ui5 build self-contained

Build project but only apply the minify- and generateComponentPreload tasks

ui5 build --exclude-task=* --include-task=minify generateComponentPreload

Build project by applying all default tasks including the minify task and excluding the generateComponentPreload task

ui5 build --include-task=minify --exclude-task=generateComponentPreload

Preload build with experimental CSS variables artifacts

ui5 build --experimental-css-variables

ui5 config

Description

Get and set UI5 Tooling configuration options

Usage

ui5 config

Child Commands

CommandDescription
ui5 config set <opt​ion> [value]Set the value for a given configuration option. Clear an existing configuration by omitting the value
ui5 config get <opt​ion>Get the value for a given configuration option
ui5 config listDisplay the current configuration

Examples

Set a value for the ui5DataDir configuration

ui5 config set ui5DataDir /path/to/.ui5

Unset the current value of the ui5DataDir configuration

ui5 config set ui5DataDir

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

PositionalDescriptionDetails
framework-librariesFramework 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

OptionDescriptionDetails
-p, --portPort to bind on (default for HTTP: 8080, HTTP/2: 8443)[number]
-o, --openOpen web server root directory in default browser. Optionally, supplied relative path will be appended to the root URL[string]
--h2Shortcut for enabling the HTTP/2 protocol for the web server[boolean] [default: false]
--simple-indexUse a simplified view for the server directory listing[boolean] [default: false]
--accept-remote-connectionsAccept remote connections. By default the server only accepts connections from localhost[boolean] [default: false]
--keyPath to the private key[string] [default: "/home/runner/.ui5/server/server.key"]
--certPath to the certificate[string] [default: "/home/runner/.ui5/server/server.crt"]
--sap-csp-policiesAlways send content security policies 'sap-target-level-1' and 'sap-target-level-3' in report-only mode[boolean] [default: false]
--serve-csp-reportsCollects and serves CSP reports upon request to '/.ui5/csp/csp-reports.json'[boolean] [default: false]
--framework-versionOverrides the framework version defined by the project. Takes the same value as the version part of "ui5 use"[string]
--cache-modeCache mode to use when consuming SNAPSHOT versions of framework dependencies. The 'Default' behavior is to invalidate the cache after 9 hours. 'Force' uses the cache only and does not create any requests. 'Off' invalidates any existing cache and updates from the repository[string] [choices: "Default", "Force", "Off"] [default: "Default"]

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 dependency definition file

ui5 serve --dependency-definition /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

OptionDescriptionDetails
--flatOutput a flat list of all dependencies instead of a tree hierarchy[boolean] [default: false]
--levelLimit the number of levels shown in the tree hierarchy[number]
--framework-versionOverrides the framework version defined by the project. Takes the same value as the version part of "ui5 use"[string]
--cache-modeCache mode to use when consuming SNAPSHOT versions of framework dependencies. The 'Default' behavior is to invalidate the cache after 9 hours. 'Force' uses the cache only and does not create any requests. 'Off' invalidates any existing cache and updates from the repository[string] [choices: "Default", "Force", "Off"] [default: "Default"]

ui5 use

Description

Initialize or update the project's framework configuration.

Usage

ui5 use <framework-info>

Positionals

PositionalDescriptionDetails
framework-infoFramework name, version or both (name@version).
Name can be "SAPUI5" or "OpenUI5" (case-insensitive).
Version can be "latest" (default), a version or range according to the Semantic Versioning specification (https://semver.org/), or a tag available in the npm registry.
For SAP-internal usage the version can also be "latest-snapshot", a version or range ending with -SNAPSHOT, or a simplified range such as "1-SNAPSHOT", "1.x-SNAPSHOT" or "1.108-SNAPSHOT".
[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 DirectoryCommandGlobal UI5 CLILocal UI5 CLI
/ui5 --versionenabled
/my-applicationui5 --versionenabled
/my-applicationui5 serveenabled
/my-applicationUI5_CLI_NO_LOCAL=X ui5 serveenabled
/my-applicationnpm startenabled
/my-applicationUI5_CLI_NO_LOCAL=X npm startenabled