Skip to content

Commit d421f2c

Browse files
committed
Update dependencies, add ui5-linter and adapt
1 parent 6a545b0 commit d421f2c

File tree

7 files changed

+45
-28
lines changed

7 files changed

+45
-28
lines changed

package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"start": "ui5 serve --port 8080 -o index.html",
1111
"start:dist": "ui5 serve --port 8080 -o index.html --config ui5-dist.yaml",
1212
"ts-typecheck": "tsc --noEmit",
13-
"lint": "eslint webapp"
13+
"lint": "eslint webapp",
14+
"ui5lint": "ui5lint"
1415
},
1516
"repository": {
1617
"type": "git",
@@ -19,10 +20,11 @@
1920
"devDependencies": {
2021
"@types/openui5": "1.127.0",
2122
"@ui5/cli": "^4",
22-
"eslint": "^9.10.0",
23-
"typescript-eslint": "^8.4.0",
24-
"globals": "^15.9.0",
25-
"typescript": "^5.6.2",
23+
"@ui5/linter": "^1.1.1",
24+
"eslint": "^9.13.0",
25+
"globals": "^15.11.0",
26+
"typescript": "^5.6.3",
27+
"typescript-eslint": "^8.11.0",
2628
"ui5-middleware-livereload": "^3",
2729
"ui5-middleware-simpleproxy": "^3",
2830
"ui5-tooling-transpile": "^3"

step-by-step.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This guide explains step-by-step and command-by-command how you get to a complet
44

55
While you can get started faster by just copying and modifying the entire *Hello World* app, this step-by-step guide will help you understand every bit and piece of the setup and how the pieces fit together.
66

7-
It consists of ten steps, but in fact only the first half is really related to TypeScript. The remaining five steps are about adding the UI5 tools to the project and wrapping everything up nicely, so these steps apply more or less to any UI5 application project.
7+
It consists of ten steps, but in fact only the first four steps and step six are really related to TypeScript. The other steps are about adding the UI5 tools to the project and wrapping everything up nicely, so these steps apply more or less to any UI5 application project.
88

99
## Table of Contents
1010

@@ -238,7 +238,7 @@ metadata:
238238
type: application
239239
```
240240
241-
For running UI5 applications with the UI5 Tooling we also need some additional `framework` information like framework `name` and `version`) and the required libraries and theme libraries. Now put the following content in your `ui5.yaml` (please adopt the `metadata > name` to `ui5.typescript.helloworld`):
241+
For running UI5 applications with the UI5 Tooling we also need some additional `framework` information (like framework `name` and `version`) and the required libraries and theme libraries. Now put the following content in your `ui5.yaml` (please adopt the `metadata > name` to `ui5.typescript.helloworld`):
242242
243243
```yaml
244244
specVersion: "3.0"
@@ -284,8 +284,8 @@ What you can do now: create a simple `test.html` file in the `webapp` folder and
284284
src="resources/sap-ui-core.js"
285285
data-sap-ui-libs="sap.m"
286286
data-sap-ui-theme="sap_horizon"
287-
data-sap-ui-compatVersion="edge"
288-
data-sap-ui-oninit="onInit"
287+
data-sap-ui-compat-version="edge"
288+
data-sap-ui-on-init="onInit"
289289
data-sap-ui-async="true"
290290
></script>
291291
<script>
@@ -307,7 +307,7 @@ What you can do now: create a simple `test.html` file in the `webapp` folder and
307307
</html>
308308
```
309309
310-
After you can start the `test.html` running inside the development server of the UI5 CLI Tooling:
310+
After that, you can start the `test.html` running inside the development server of the UI5 CLI Tooling:
311311
312312
```sh
313313
npx ui5 serve -o test.html
@@ -473,6 +473,14 @@ npx ui5 serve -o index.html --config ui5-dist.yaml
473473
474474
Now it's time to write down the various commands used so far as scripts in `package.json`, so you don't need to type them every time they are used.
475475
476+
While we are at it, we can add one more command: the `ui5-linter`, which complements eslint with code checks that make sure the code adheres to the best practices and is ready for UI5 2.0:
477+
478+
```sh
479+
npm install --save-dev @ui5/linter
480+
```
481+
482+
It can be invoked using `npx ui5lint`.
483+
476484
Change the `"scripts"` section in the `package.json` file to have the following content. All scripts have already been used and explained earlier, so there is nothing new here, it's just for convenience.
477485
478486
```json
@@ -482,7 +490,8 @@ Change the `"scripts"` section in the `package.json` file to have the following
482490
"start": "ui5 serve --port 8080 -o index.html",
483491
"start:dist": "ui5 serve --port 8080 -o index.html --config ui5-dist.yaml",
484492
"ts-typecheck": "tsc --noEmit",
485-
"lint": "eslint webapp"
493+
"lint": "eslint webapp",
494+
"ui5lint": "ui5lint"
486495
}
487496
```
488497

webapp/Component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import Device from "sap/ui/Device";
88
export default class Component extends UIComponent {
99

1010
public static metadata = {
11+
interfaces: ["sap.ui.core.IAsyncContentCreation"],
1112
manifest: "json"
1213
};
1314

webapp/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
<title>UI5 TypeScript Hello World App</title>
66
<script id="sap-ui-bootstrap"
77
src="resources/sap-ui-core.js"
8-
data-sap-ui-resourceroots='{
8+
data-sap-ui-resource-roots='{
99
"ui5.typescript.helloworld": "./"
1010
}'
1111
data-sap-ui-theme="sap_horizon"
12-
data-sap-ui-compatVersion="edge"
13-
data-sap-ui-oninit="module:sap/ui/core/ComponentSupport"
12+
data-sap-ui-compat-version="edge"
13+
data-sap-ui-on-init="module:sap/ui/core/ComponentSupport"
1414
data-sap-ui-async="true"
1515
data-sap-ui-xx-waitForTheme="true"
1616
data-sap-ui-xx-supportedLanguages="en,de"

webapp/manifest.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
"rootView": {
3434
"viewName": "ui5.typescript.helloworld.view.App",
3535
"type": "XML",
36-
"async": true,
3736
"id": "app"
3837
},
3938

webapp/test.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
src="resources/sap-ui-core.js"
88
data-sap-ui-libs="sap.m"
99
data-sap-ui-theme="sap_horizon"
10-
data-sap-ui-compatVersion="edge"
11-
data-sap-ui-oninit="onInit"
10+
data-sap-ui-compat-version="edge"
11+
data-sap-ui-on-init="onInit"
1212
data-sap-ui-async="true"
1313
></script>
1414
<script>

webapp/view/App.view.xml

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,24 @@
55
xmlns:mvc="sap.ui.core.mvc">
66

77
<App id="app">
8-
<MessagePage
8+
<Page
99
title="Hello World"
10-
text="This is a UI5 TypeScript Hello World app"
11-
icon="sap-icon://accept"
12-
id="page"
13-
description="">
14-
<buttons>
15-
<Button
16-
text="Say Hello"
17-
press="sayHello" />
18-
</buttons>
19-
</MessagePage>
10+
id="page">
11+
<content>
12+
<IllustratedMessage
13+
title="Hello World"
14+
illustrationType="sapIllus-SuccessHighFive"
15+
enableVerticalResponsiveness="true"
16+
description="This is a UI5 TypeScript Hello World app">
17+
<additionalContent>
18+
<Button
19+
id="helloButton"
20+
text="Say Hello"
21+
press="sayHello" />
22+
</additionalContent>
23+
</IllustratedMessage>
24+
</content>
25+
</Page>
2026
</App>
2127

2228
</mvc:View>

0 commit comments

Comments
 (0)