@sap-ux/fiori-freestyle-writer 2.2.8 → 2.3.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/defaults.d.ts +6 -0
- package/dist/defaults.js +13 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +12 -4
- package/package.json +7 -7
package/dist/defaults.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { FreestyleApp } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Sets defaults for relevant parameters (`flpAppId`, `startFile`, `localStartFile`, ) when virtual endpoints are used.
|
|
4
|
+
*
|
|
5
|
+
* @param ffApp - Fiori freestyle application config
|
|
6
|
+
*/
|
|
7
|
+
export declare function setVirtualEndpointDefaults(ffApp: FreestyleApp<unknown>): void;
|
|
2
8
|
/**
|
|
3
9
|
* Set defaults for missing parameters on the given instance of the overall config.
|
|
4
10
|
* Adds source template info.
|
package/dist/defaults.js
CHANGED
|
@@ -4,10 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.escapeFLPText = void 0;
|
|
7
|
+
exports.setVirtualEndpointDefaults = setVirtualEndpointDefaults;
|
|
7
8
|
exports.setDefaults = setDefaults;
|
|
8
9
|
const read_pkg_up_1 = __importDefault(require("read-pkg-up"));
|
|
9
10
|
const types_1 = require("./types");
|
|
10
11
|
const utils_1 = require("./utils");
|
|
12
|
+
const defaultVirtualPreviewFile = 'test/flp.html'; // Default virtual preview file name
|
|
13
|
+
const defaultIntent = 'app-preview';
|
|
11
14
|
/**
|
|
12
15
|
* Set defaults for missing parameters on the given Fiori/UI5 app instance.
|
|
13
16
|
*
|
|
@@ -25,6 +28,16 @@ function setAppDefaults(app) {
|
|
|
25
28
|
function setBasicTemplateDefaults(settings) {
|
|
26
29
|
settings.viewName = settings.viewName || 'View1';
|
|
27
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Sets defaults for relevant parameters (`flpAppId`, `startFile`, `localStartFile`, ) when virtual endpoints are used.
|
|
33
|
+
*
|
|
34
|
+
* @param ffApp - Fiori freestyle application config
|
|
35
|
+
*/
|
|
36
|
+
function setVirtualEndpointDefaults(ffApp) {
|
|
37
|
+
ffApp.app.flpAppId = defaultIntent;
|
|
38
|
+
ffApp.app.localStartFile = defaultVirtualPreviewFile;
|
|
39
|
+
ffApp.app.startFile = defaultVirtualPreviewFile;
|
|
40
|
+
}
|
|
28
41
|
/**
|
|
29
42
|
* Set defaults for missing parameters on the given instance of the overall config.
|
|
30
43
|
* Adds source template info.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Editor } from 'mem-fs-editor';
|
|
2
1
|
import { FreestyleApp } from './types';
|
|
3
2
|
import type { Logger } from '@sap-ux/logger';
|
|
3
|
+
import type { Editor } from 'mem-fs-editor';
|
|
4
4
|
/**
|
|
5
5
|
* Generate a UI5 application based on the specified Fiori Freestyle floorplan template.
|
|
6
6
|
*
|
package/dist/index.js
CHANGED
|
@@ -39,7 +39,11 @@ async function generate(basePath, data, fs, log) {
|
|
|
39
39
|
fs = await (0, ui5_application_writer_1.generate)(basePath, ffApp, fs);
|
|
40
40
|
// add new and overwrite files from templates e.g.
|
|
41
41
|
const tmplPath = (0, path_1.join)(__dirname, '..', 'templates');
|
|
42
|
-
const ignore = [
|
|
42
|
+
const ignore = [
|
|
43
|
+
isTypeScriptEnabled ? '**/*.js' : '**/*.ts',
|
|
44
|
+
// if using virtual endpoints for preview, do not add the flpSandbox.html file
|
|
45
|
+
...(ffApp.appOptions?.useVirtualPreviewEndpoints ? ['**/webapp/test/flpSandbox.html'] : [])
|
|
46
|
+
];
|
|
43
47
|
// Determine if the project type is 'EDMXBackend'.
|
|
44
48
|
const isEdmxProjectType = ffApp.app.projectType === 'EDMXBackend';
|
|
45
49
|
// Get the resource URLs for the UShell bootstrap and UI bootstrap based on the project type and UI5 framework details
|
|
@@ -85,6 +89,9 @@ async function generate(basePath, data, fs, log) {
|
|
|
85
89
|
fs.extendJSON(packagePath, JSON.parse((0, ejs_1.render)(fs.read((0, path_1.join)(tmplPath, 'common', 'extend', 'package.json')), ffApp, {})));
|
|
86
90
|
const addTests = ffApp.appOptions?.addTests;
|
|
87
91
|
const packageJson = JSON.parse(fs.read(packagePath));
|
|
92
|
+
if (ffApp.appOptions?.useVirtualPreviewEndpoints) {
|
|
93
|
+
(0, defaults_1.setVirtualEndpointDefaults)(ffApp);
|
|
94
|
+
}
|
|
88
95
|
if (isEdmxProjectType) {
|
|
89
96
|
const addMock = !!ffApp.service?.metadata;
|
|
90
97
|
// Add scripts for non-CAP applications
|
|
@@ -95,10 +102,11 @@ async function generate(basePath, data, fs, log) {
|
|
|
95
102
|
addMock,
|
|
96
103
|
sapClient: ffApp.service?.client,
|
|
97
104
|
flpAppId: ffApp.app.flpAppId,
|
|
98
|
-
startFile:
|
|
99
|
-
localStartFile:
|
|
105
|
+
startFile: ffApp.app?.startFile,
|
|
106
|
+
localStartFile: ffApp.app?.localStartFile,
|
|
100
107
|
generateIndex: ffApp.appOptions?.generateIndex,
|
|
101
|
-
addTest: addTests && ffApp.template.type === types_1.TemplateType.Basic
|
|
108
|
+
addTest: addTests && ffApp.template.type === types_1.TemplateType.Basic,
|
|
109
|
+
supportVirtualEndpoints: ffApp.appOptions?.useVirtualPreviewEndpoints // no need for search params if virtual endpoints are used
|
|
102
110
|
})
|
|
103
111
|
};
|
|
104
112
|
if (addTests) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/fiori-freestyle-writer",
|
|
3
3
|
"description": "SAP Fiori freestyle application writer",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.3.1",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
"mem-fs-editor": "9.4.0",
|
|
28
28
|
"read-pkg-up": "7.0.1",
|
|
29
29
|
"semver": "7.5.4",
|
|
30
|
-
"@sap-ux/odata-service-writer": "0.26.
|
|
31
|
-
"@sap-ux/ui5-application-writer": "1.
|
|
32
|
-
"@sap-ux/ui5-config": "0.
|
|
33
|
-
"@sap-ux/fiori-generator-shared": "0.
|
|
34
|
-
"@sap-ux/cap-config-writer": "0.9.
|
|
35
|
-
"@sap-ux/ui5-test-writer": "0.6.
|
|
30
|
+
"@sap-ux/odata-service-writer": "0.26.15",
|
|
31
|
+
"@sap-ux/ui5-application-writer": "1.4.1",
|
|
32
|
+
"@sap-ux/ui5-config": "0.27.1",
|
|
33
|
+
"@sap-ux/fiori-generator-shared": "0.11.1",
|
|
34
|
+
"@sap-ux/cap-config-writer": "0.9.27",
|
|
35
|
+
"@sap-ux/ui5-test-writer": "0.6.5",
|
|
36
36
|
"@sap-ux/logger": "0.6.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|