@sap-ux/fiori-elements-writer 0.9.0 → 0.9.2

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 CHANGED
@@ -1,6 +1,7 @@
1
1
  import type { Editor } from 'mem-fs-editor';
2
2
  import type { App } from '@sap-ux/ui5-application-writer';
3
3
  import type { FioriElementsApp } from './types';
4
+ export declare const V2_FE_TYPES_AVAILABLE = "1.108.0";
4
5
  /**
5
6
  * Generate a UI5 application based on the specified Fiori Elements floorplan template.
6
7
  *
package/dist/index.js CHANGED
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.generate = void 0;
29
+ exports.generate = exports.V2_FE_TYPES_AVAILABLE = void 0;
30
30
  const path_1 = require("path");
31
31
  const ejs_1 = require("ejs");
32
32
  const fe_fpm_writer_1 = require("@sap-ux/fe-fpm-writer");
@@ -41,6 +41,36 @@ const defaults_1 = require("./data/defaults");
41
41
  const templateAttributes_1 = require("./data/templateAttributes");
42
42
  const manifestSettings_1 = require("./data/manifestSettings");
43
43
  const semver_1 = __importDefault(require("semver"));
44
+ exports.V2_FE_TYPES_AVAILABLE = '1.108.0';
45
+ /**
46
+ * Get TypeScript Ignore Glob Pattern.
47
+ *
48
+ * @param feApp to generate the Fiori elements application
49
+ * @param coercedUI5Version
50
+ * @returns ignore pattern
51
+ */
52
+ function getTypeScriptIgnoreGlob(feApp, coercedUI5Version) {
53
+ var _a;
54
+ let ignore = [];
55
+ // isV2FETypesAvailable - Boolean to indicate if V2 Fiori Element types were available in the UI5 version
56
+ const isV2FETypesAvailable = ((_a = feApp.ui5) === null || _a === void 0 ? void 0 : _a.version) ? semver_1.default.gte(coercedUI5Version, exports.V2_FE_TYPES_AVAILABLE) : false;
57
+ const tsIgnoreGlob = ['**/*.js'];
58
+ ignore = tsIgnoreGlob;
59
+ // Add local ui5.d.ts if types are missing in UI5 version for V2 Odata services
60
+ // OR template is OVP
61
+ if (feApp.service.version === odata_service_writer_1.OdataVersion.v2) {
62
+ if (isV2FETypesAvailable) {
63
+ ignore.push('**/ui5.d.ts');
64
+ }
65
+ else {
66
+ // do nothing
67
+ }
68
+ }
69
+ else if (feApp.template.type !== types_1.TemplateType.OverviewPage) {
70
+ ignore.push('**/ui5.d.ts');
71
+ }
72
+ return ignore;
73
+ }
44
74
  /**
45
75
  * Generate a UI5 application based on the specified Fiori Elements floorplan template.
46
76
  *
@@ -62,17 +92,19 @@ function generate(basePath, data, fs) {
62
92
  // This is done after `generateUi5Project` since defaults are set if values are not provided
63
93
  (0, validate_1.validateApp)(feApp);
64
94
  yield (0, odata_service_writer_1.generate)(basePath, feApp.service, fs);
95
+ const coercedUI5Version = semver_1.default.coerce((_a = feApp.ui5) === null || _a === void 0 ? void 0 : _a.version);
65
96
  const templateOptions = {
66
- changesPreview: ((_a = feApp.ui5) === null || _a === void 0 ? void 0 : _a.version)
67
- ? semver_1.default.lt(semver_1.default.coerce((_b = feApp.ui5) === null || _b === void 0 ? void 0 : _b.version), templateAttributes_1.changesPreviewToVersion)
68
- : false,
97
+ changesPreview: ((_b = feApp.ui5) === null || _b === void 0 ? void 0 : _b.version) ? semver_1.default.lt(coercedUI5Version, templateAttributes_1.changesPreviewToVersion) : false,
69
98
  changesLoader: feApp.service.version === odata_service_writer_1.OdataVersion.v2
70
99
  };
71
100
  // Add new files from templates e.g.
72
101
  const rootTemplatesPath = (0, path_1.join)(__dirname, '..', 'templates');
73
102
  // Add templates common to all template types
74
- // Common files
75
- const ignore = [((_c = feApp.appOptions) === null || _c === void 0 ? void 0 : _c.typescript) ? '**/*.js' : '**/*.ts'];
103
+ const jsIgnoreGlob = ['**/*.ts'];
104
+ let ignore = jsIgnoreGlob;
105
+ if (((_c = feApp.appOptions) === null || _c === void 0 ? void 0 : _c.typescript) === true) {
106
+ ignore = getTypeScriptIgnoreGlob(feApp, coercedUI5Version);
107
+ }
76
108
  fs.copyTpl((0, path_1.join)(rootTemplatesPath, 'common', 'add', '**/*.*'), basePath, Object.assign(Object.assign({}, feApp), { templateOptions,
77
109
  escapeFLPText: templateAttributes_1.escapeFLPText }), undefined, {
78
110
  globOptions: { ignore, dot: true }
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": "0.9.0",
4
+ "version": "0.9.2",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -21,7 +21,7 @@
21
21
  ],
22
22
  "dependencies": {
23
23
  "@sap-ux/odata-service-writer": "0.14.19",
24
- "@sap-ux/ui5-application-writer": "0.19.0",
24
+ "@sap-ux/ui5-application-writer": "0.19.2",
25
25
  "@sap-ux/fe-fpm-writer": "0.18.7",
26
26
  "@sap-ux/ui5-config": "0.16.5",
27
27
  "@sap-ux/ui5-test-writer": "0.1.7",
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Declaring the required interface of AppComponent that is currently missing in the UI5 types
3
+ */
4
+ declare module "<%- app.baseComponent %>" {
5
+ export default class AppComponent { }
6
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Declaring the required interface of AppComponent that is currently missing in the UI5 types
3
+ */
4
+ declare module "<%- app.baseComponent %>" {
5
+ export default class AppComponent { }
6
+ }