Skip to content

Commit d6db2dd

Browse files
committed
refactor: Create separate package for documentation
1 parent 7d51049 commit d6db2dd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+5894
-0
lines changed
282 KB
Loading

packages/documentation/docs/images/UI5_CLI/Task_Minify.svg

Lines changed: 459 additions & 0 deletions
Loading
35.9 KB
Loading
65.4 KB
Loading
14.7 KB
Loading
Lines changed: 6 additions & 0 deletions
Loading
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
![UI5 logo](images/UI5_logo_wide.png)
2+
3+
# UI5 CLI
4+
5+
An open and modular toolchain to develop state-of-the-art applications based on the [UI5](https://ui5.sap.com) framework.
6+
7+
!!! abstract "Project Rename"
8+
**UI5 Tooling has been renamed to UI5 CLI 🚨**
9+
10+
Read the announcement blog post: **[SAP Community: Goodbye UI5 Tooling - Hello UI5 CLI!](https://community.sap.com/t5/technology-blog-posts-by-sap/goodbye-ui5-tooling-hello-ui5-cli/ba-p/14211769)**
11+
12+
!!! tip "New Release"
13+
**UI5 CLI V4 is here 🎉**
14+
15+
Read the announcement blog post: **[SAP Community: UI5 CLI 4.0](https://community.sap.com/t5/technology-blogs-by-sap/ui5-tooling-4-0/ba-p/13769578)**
16+
17+
And checkout the **[Migrate to v4](./updates/migrate-v4.md)** documentation.
18+
19+
[**Get Started**](./pages/GettingStarted.md){: .md-button .md-button--primary .sap-icon-initiative }
20+
21+
## Main Features
22+
23+
### 💻 UI5 CLI
24+
25+
*Also see the [UI5 CLI Documentation](./pages/CLI.md)*
26+
27+
```sh
28+
# Global
29+
npm install --global @ui5/cli
30+
31+
# In your project
32+
npm install --save-dev @ui5/cli
33+
```
34+
35+
#### ⚙️ Project Setup
36+
37+
Configure your project for use with UI5 CLI.
38+
*Also see the [Configuration Documentation](./pages/Configuration.md)*
39+
40+
```
41+
❯ ui5 init
42+
Wrote ui5.yaml:
43+
44+
specVersion: "4.0"
45+
metadata:
46+
name: my-app
47+
type: application
48+
```
49+
50+
#### 🚚 Dependency Management
51+
52+
UI5 framework dependencies are managed by UI5 CLI. All other dependencies are managed by your favorite node package manager.
53+
54+
```
55+
❯ ui5 use [email protected]
56+
Updated configuration written to ui5.yaml
57+
This project is now using SAPUI5 version 1.117.0
58+
59+
❯ ui5 add sap.ui.core sap.m themelib_sap_fiori_3
60+
Updated configuration written to ui5.yaml
61+
Added framework libraries sap.ui.core sap.m themelib_sap_fiori_3 as dependencies
62+
```
63+
64+
#### 🏄 Development Server
65+
66+
Start a local development server to work on your project.
67+
*Also see the [Server Documentation](./pages/Server.md)*
68+
69+
```
70+
❯ ui5 serve
71+
Server started
72+
URL: http://localhost:8080
73+
```
74+
75+
#### 🛠 Build for Production
76+
77+
Build an optimized version of your project.
78+
*Also see the [Builder Documentation](./pages/Builder.md)*
79+
80+
``` bash
81+
❯ ui5 build
82+
info graph:helpers:ui5Framework Using OpenUI5 version: 1.117.0
83+
info ProjectBuilder Preparing build for project my-app
84+
info ProjectBuilder Target directory: ./dist
85+
info ProjectBuilder Cleaning target directory...
86+
info Project 1 of 1: ❯ Building application project my-app...
87+
info my-app › Running task escapeNonAsciiCharacters...
88+
info my-app › Running task replaceCopyright...
89+
info my-app › Running task replaceVersion...
90+
info my-app › Running task minify...
91+
info my-app › Running task generateFlexChangesBundle...
92+
info my-app › Running task generateComponentPreload...
93+
info ProjectBuilder Build succeeded in 296 ms
94+
info ProjectBuilder Executing cleanup tasks...
95+
```
96+
97+
### 🧪 Node.js API
98+
99+
Most UI5 CLI modules provide JavaScript APIs for direct consumption in other Node.js projects.
100+
This allows you to rely on UI5 CLI for UI5-specific build functionality and project handling, while creating your own tools to perfectly match the needs of your project.
101+
102+
All available APIs are documented in the [UI5 CLI API Reference](https://ui5.github.io/cli/v4/api/index.html).
103+
104+
=== "ESM"
105+
106+
```js linenums="1"
107+
import {graphFromPackageDependencies} from "@ui5/project/graph";
108+
109+
async function buildApp(projectPath, destinationPath) {
110+
const graph = await graphFromPackageDependencies({
111+
cwd: projectPath
112+
});
113+
await graph.build({
114+
destPath: destinationPath,
115+
selfContained: true,
116+
excludedTasks: ["transformBootstrapHtml"],
117+
includedDependencies: ["*"]
118+
});
119+
}
120+
```
121+
122+
=== "CommonJS"
123+
124+
```js linenums="1"
125+
async function buildApp(projectPath, destinationPath) {
126+
const {graphFromPackageDependencies} =
127+
await import("@ui5/project/graph");
128+
const graph = await graphFromPackageDependencies({
129+
cwd: projectPath
130+
});
131+
await graph.build({
132+
destPath: destinationPath,
133+
selfContained: true,
134+
excludedTasks: ["transformBootstrapHtml"],
135+
includedDependencies: ["*"]
136+
});
137+
}
138+
```
Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
# Benchmarking UI5 CLI
2+
3+
For benchmarking UI5 CLI we typically make use of the open source tool [hyperfine](https://github.com/sharkdp/hyperfine).
4+
5+
In general we only benchmark calls to the UI5 CLI. However, we might add scripted benchmarks for some components in the future.
6+
7+
The following is a walk-through on how to evaluate the performance impact of an imaginary change in the UI5 Builder project.
8+
9+
## Setup
10+
11+
1. Install [hyperfine](https://github.com/sharkdp/hyperfine#installation)
12+
1. Prepare the UI5 CLI projects you want to measure *(optional if your development environment already reflects this)*:
13+
1. Start in an empty directory
14+
```sh
15+
mkdir ui5-cli-benchmark && cd ui5-cli-benchmark/
16+
```
17+
1. Clone [UI5 CLI](https://github.com/SAP/ui5-cli)
18+
```sh
19+
git clone [email protected]:SAP/ui5-cli.git
20+
```
21+
1. Clone [UI5 Builder](https://github.com/SAP/ui5-builder) (or your fork)
22+
```sh
23+
git clone [email protected]:SAP/ui5-builder.git
24+
```
25+
Make sure you check out the `main` branch, since we'll perform the baseline test first
26+
1. Install npm dependencies in both directories
27+
```sh
28+
(cd ui5-cli && npm install)
29+
(cd ui5-builder && npm install)
30+
```
31+
1. Create global npm links for both projects
32+
```sh
33+
(cd ui5-cli && npm link)
34+
(cd ui5-builder && npm link)
35+
```
36+
1. Link UI5 Builder into UI5 CLI
37+
```sh
38+
(cd ui5-cli && npm link @ui5/builder)
39+
```
40+
1. Verify your setup
41+
```sh
42+
ui5 --version
43+
```
44+
This should output the version and location of the UI5 CLI you just cloned.
45+
46+
For example:
47+
```
48+
3.0.0 (from /my/home/ui5-cli-benchmark/ui5-cli/bin/ui5.cjs)
49+
```
50+
51+
1. Prepare your test project (we choose the [openui5-sample-app](https://github.com/SAP/openui5-sample-app))
52+
1. Clone the project
53+
```sh
54+
git clone [email protected]:SAP/openui5-sample-app.git
55+
```
56+
1. Navigate into the project
57+
```sh
58+
cd openui5-sample-app
59+
```
60+
1. Install any required npm dependencies
61+
```sh
62+
npm install
63+
```
64+
Note: We won't link UI5 CLI into this project. Instead, we'll call it directly.
65+
1. Verify that the previously installed UI5 CLI can be called with the following command:
66+
```sh
67+
UI5_CLI_NO_LOCAL=X node /my/home/ui5-cli-benchmark/ui5-cli/bin/ui5.cjs --version
68+
```
69+
On Windows:
70+
```sh
71+
set UI5_CLI_NO_LOCAL=X node /my/home/ui5-cli-benchmark/ui5-cli/bin/ui5.cjs --version
72+
```
73+
*(Replace the path to ui5.cjs with the one shown in the previous `ui5 --version` output)*
74+
75+
## Benchmarking
76+
77+
1. Depending on how reliable you'd like the measurements to be, consider preparing your system:
78+
1. Connect your computer to a power supply
79+
1. Make sure no updates or anti-virus scans are taking place
80+
1. Close all applications. This includes your IDE, since it might start indexing any new files created during the build, thus impacting I/O
81+
1. Don't interact with your system wile the benchmarking is running
82+
83+
1. Perform the baseline measurement
84+
1. In the project, start your first benchmark
85+
```sh
86+
hyperfine --warmup 1 \
87+
'UI5_CLI_NO_LOCAL=X node /my/home/ui5-cli-benchmark/ui5-cli/bin/ui5.cjs build' \
88+
--export-markdown ./baseline.md
89+
```
90+
On Windows:
91+
```sh
92+
hyperfine --warmup 1 \
93+
'set UI5_CLI_NO_LOCAL=X node /my/home/ui5-cli-benchmark/ui5-cli/bin/ui5.cjs build' \
94+
--export-markdown ./baseline.md
95+
```
96+
1. Your baseline benchmark is now stored in `baseline.md` and should look similar to this:
97+
98+
| Command | Mean [s] | Min [s] | Max [s] | Relative |
99+
|:---|---:|---:|---:|---:|
100+
| `UI5_CLI_NO_LOCAL=X node /my/home/ui5-cli-benchmark/ui5-cli/bin/ui5.cjs build` | 1.439 ± 0.036 | 1.400 | 1.507 | 1.00 |
101+
102+
1. Prepare your change
103+
1. Switch to the branch that contains your change
104+
```sh
105+
(cd ../pages/ui5-builder && git checkout my-change)
106+
```
107+
1. If your change requires different npm dependencies, reinstall them
108+
```sh
109+
(cd ../pages/ui5-builder && npm install)
110+
```
111+
1. The link from UI5 CLI is still in place. However, if you have changes in **multiple** UI5 CLI modules, you might need to `npm link` those again
112+
113+
1. Perform the change measurement
114+
1. In the project, start your second benchmark
115+
```sh
116+
hyperfine --warmup 1 \
117+
'UI5_CLI_NO_LOCAL=X node /my/home/ui5-cli-benchmark/ui5-cli/bin/ui5.cjs build' \
118+
--export-markdown ./my_change.md
119+
```
120+
On Windows:
121+
```sh
122+
hyperfine --warmup 1 \
123+
'set UI5_CLI_NO_LOCAL=X node /my/home/ui5-cli-benchmark/ui5-cli/bin/ui5.cjs build' \
124+
--export-markdown ./my_change.md
125+
```
126+
1. Your change's benchmark is now stored in `my_change.md`
127+
128+
## Compile Results
129+
130+
1. Merge both measurements into one markdown
131+
1. In this setup, Hyperfine can't correctly calculate the relative difference between results. The respective column always reads "1". Either remove the "Relative" column or calculate the relative difference yourself:
132+
* Use this formula to calculate the percentage increase based on the *Mean* result:
133+
`(newMean - baselineMean) / baselineMean * 100`
134+
^^JavaScript function:^^
135+
`#!js function calcDiff(baseVal, newVal) {return (newVal - baseVal) / baseVal * 100;}`
136+
137+
* **Example for a performance improvement:**
138+
Baseline of 10 seconds decreased to 7 seconds:
139+
`(7-10)/10*100 = -30` => **-30%** change
140+
141+
* **Example for a performance deterioration:**
142+
Baseline of 10 seconds increased to 12 seconds:
143+
`(12-10)/10*100 = 20` => **+20%** change
144+
145+
1. Change the unit in the Mean/Min/Max column headers to seconds or milliseconds according to your results.
146+
1. Change the command column to only contain the relevant `ui5 build` command, including any parameters. E.g. `ui5 build --all`
147+
1. You should end up with a markdown like this:
148+
```md
149+
ui5-builder Ref | Command | Mean [s] | Min [s] | Max [s] | Relative
150+
|:---|:---|---:|---:|---:|---:|
151+
| main ([`1234567`](https://github.com/SAP/ui5-builder/commit/<sha>)) | `ui5 build` | 1.439 ± 0.036 | 1.400 | 1.507 | Baseline |
152+
| feature-duck ([`9101112`](https://github.com/SAP/ui5-builder/commit/<sha>)) | `ui5 build` | 1.584 ± 0.074 | 1.477 | 1.680 | **+10%** |
153+
```
154+
Rendering like this:
155+
156+
| ui5-builder Ref | Command | Mean [s] | Min [s] | Max [s] | Relative |
157+
|:---|:---|---:|---:|---:|---:|
158+
| main ([`1234567`](https://github.com/SAP/ui5-builder/commit/<sha>)) | `ui5 build` | 1.439 ± 0.036 | 1.400 | 1.507 | Baseline |
159+
| feature-duck ([`9101112`](https://github.com/SAP/ui5-builder/commit/<sha>)) | `ui5 build` | 1.584 ± 0.074 | 1.477 | 1.680 | **+10%** |
160+
161+
1. You can now share these results on GitHub or wherever you might need them.
162+
163+
**Happy benchmarking! 🏎**

0 commit comments

Comments
 (0)