UI5 CLI
repository·main·Indexed 19 days ago
https://github.com/ui5/cliA modular toolchain for developing UI5-based applications, providing essential features such as development servers, project building, and dependency management. The ecosystem includes core packages such as @ui5/cli, @ui5/builder, @ui5/fs, @ui5/logger, @ui5/project, and @ui5/server.
What's inside UI5 CLI
- @ui5/builder provides modules specifically designed for building UI5 projects. It is a core component of the UI5 CLI ecosystem.
Overview of @ui5/fs
main@ui5/fs is a UI5-specific file system abstraction. It is a core component of the UI5 CLI ecosystem, providing specialized file system operations tailored for UI5 development workflows.Overview of @ui5/cli
mainThe@ui5/cliis the Command Line Interface for UI5. It provides tools for developers to interact with UI5 projects, including building, serving, and managing resources. Detailed documentation for all commands and configurations is hosted externally.Overview of @ui5/project
main@ui5/project is a module used for building a project's dependency tree. It includes UI5-specific configuration logic and is a core component of the UI5 CLI.Overview of @ui5/logger
main@ui5/logger provides logging functionality designed for use across all UI5 CLI modules and extensions. It supports configurable log levels and includes built-in support for rendering progress bars.Overview of UI5 CLI
mainUI5 CLI is an open and modular toolchain designed for developing applications based on the UI5 framework. It provides a suite of tools for project management, development servers, and building UI5 projects.
Note on Versions: This repository currently contains the development state for the upcoming v5 release. For stable production use, it is highly recommended to use the latest stable version (v4).
Overview of @ui5/server
main@ui5/server provides modules for running a UI5 development server. It is a component of the larger UI5 CLI ecosystem.Understand the docdash documentation template
mainThe files in this directory are based on
docdash 2.0.2, a documentation template for JSDoc. However, SAP has applied specific modifications to suit the UI5 CLI documentation workflow:- Markdown Output: Unlike the original version which outputs HTML, this version is modified to output Markdown.
- Streamlined Functionality: The
publish.jsutility has been stripped of navbar functionality and static files functionality to reduce complexity. - Link Adjustments: JavaScript links are configured to point to GitHub, and internal linking mechanisms have been modified.
What are Processors in UI5 Builder?
mainProcessors contain the actual logic for build steps. While tasks manage the workflow and resource collection, processors perform the specific modifications to the resources or create new resources from existing ones.
Processors are designed to be generic. For example, a string replacer processor can be reused across different tasks to handle code replacement, versioning, dates, or copyright information by passing different configurations.
To find all available processors, consult the API reference and search for
@ui5/builder/processors/.Use Dependency Injection for UI5 CLI Modules
mainTo ensure compatibility across UI5 CLI versions, extensions should avoid direct dependencies on
@ui5/fsor@ui5/logger. Instead, use the providedlogandtaskUtil.resourceFactoryobjects injected into the extension function. This allows the CLI to provide version-appropriate implementations of these APIs.- Logging: Use the provided
logobject. It automatically includes the task or middleware name. You can create sub-loggers usinglog.createSubLogger("suffix"). - Resource Creation: Use
taskUtil.resourceFactory.createResource({...})to create@ui5/fsResourceentities.
module.exports = async function({workspace, dependencies, log, taskUtil, options}) { const {createResource} = taskUtil.resourceFactory; // ... inside a loop or task logic log.info(`Processing file...`); const newResource = createResource({ path: "new/path/file.html", string: "<html>...</html>" }); await workspace.write(newResource); };- Logging: Use the provided
How the UI5 CLI E2E test environment works
mainThe E2E test environment simulates realistic user scenarios by performing the following steps for each test:
- Fixture Setup: Copies a project from the
./fixtures/directory to a temporary directory (./tmp). - Dependency Installation: Runs
npm installwithin the temporary directory as a child process. - CLI Execution: Runs
ui5 buildwith various configurations using the UI5 CLI executable sourced frompackages/cli/bin/ui5.cjs.
To optimize performance, Node modules are installed during the first build and reused for subsequent builds in a scenario, avoiding redundant reinstallations. Some tests simulate real-world workflows by performing multiple sequential builds with file modifications between them.
- Fixture Setup: Copies a project from the
Automatic generation of `sap-ui-version.json` during `ui5 build`
mainIn UI5 CLI v5, the
generateVersionInfotask runs by default duringui5 buildfor projects of typeapplication. This task generates ansap-ui-version.jsonfile in theresources/directory.- Supported Build Types: default, jsdoc, and self-contained.
- Project Types: Only runs for
applicationprojects. For other types (e.g.,library), it does not run by default. ui5 servebehavior: ThegenerateVersionInfotask does not run by default duringui5 serve, but theversionInfomiddleware provides an identicalsap-ui-version.jsonoutput.