@sap-ux/fiori-elements-writer 2.2.0 → 2.3.0

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.
@@ -2,6 +2,12 @@ import { OdataVersion } from '@sap-ux/odata-service-writer';
2
2
  import type { FioriElementsApp, Template } from '../types';
3
3
  import { TemplateType } from '../types';
4
4
  import { type TemplateOptions } from './templateAttributes';
5
+ /**
6
+ * Sets defaults for relevant parameters (`flpAppId`, `startFile`, `localStartFile`, ) when virtual endpoints are used.
7
+ *
8
+ * @param feApp - Fiori elements application config
9
+ */
10
+ export declare function setVirtualEndpointDefaults(feApp: FioriElementsApp<unknown>): void;
5
11
  /**
6
12
  * Updates the template settings to defaults if not provided.
7
13
  *
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.setVirtualEndpointDefaults = setVirtualEndpointDefaults;
6
7
  exports.setDefaultTemplateSettings = setDefaultTemplateSettings;
7
8
  exports.getUi5Libs = getUi5Libs;
8
9
  exports.getManifestLibs = getManifestLibs;
@@ -15,6 +16,18 @@ const templateAttributes_1 = require("./templateAttributes");
15
16
  const annotationCustomUi5Libs_1 = require("./annotationCustomUi5Libs");
16
17
  const semver_1 = __importDefault(require("semver"));
17
18
  const defaultModelName = 'mainModel'; // UI5 default model name is '' but some floorplans require a named default model
19
+ const defaultVirtualPreviewFile = 'test/flp.html'; // Default virtual preview file name
20
+ const defaultIntent = 'app-preview';
21
+ /**
22
+ * Sets defaults for relevant parameters (`flpAppId`, `startFile`, `localStartFile`, ) when virtual endpoints are used.
23
+ *
24
+ * @param feApp - Fiori elements application config
25
+ */
26
+ function setVirtualEndpointDefaults(feApp) {
27
+ feApp.app.flpAppId = defaultIntent;
28
+ feApp.app.startFile = defaultVirtualPreviewFile;
29
+ feApp.app.localStartFile = defaultVirtualPreviewFile;
30
+ }
18
31
  /**
19
32
  * Updates the template settings to defaults if not provided.
20
33
  *
package/dist/index.js CHANGED
@@ -95,10 +95,14 @@ async function generate(basePath, data, fs, log) {
95
95
  // Add new files from templates e.g.
96
96
  const rootTemplatesPath = (0, path_1.join)(__dirname, '..', 'templates');
97
97
  // Add templates common to all template types
98
- const jsIgnoreGlob = ['**/*.ts'];
99
- let ignore = jsIgnoreGlob;
100
- if (feApp.appOptions?.typescript === true) {
101
- ignore = getTypeScriptIgnoreGlob(feApp, coercedUI5Version);
98
+ const isTypeScriptEnabled = feApp.appOptions?.typescript === true;
99
+ const ignore = [
100
+ ...(isTypeScriptEnabled ? getTypeScriptIgnoreGlob(feApp, coercedUI5Version) : ['**/*.ts']),
101
+ // if using virtual endpoints for preview, ignore the files within webapp/test (flpSandbox.html, changes_loader (v2), changes_preview (v2))
102
+ ...(feApp.appOptions?.useVirtualPreviewEndpoints ? ['**/webapp/test/**'] : [])
103
+ ];
104
+ if (feApp.appOptions?.useVirtualPreviewEndpoints) {
105
+ (0, defaults_1.setVirtualEndpointDefaults)(feApp);
102
106
  }
103
107
  // Determine if the project type is 'EDMXBackend'.
104
108
  const isEdmxProjectType = feApp.app.projectType === 'EDMXBackend';
@@ -157,11 +161,11 @@ async function generate(basePath, data, fs, log) {
157
161
  localOnly: !feApp.service?.url,
158
162
  addMock: !!feApp.service?.metadata,
159
163
  addTest,
160
- sapClient: feApp.service?.client,
161
164
  flpAppId: feApp.app.flpAppId,
162
- startFile: data?.app?.startFile,
163
- localStartFile: data?.app?.localStartFile,
164
- generateIndex: feApp.appOptions?.generateIndex
165
+ startFile: feApp.app?.startFile,
166
+ localStartFile: feApp.app?.localStartFile,
167
+ generateIndex: feApp.appOptions?.generateIndex,
168
+ supportVirtualEndpoints: feApp.appOptions?.useVirtualPreviewEndpoints // no need for search params if virtual endpoints are used
165
169
  })
166
170
  });
167
171
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/fiori-elements-writer",
3
3
  "description": "SAP Fiori elements application writer",
4
- "version": "2.2.0",
4
+ "version": "2.3.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -27,14 +27,14 @@
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.13",
31
- "@sap-ux/ui5-application-writer": "1.3.3",
32
- "@sap-ux/fe-fpm-writer": "0.33.22",
33
- "@sap-ux/ui5-config": "0.26.5",
34
- "@sap-ux/ui5-test-writer": "0.6.3",
35
- "@sap-ux/fiori-generator-shared": "0.10.2",
36
- "@sap-ux/cap-config-writer": "0.9.25",
37
- "@sap-ux/annotation-generator": "0.3.24",
30
+ "@sap-ux/odata-service-writer": "0.26.14",
31
+ "@sap-ux/ui5-application-writer": "1.4.0",
32
+ "@sap-ux/fe-fpm-writer": "0.33.23",
33
+ "@sap-ux/ui5-config": "0.27.0",
34
+ "@sap-ux/ui5-test-writer": "0.6.4",
35
+ "@sap-ux/fiori-generator-shared": "0.11.0",
36
+ "@sap-ux/cap-config-writer": "0.9.26",
37
+ "@sap-ux/annotation-generator": "0.3.25",
38
38
  "@sap-ux/logger": "0.6.0"
39
39
  },
40
40
  "devDependencies": {