@sap-ux/preview-middleware 0.5.4 → 0.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -8
- package/dist/base/flp.js +12 -10
- package/dist/types/index.d.ts +1 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -13,13 +13,12 @@ It hosts a local Fiori launchpad based on your configuration as well as offers a
|
|
|
13
13
|
| `flp.intent.action` | `string` | `preview` | Optional intent action |
|
|
14
14
|
| `flp.apps` | `array` | `undefined` | Optional additional local apps that are available in local Fiori launchpad |
|
|
15
15
|
| `flp.libs` | `boolean` | `undefined` | Optional flag to add a generic script fetching the paths of used libraries not available in UI5. To disable set it to `false`, if not set, then the project is checked for a `load-reuse-libs` script and if available the libraries are fetched as well. |
|
|
16
|
+
| `flp.theme` | `string` | `undefined` | Optional flag for setting the UI5 Theme. |
|
|
16
17
|
| `adp.target` | | | Required configuration for adaptation projects defining the connected backend |
|
|
17
18
|
| `adp.ignoreCertErrors` | `boolean` | `false` | Optional setting to ignore certification validation errors when working with e.g. development systems with self signed certificates |
|
|
18
19
|
| `rta` | | | Optional configuration allowing to add mount points for runtime adaptation |
|
|
19
20
|
| `rta.layer` | `string` | `(calculated)` | Optional property for defining the runtime adaptation layer for changes (default is `CUSTOMER_BASE` or read from the project for adaptation projects) |
|
|
20
21
|
| `rta.editors` | `array` | `undefined` | Optional list of mount points for editing |
|
|
21
|
-
|
|
22
|
-
|
|
23
22
|
| `debug` | `boolean` | `false` | Enables debug output |
|
|
24
23
|
|
|
25
24
|
### `flp.apps`
|
|
@@ -44,7 +43,7 @@ Array of additional application configurations:
|
|
|
44
43
|
| Option | Type | Description |
|
|
45
44
|
| --------------- | -------------------| -----------------------------------------------------------------------------------------------|
|
|
46
45
|
| `path` | `string` mandatory | The mount point to be used for the editor. |
|
|
47
|
-
| `developerMode` | `boolean` optional | Enables/disables the runtime adaptation developer mode (only supported for adaptation projects |
|
|
46
|
+
| `developerMode` | `boolean` optional | Enables/disables the runtime adaptation developer mode (only supported for adaptation projects) |
|
|
48
47
|
|
|
49
48
|
|
|
50
49
|
## Usage
|
|
@@ -52,7 +51,7 @@ The middleware can be used without configuration. However, since the middleware
|
|
|
52
51
|
Example: [./test/fixtures/simple-app/ui5.yaml](./test/fixtures/simple-app/ui5.yaml)
|
|
53
52
|
|
|
54
53
|
### Minimal Configuration
|
|
55
|
-
With no configuration provided, the
|
|
54
|
+
With no configuration provided, the local FLP will be available at `/test/flp.html` and the log level is `info`.
|
|
56
55
|
```Yaml
|
|
57
56
|
server:
|
|
58
57
|
customMiddleware:
|
|
@@ -61,7 +60,7 @@ server:
|
|
|
61
60
|
```
|
|
62
61
|
|
|
63
62
|
### Different Path and Debugging enabled
|
|
64
|
-
With this configuration, the
|
|
63
|
+
With this configuration, the local FLP will be available at `/test/myFLP.html` and the log level is `debug`.
|
|
65
64
|
```Yaml
|
|
66
65
|
server:
|
|
67
66
|
customMiddleware:
|
|
@@ -69,7 +68,7 @@ server:
|
|
|
69
68
|
afterMiddleware: compression
|
|
70
69
|
configuration:
|
|
71
70
|
flp:
|
|
72
|
-
path: /
|
|
71
|
+
path: /test/myFLP.html
|
|
73
72
|
debug: true
|
|
74
73
|
```
|
|
75
74
|
|
|
@@ -98,7 +97,7 @@ server:
|
|
|
98
97
|
rta:
|
|
99
98
|
layer: CUSTOMER_BASE
|
|
100
99
|
editors:
|
|
101
|
-
- path: /
|
|
100
|
+
- path: /test/variant-editor.html
|
|
102
101
|
```
|
|
103
102
|
|
|
104
103
|
|
|
@@ -116,7 +115,7 @@ server:
|
|
|
116
115
|
ignoreCertErrors: true
|
|
117
116
|
rta:
|
|
118
117
|
editors:
|
|
119
|
-
- path: /
|
|
118
|
+
- path: /test/adaptation-editor.html
|
|
120
119
|
developerMode: true
|
|
121
120
|
```
|
|
122
121
|
|
package/dist/base/flp.js
CHANGED
|
@@ -54,7 +54,7 @@ class FlpSandbox {
|
|
|
54
54
|
* @param logger logger instance
|
|
55
55
|
*/
|
|
56
56
|
constructor(config, project, utils, logger) {
|
|
57
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
57
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
58
58
|
this.project = project;
|
|
59
59
|
this.utils = utils;
|
|
60
60
|
this.logger = logger;
|
|
@@ -62,7 +62,8 @@ class FlpSandbox {
|
|
|
62
62
|
path: (_b = (_a = config.flp) === null || _a === void 0 ? void 0 : _a.path) !== null && _b !== void 0 ? _b : DEFAULT_PATH,
|
|
63
63
|
intent: (_d = (_c = config.flp) === null || _c === void 0 ? void 0 : _c.intent) !== null && _d !== void 0 ? _d : DEFAULT_INTENT,
|
|
64
64
|
apps: (_f = (_e = config.flp) === null || _e === void 0 ? void 0 : _e.apps) !== null && _f !== void 0 ? _f : [],
|
|
65
|
-
libs: (_g = config.flp) === null || _g === void 0 ? void 0 : _g.libs
|
|
65
|
+
libs: (_g = config.flp) === null || _g === void 0 ? void 0 : _g.libs,
|
|
66
|
+
theme: (_h = config.flp) === null || _h === void 0 ? void 0 : _h.theme
|
|
66
67
|
};
|
|
67
68
|
if (!this.config.path.startsWith('/')) {
|
|
68
69
|
this.config.path = `/${this.config.path}`;
|
|
@@ -79,31 +80,32 @@ class FlpSandbox {
|
|
|
79
80
|
* @param resources optional additional resource mappings
|
|
80
81
|
*/
|
|
81
82
|
init(manifest, componentId, resources = {}) {
|
|
82
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
83
|
-
var
|
|
83
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
84
|
+
var _l;
|
|
84
85
|
return __awaiter(this, void 0, void 0, function* () {
|
|
85
86
|
const flex = this.createFlexHandler();
|
|
86
87
|
const supportedThemes = (_b = (_a = manifest['sap.ui5']) === null || _a === void 0 ? void 0 : _a.supportedThemes) !== null && _b !== void 0 ? _b : [DEFAULT_THEME];
|
|
88
|
+
const ui5Theme = (_c = this.config.theme) !== null && _c !== void 0 ? _c : (supportedThemes.includes(DEFAULT_THEME) ? DEFAULT_THEME : supportedThemes[0]);
|
|
87
89
|
this.templateConfig = {
|
|
88
|
-
basePath: (
|
|
90
|
+
basePath: (_d = (0, path_1.relative)((0, path_1.dirname)(this.config.path), '/')) !== null && _d !== void 0 ? _d : '.',
|
|
89
91
|
apps: {},
|
|
90
92
|
ui5: {
|
|
91
|
-
libs: Object.keys((
|
|
92
|
-
theme:
|
|
93
|
+
libs: Object.keys((_g = (_f = (_e = manifest['sap.ui5']) === null || _e === void 0 ? void 0 : _e.dependencies) === null || _f === void 0 ? void 0 : _f.libs) !== null && _g !== void 0 ? _g : {}).join(','),
|
|
94
|
+
theme: ui5Theme,
|
|
93
95
|
flex,
|
|
94
96
|
resources: Object.assign(Object.assign({}, resources), { [PREVIEW_URL.client.ns]: PREVIEW_URL.client.url })
|
|
95
97
|
},
|
|
96
|
-
locateReuseLibsScript: (
|
|
98
|
+
locateReuseLibsScript: (_h = this.config.libs) !== null && _h !== void 0 ? _h : (yield this.hasLocateReuseLibsScript())
|
|
97
99
|
};
|
|
98
100
|
this.addApp(manifest, {
|
|
99
101
|
componentId,
|
|
100
|
-
target: (
|
|
102
|
+
target: (_j = resources[componentId !== null && componentId !== void 0 ? componentId : manifest['sap.app'].id]) !== null && _j !== void 0 ? _j : this.templateConfig.basePath,
|
|
101
103
|
local: '.',
|
|
102
104
|
intent: this.config.intent
|
|
103
105
|
});
|
|
104
106
|
this.addStandardRoutes();
|
|
105
107
|
if (this.rta) {
|
|
106
|
-
(
|
|
108
|
+
(_k = (_l = this.rta).options) !== null && _k !== void 0 ? _k : (_l.options = {});
|
|
107
109
|
this.rta.options.baseId = componentId !== null && componentId !== void 0 ? componentId : manifest['sap.app'].id;
|
|
108
110
|
this.addEditorRoutes(this.rta);
|
|
109
111
|
}
|
package/dist/types/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"bugs": {
|
|
10
10
|
"url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Apreview-middleware"
|
|
11
11
|
},
|
|
12
|
-
"version": "0.5.
|
|
12
|
+
"version": "0.5.6",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/ejs": "3.1.2",
|
|
31
31
|
"@types/express": "4.17.17",
|
|
32
|
-
"@types/prompts": "2.
|
|
32
|
+
"@types/prompts": "2.4.4",
|
|
33
33
|
"@types/supertest": "2.0.12",
|
|
34
34
|
"copyfiles": "2.4.1",
|
|
35
35
|
"npm-run-all": "4.1.5",
|
|
36
36
|
"express": "4.18.2",
|
|
37
37
|
"nock": "13.2.1",
|
|
38
38
|
"supertest": "6.3.3",
|
|
39
|
-
"@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.1.
|
|
39
|
+
"@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.1.1",
|
|
40
40
|
"@sap-ux/project-access": "1.13.5",
|
|
41
41
|
"@sap-ux/store": "0.3.13"
|
|
42
42
|
},
|