@sap-ux/fe-fpm-writer 0.25.0 → 0.25.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.
Files changed (2) hide show
  1. package/dist/app/index.js +43 -11
  2. package/package.json +2 -2
package/dist/app/index.js CHANGED
@@ -5,10 +5,51 @@ const mem_fs_1 = require("mem-fs");
5
5
  const mem_fs_editor_1 = require("mem-fs-editor");
6
6
  const path_1 = require("path");
7
7
  const semver_1 = require("semver");
8
+ const project_access_1 = require("@sap-ux/project-access");
8
9
  const defaults_1 = require("../common/defaults");
9
10
  const templates_1 = require("../templates");
10
11
  const utils_1 = require("../common/utils");
11
12
  exports.MIN_VERSION = '1.94.0';
13
+ /**
14
+ * If a minUI5Version is set and it is smaller than the minimum required, increase it.
15
+ *
16
+ * @param {Manifest} manifest - content of the mnaifest.json
17
+ * @param {Editor} fs - the mem-fs editor instance
18
+ * @param {string} manifestPath - path to the manifest.json file
19
+ */
20
+ function adaptMinUI5Version(manifest, fs, manifestPath) {
21
+ const minUI5VersionArray = (0, project_access_1.getMinUI5VersionAsArray)(manifest, true);
22
+ if (minUI5VersionArray?.length > 0) {
23
+ let update = false;
24
+ for (let index = 0; index < minUI5VersionArray.length; index++) {
25
+ const minUI5Version = minUI5VersionArray[index];
26
+ if (minUI5Version && (0, semver_1.valid)(minUI5Version) && (0, semver_1.lt)(minUI5Version, exports.MIN_VERSION)) {
27
+ minUI5VersionArray[index] = exports.MIN_VERSION;
28
+ update = true;
29
+ }
30
+ }
31
+ if (update) {
32
+ if (minUI5VersionArray.length === 1) {
33
+ fs.extendJSON(manifestPath, {
34
+ 'sap.ui5': {
35
+ dependencies: {
36
+ minUI5Version: minUI5VersionArray[0]
37
+ }
38
+ }
39
+ });
40
+ }
41
+ else if (minUI5VersionArray.length > 1) {
42
+ fs.extendJSON(manifestPath, {
43
+ 'sap.ui5': {
44
+ dependencies: {
45
+ minUI5Version: minUI5VersionArray
46
+ }
47
+ }
48
+ });
49
+ }
50
+ }
51
+ }
52
+ }
12
53
  /**
13
54
  * Enable the flexible programming model for an application.
14
55
  *
@@ -39,19 +80,10 @@ function enableFPM(basePath, config = {}, fs) {
39
80
  });
40
81
  }
41
82
  // if a minUI5Version is set and it is smaller than the minimum required, increase it
42
- const minUI5Version = manifest['sap.ui5']?.dependencies?.minUI5Version;
43
- if (minUI5Version && (0, semver_1.valid)(minUI5Version) && (0, semver_1.lt)(minUI5Version, exports.MIN_VERSION)) {
44
- fs.extendJSON(manifestPath, {
45
- 'sap.ui5': {
46
- dependencies: {
47
- minUI5Version: exports.MIN_VERSION
48
- }
49
- }
50
- });
51
- }
83
+ adaptMinUI5Version(manifest, fs, manifestPath);
52
84
  // add type extensions if required
53
85
  if (config.typescript) {
54
- (0, utils_1.addExtensionTypes)(basePath, manifest['sap.ui5']?.dependencies.minUI5Version, fs);
86
+ (0, utils_1.addExtensionTypes)(basePath, (0, project_access_1.getMinimumUI5Version)(manifest), fs);
55
87
  }
56
88
  // enable FCL if requested
57
89
  if (config.fcl) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/fe-fpm-writer",
3
3
  "description": "SAP Fiori elements flexible programming model writer",
4
- "version": "0.25.0",
4
+ "version": "0.25.1",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -33,7 +33,7 @@
33
33
  "@types/mem-fs": "1.1.2",
34
34
  "@types/mem-fs-editor": "7.0.1",
35
35
  "@types/semver": "7.5.2",
36
- "@sap-ux/project-access": "1.23.0"
36
+ "@sap-ux/project-access": "1.25.7"
37
37
  },
38
38
  "engines": {
39
39
  "node": ">=18.x"