@sap-ux/ui5-application-writer 1.3.3 → 1.4.1
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/dist/index.d.ts +2 -2
- package/dist/index.js +24 -2
- package/dist/types.d.ts +7 -0
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Editor } from 'mem-fs-editor';
|
|
2
|
-
import type { App, AppOptions, UI5 } from './types';
|
|
3
1
|
import { type Package } from '@sap-ux/project-access';
|
|
4
2
|
import { Ui5App } from './types';
|
|
3
|
+
import type { Editor } from 'mem-fs-editor';
|
|
4
|
+
import type { App, AppOptions, UI5 } from './types';
|
|
5
5
|
/**
|
|
6
6
|
* Writes the template to the memfs editor instance.
|
|
7
7
|
*
|
package/dist/index.js
CHANGED
|
@@ -57,8 +57,9 @@ async function generate(basePath, ui5AppConfig, fs) {
|
|
|
57
57
|
});
|
|
58
58
|
ui5Config.addFioriToolsAppReloadMiddleware();
|
|
59
59
|
if (isEdmxProjectType) {
|
|
60
|
+
const previewMiddleWareOpts = getPreviewMiddlewareOpts(ui5App.app, ui5App.ui5?.ui5Theme, ui5AppConfig.appOptions?.useVirtualPreviewEndpoints);
|
|
60
61
|
// add preview middleware to ui5Config
|
|
61
|
-
ui5Config.addFioriToolsPreviewMiddleware(
|
|
62
|
+
ui5Config.addFioriToolsPreviewMiddleware(previewMiddleWareOpts);
|
|
62
63
|
const ui5LocalConfigPath = (0, path_1.join)(basePath, 'ui5-local.yaml');
|
|
63
64
|
// write ui5-local.yaml only for non-CAP applications
|
|
64
65
|
const ui5LocalConfig = await ui5_config_1.UI5Config.newInstance(fs.read(ui5LocalConfigPath));
|
|
@@ -67,7 +68,7 @@ async function generate(basePath, ui5AppConfig, fs) {
|
|
|
67
68
|
// Add optional features
|
|
68
69
|
await (0, options_1.applyOptionalFeatures)(ui5App, fs, basePath, tmplPath, [ui5Config, ui5LocalConfig]);
|
|
69
70
|
// add preview middleware to ui5LocalConfig
|
|
70
|
-
ui5LocalConfig.addFioriToolsPreviewMiddleware(
|
|
71
|
+
ui5LocalConfig.addFioriToolsPreviewMiddleware(previewMiddleWareOpts);
|
|
71
72
|
// write ui5 local yaml
|
|
72
73
|
fs.write(ui5LocalConfigPath, ui5LocalConfig.toString());
|
|
73
74
|
}
|
|
@@ -79,6 +80,27 @@ async function generate(basePath, ui5AppConfig, fs) {
|
|
|
79
80
|
fs.write(ui5ConfigPath, ui5Config.toString());
|
|
80
81
|
return fs;
|
|
81
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Get the preview middleware options.
|
|
85
|
+
*
|
|
86
|
+
* @param app - the app config
|
|
87
|
+
* @param ui5Theme - the UI5 theme
|
|
88
|
+
* @param useVirtualPreviewEndpoints - boolean to determine if virtual endpoints are used
|
|
89
|
+
* @returns preview middleware options
|
|
90
|
+
*/
|
|
91
|
+
function getPreviewMiddlewareOpts(app, ui5Theme, useVirtualPreviewEndpoints = false) {
|
|
92
|
+
return {
|
|
93
|
+
ui5Theme,
|
|
94
|
+
...(useVirtualPreviewEndpoints && {
|
|
95
|
+
localStartFile: app.localStartFile
|
|
96
|
+
}),
|
|
97
|
+
// only add flp intent if not using virtual endpoints (default `app-preview` will be used by middleware)
|
|
98
|
+
...(!useVirtualPreviewEndpoints && {
|
|
99
|
+
flpAction: app.flpAction,
|
|
100
|
+
appId: app.id
|
|
101
|
+
})
|
|
102
|
+
};
|
|
103
|
+
}
|
|
82
104
|
/**
|
|
83
105
|
* Check if Typescript is enabled for the given path.
|
|
84
106
|
*
|
package/dist/types.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export interface App {
|
|
|
19
19
|
baseComponent?: string;
|
|
20
20
|
startFile?: string;
|
|
21
21
|
localStartFile?: string;
|
|
22
|
+
flpAction?: string;
|
|
22
23
|
/**
|
|
23
24
|
* Defines the template used by the generation tool
|
|
24
25
|
*/
|
|
@@ -150,6 +151,12 @@ export interface AppOptions {
|
|
|
150
151
|
* Excludes the index.html from the template and does not add the `start-noflp` script in package.json
|
|
151
152
|
*/
|
|
152
153
|
generateIndex?: boolean;
|
|
154
|
+
/**
|
|
155
|
+
* Enables the use of virtually serving the endpoints for preview.
|
|
156
|
+
* Prevents generating `flpSandbox.html`, and if applicable the `changes_loader.js`, `changes_preview.js` & `locate-reuse-libs.js`.
|
|
157
|
+
* Also updates the configs (e.g. ui5.yaml) and package.json scripts accordingly.
|
|
158
|
+
*/
|
|
159
|
+
useVirtualPreviewEndpoints?: boolean;
|
|
153
160
|
}
|
|
154
161
|
export interface Ui5App {
|
|
155
162
|
app: App;
|
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%3Aui5-application-writer"
|
|
11
11
|
},
|
|
12
|
-
"version": "1.
|
|
12
|
+
"version": "1.4.1",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"main": "dist/index.js",
|
|
15
15
|
"files": [
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"mem-fs": "2.1.0",
|
|
28
28
|
"mem-fs-editor": "9.4.0",
|
|
29
29
|
"semver": "7.5.4",
|
|
30
|
-
"@sap-ux/ui5-config": "0.
|
|
30
|
+
"@sap-ux/ui5-config": "0.27.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/ejs": "3.1.2",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@types/semver": "7.5.2",
|
|
39
39
|
"fs-extra": "10.0.0",
|
|
40
40
|
"@sap-ux/eslint-plugin-fiori-tools": "0.5.0",
|
|
41
|
-
"@sap-ux/project-access": "1.29.
|
|
41
|
+
"@sap-ux/project-access": "1.29.20"
|
|
42
42
|
},
|
|
43
43
|
"engines": {
|
|
44
44
|
"node": ">=18.x"
|