@sap-ux/preview-middleware 0.16.46 → 0.16.48
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 +6 -6
- package/dist/base/config.d.ts +2 -1
- package/dist/base/config.js +7 -4
- package/dist/base/flp.js +1 -1
- package/dist/client/flp/bootstrap.js +5 -3
- package/package.json +4 -4
- package/templates/flp/sandbox.html +6 -2
package/README.md
CHANGED
|
@@ -57,12 +57,12 @@ Array of additional application configurations:
|
|
|
57
57
|
| `developerMode` | `boolean` optional | Enables/disables the runtime adaptation developer mode (only supported for adaptation projects) |
|
|
58
58
|
|
|
59
59
|
### `test`
|
|
60
|
-
| Option | Type | Description
|
|
61
|
-
| --------------- |
|
|
62
|
-
| `framework` | `string` mandatory | Currently `OPA5`, `QUnit` and `Testsuite` are supported. `Testsuite` will generate a testsuite for all configured frameworks that can be be used with a test runner (like e.g. karma)
|
|
63
|
-
| `path` | `string` optional | The mount point to be used for test suite. By default `/test/opaTests.qunit.html` is used for `OPA5`, `/test/unitTests.qunit.html` is used for `QUnit` and `/test/testsuite.qunit.html` is used for `Testsuite`
|
|
64
|
-
| `init` | `string` optional | The mount point to be used for custom test runner script
|
|
65
|
-
| `pattern` | `string` optional | Optional glob pattern to find the tests. By default `/test/**/*Journey.*` is used for `OPA5` and `/test/**/*Test.*` is used for `QUnit` (n.a. for `Testsuite`)
|
|
60
|
+
| Option | Type | Description |
|
|
61
|
+
| --------------- | -------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
62
|
+
| `framework` | `string` mandatory | Currently `OPA5`, `QUnit` (only QUnit 2.3.2 provided as third-party module via [OpenUI5](https://github.com/SAP/openui5/blob/master/THIRDPARTY.txt)/SAPUI5) and `Testsuite` are supported. `Testsuite` will generate a testsuite for all configured frameworks that can be be used with a test runner (like e.g. karma) |
|
|
63
|
+
| `path` | `string` optional | The mount point to be used for test suite. By default `/test/opaTests.qunit.html` is used for `OPA5`, `/test/unitTests.qunit.html` is used for `QUnit` and `/test/testsuite.qunit.html` is used for `Testsuite` |
|
|
64
|
+
| `init` | `string` optional | The mount point to be used for custom test runner script |
|
|
65
|
+
| `pattern` | `string` optional | Optional glob pattern to find the tests. By default `/test/**/*Journey.*` is used for `OPA5` and `/test/**/*Test.*` is used for `QUnit` (n.a. for `Testsuite`) |
|
|
66
66
|
|
|
67
67
|
|
|
68
68
|
## Usage
|
package/dist/base/config.d.ts
CHANGED
|
@@ -48,7 +48,8 @@ export interface TemplateConfig {
|
|
|
48
48
|
*/
|
|
49
49
|
export declare const PREVIEW_URL: {
|
|
50
50
|
readonly client: {
|
|
51
|
-
readonly
|
|
51
|
+
readonly path: "/preview/client";
|
|
52
|
+
readonly getUrl: (basePath: string) => string;
|
|
52
53
|
readonly local: string;
|
|
53
54
|
readonly ns: "open.ux.preview.client";
|
|
54
55
|
};
|
package/dist/base/config.js
CHANGED
|
@@ -14,7 +14,8 @@ const mem_fs_1 = require("mem-fs");
|
|
|
14
14
|
*/
|
|
15
15
|
exports.PREVIEW_URL = {
|
|
16
16
|
client: {
|
|
17
|
-
|
|
17
|
+
path: '/preview/client',
|
|
18
|
+
getUrl: (basePath) => path_1.posix.join(basePath, 'preview', 'client'),
|
|
18
19
|
local: (0, path_1.join)(__dirname, '../../dist/client'),
|
|
19
20
|
ns: 'open.ux.preview.client'
|
|
20
21
|
},
|
|
@@ -182,8 +183,9 @@ async function getI18nTextFromProperty(projectRoot, propertyValue, logger) {
|
|
|
182
183
|
}
|
|
183
184
|
const propertyI18nKey = propertyValue.replace(/i18n>|[{}]/g, '');
|
|
184
185
|
const projectAccess = await (0, project_access_1.createProjectAccess)(projectRoot);
|
|
186
|
+
const applicationIds = projectAccess.getApplicationIds();
|
|
185
187
|
try {
|
|
186
|
-
const bundle = (await projectAccess.getApplication(
|
|
188
|
+
const bundle = (await projectAccess.getApplication(applicationIds[0]).getI18nBundles())['sap.app'];
|
|
187
189
|
return bundle[propertyI18nKey]?.[0]?.value?.value ?? propertyI18nKey;
|
|
188
190
|
}
|
|
189
191
|
catch (e) {
|
|
@@ -205,8 +207,9 @@ function createFlpTemplateConfig(config, manifest, resources = {}) {
|
|
|
205
207
|
const ui5Theme = config.theme ?? (supportedThemes.includes(exports.DEFAULT_THEME) ? exports.DEFAULT_THEME : supportedThemes[0]);
|
|
206
208
|
const id = manifest['sap.app']?.id ?? '';
|
|
207
209
|
const ns = id.replace(/\./g, '/');
|
|
210
|
+
const basePath = path_1.posix.relative(path_1.posix.dirname(config.path), '/') ?? '.';
|
|
208
211
|
return {
|
|
209
|
-
basePath:
|
|
212
|
+
basePath: basePath,
|
|
210
213
|
apps: {},
|
|
211
214
|
init: config.init ? ns + config.init : undefined,
|
|
212
215
|
ui5: {
|
|
@@ -215,7 +218,7 @@ function createFlpTemplateConfig(config, manifest, resources = {}) {
|
|
|
215
218
|
flex,
|
|
216
219
|
resources: {
|
|
217
220
|
...resources,
|
|
218
|
-
[exports.PREVIEW_URL.client.ns]: exports.PREVIEW_URL.client.
|
|
221
|
+
[exports.PREVIEW_URL.client.ns]: exports.PREVIEW_URL.client.getUrl(basePath)
|
|
219
222
|
},
|
|
220
223
|
bootstrapOptions: ''
|
|
221
224
|
},
|
package/dist/base/flp.js
CHANGED
|
@@ -175,7 +175,7 @@ class FlpSandbox {
|
|
|
175
175
|
*/
|
|
176
176
|
addStandardRoutes() {
|
|
177
177
|
// register static client sources
|
|
178
|
-
this.router.use(config_1.PREVIEW_URL.client.
|
|
178
|
+
this.router.use(config_1.PREVIEW_URL.client.path, (0, express_1.static)(config_1.PREVIEW_URL.client.local));
|
|
179
179
|
// add route for the sandbox.html
|
|
180
180
|
this.router.get(this.config.path, (async (_req, res, next) => {
|
|
181
181
|
// inform the user if a html file exists on the filesystem
|
|
@@ -9,14 +9,16 @@
|
|
|
9
9
|
* @param fnCallback {Function} The callback function to be executed after the bootstrap is loaded.
|
|
10
10
|
*/
|
|
11
11
|
async function ushellBootstrap(fnCallback) {
|
|
12
|
-
|
|
12
|
+
const basePath = window['data-open-ux-preview-basePath'] ?? '';
|
|
13
|
+
|
|
14
|
+
let src = `${basePath}/test-resources/sap/ushell/bootstrap/sandbox.js`;
|
|
13
15
|
try {
|
|
14
|
-
const response = await fetch(
|
|
16
|
+
const response = await fetch(`${basePath}/resources/sap-ui-version.json`);
|
|
15
17
|
const json = await response.json();
|
|
16
18
|
const version = json?.libraries?.find((lib) => lib.name === 'sap.ui.core')?.version;
|
|
17
19
|
const major = version ? parseInt(version.split('.')[0], 10) : 2;
|
|
18
20
|
if (major >= 2) {
|
|
19
|
-
src =
|
|
21
|
+
src = `${basePath}/resources/sap/ushell/bootstrap/sandbox2.js`;
|
|
20
22
|
}
|
|
21
23
|
} catch (error) {
|
|
22
24
|
console.warn('Failed to fetch sap-ui-version.json. Assuming it is a 1.x version.');
|
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.16.
|
|
12
|
+
"version": "0.16.48",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"mem-fs-editor": "9.4.0",
|
|
28
28
|
"@sap-ux/logger": "0.6.0",
|
|
29
29
|
"@sap-ux/btp-utils": "0.15.0",
|
|
30
|
-
"@sap-ux/adp-tooling": "0.12.35",
|
|
31
30
|
"@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.4.27",
|
|
32
|
-
"@sap-ux/project-access": "1.26.6"
|
|
31
|
+
"@sap-ux/project-access": "1.26.6",
|
|
32
|
+
"@sap-ux/adp-tooling": "0.12.36"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/ejs": "3.1.2",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"dotenv": "16.3.1",
|
|
48
48
|
"@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.10.7",
|
|
49
49
|
"@sap-ux/axios-extension": "1.16.3",
|
|
50
|
-
"@sap-ux/store": "0.9.
|
|
50
|
+
"@sap-ux/store": "0.9.1",
|
|
51
51
|
"@sap-ux/ui5-info": "0.8.0",
|
|
52
52
|
"@sap-ux/i18n": "0.1.1"
|
|
53
53
|
},
|
|
@@ -40,7 +40,11 @@
|
|
|
40
40
|
};
|
|
41
41
|
</script>
|
|
42
42
|
|
|
43
|
-
<script
|
|
43
|
+
<script type="text/javascript">
|
|
44
|
+
window["data-open-ux-preview-basePath"] = "<%- basePath %>";
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<script src="<%- basePath %>/preview/client/flp/bootstrap.js" id="preview-bootstrap"></script>
|
|
44
48
|
<script id="sap-ushell-bootstrap"></script>
|
|
45
49
|
<!-- Bootstrap the UI5 core library. 'data-sap-ui-frameOptions="allow"'' is a NON-SECURE setting for test environments -->
|
|
46
50
|
<script id="sap-ui-bootstrap"
|
|
@@ -68,7 +72,7 @@
|
|
|
68
72
|
#shell-header, .sapUiRtaToolbar {
|
|
69
73
|
visibility: hidden;
|
|
70
74
|
height: 1px;
|
|
71
|
-
}
|
|
75
|
+
}
|
|
72
76
|
.sapUshellShellCanvas {
|
|
73
77
|
top: 0 !important;
|
|
74
78
|
}
|