@ui5/task-adaptation 1.0.11 → 1.0.13

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/CHANGELOG.md CHANGED
@@ -2,7 +2,10 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
  This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
4
4
 
5
- A list of unreleased changes can be found [here](https://github.com/SAP/ui5-task-adaptation/compare/v1.0.11...HEAD).
5
+ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-task-adaptation/compare/v1.0.13...HEAD).
6
+
7
+ <a name="v1.0.13"></a>
8
+ ## [v1.0.13] - 2022-11-22
6
9
 
7
10
  <a name="v1.0.11"></a>
8
11
  ## [v1.0.11] - 2022-03-01
@@ -43,6 +46,7 @@ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-task
43
46
  <a name="v1.0.0"></a>
44
47
  ## v1.0.0 - 2020-12-09
45
48
 
49
+ [v1.0.13]: https://github.com/SAP/ui5-task-adaptation/compare/v1.0.11...v1.0.13
46
50
  [v1.0.11]: https://github.com/SAP/ui5-task-adaptation/compare/v1.0.10...v1.0.11
47
51
  [v1.0.10]: https://github.com/SAP/ui5-task-adaptation/compare/v1.0.9...v1.0.10
48
52
  [v1.0.9]: https://github.com/SAP/ui5-task-adaptation/compare/v1.0.8...v1.0.9
package/README.md CHANGED
@@ -1,35 +1,11 @@
1
1
  # ui5-task-adaptation
2
2
  [![REUSE status](https://api.reuse.software/badge/github.com/SAP/ui5-task-adaptation)](https://api.reuse.software/info/github.com/SAP/ui5-task-adaptation)
3
- [![Build Status](https://app.travis-ci.com/SAP/ui5-task-adaptation.svg?branch=main)](https://travis-ci.org/SAP/ui5-task-adaptation)
3
+ [![Build Status](https://app.travis-ci.com/SAP/ui5-task-adaptation.svg?branch=main)](https://app.travis-ci.com/github/SAP/ui5-task-adaptation)
4
4
  [![npm version](https://badge.fury.io/js/@ui5%2Ftask-adaptation.svg)](https://badge.fury.io/js/@ui5%2Ftask-adaptation)
5
5
 
6
6
  ## Description
7
7
  A custom task for [ui5-builder](https://github.com/SAP/ui5-builder) that allows building [UI5 Flexibility adaptation projects](https://help.sap.com/viewer/584e0bcbfd4a4aff91c815cefa0bce2d/Cloud/en-US/019b0c38a6b043d1a66b11d992eed290.html) for SAP BTP, Cloud Foundry environment.
8
8
 
9
- ## How to specify a UI5 version
10
- ui5-task-adaptation is based on the UI5 implementation. In order to use a certain UI5 version, go to a module that contains the ui5.yaml and edit the ui5.yaml specifying the desired UI5 version (1.89.0 in the example below):
11
-
12
- ```yaml
13
- ---
14
- specVersion: "2.2"
15
- type: application
16
- metadata:
17
- name: example
18
- framework:
19
- name: SAPUI5
20
- version: 1.89.0
21
- libraries:
22
- - name: sap.ui.fl
23
- - name: sap.suite.ui.generic.template
24
- ```
25
-
26
- open a terminal and execute:
27
-
28
- ```shell
29
- npm run build-ui5
30
- ```
31
-
32
-
33
9
  ## How to obtain support
34
10
  In case you need any support, please create a GitHub issue.
35
11
 
package/dist/bundle.js CHANGED
@@ -1,4 +1,4 @@
1
- //1.99.0
1
+ //1.108.0
2
2
  var window = {};
3
3
  'use strict';
4
4
 
@@ -33,7 +33,7 @@ var Change = function (oFile) {
33
33
  };
34
34
  Change.prototype.getChangeType = function () {
35
35
  if (this._oDefinition) {
36
- return this._oDefinition.changeType;
36
+ return this._oDefinition.flexObjectMetadata ? this._oDefinition.flexObjectMetadata.changeType : this._oDefinition.changeType;
37
37
  }
38
38
  };
39
39
  Change.prototype.getLayer = function () {
@@ -739,6 +739,13 @@ var DeleteCard = {
739
739
  }
740
740
  };
741
741
 
742
+ var fnAssert = function (bResult, vMessage) {
743
+ if (!bResult) {
744
+ var sMessage = typeof vMessage === "function" ? vMessage() : vMessage;
745
+ console.assert(bResult, sMessage);
746
+ }
747
+ };
748
+
742
749
  var fnNow = !(typeof window != "undefined" && window.performance && performance.now && performance.timing) ? Date.now : (function () {
743
750
  var iNavigationStart = performance.timing.navigationStart;
744
751
  return function perfnow() {
@@ -988,13 +995,6 @@ Log.getLogger = function (sComponent, iDefaultLogLevel) {
988
995
  return new Logger(sComponent);
989
996
  };
990
997
 
991
- var fnAssert = function (bResult, vMessage) {
992
- if (!bResult) {
993
- var sMessage = typeof vMessage === "function" ? vMessage() : vMessage;
994
- console.assert(bResult, sMessage);
995
- }
996
- };
997
-
998
998
  var fnUniqueSort = function (aArray) {
999
999
  fnAssert(Array.isArray(aArray), "uniqueSort: input parameter must be an Array");
1000
1000
  var iLength = aArray.length;
@@ -1352,7 +1352,8 @@ function getMethods(sClassName, oLog) {
1352
1352
  oLog.addLogListener(oListener);
1353
1353
  },
1354
1354
  getLogger: function () {
1355
- return oLog.getLogger(sFullClassName);
1355
+ var oRet = oLog.getLogger(sFullClassName);
1356
+ return oRet;
1356
1357
  }
1357
1358
  };
1358
1359
  }
@@ -1514,7 +1515,8 @@ function applyChange(manifest, change) {
1514
1515
  var targets = ((_manifest$sapUi = manifest["sap.ui5"]) === null || _manifest$sapUi === void 0 ? void 0 : (_manifest$sapUi$routi = _manifest$sapUi.routing) === null || _manifest$sapUi$routi === void 0 ? void 0 : _manifest$sapUi$routi.targets) || ({});
1515
1516
  var pageSettings;
1516
1517
  var propertyChange = changeContent === null || changeContent === void 0 ? void 0 : changeContent.entityPropertyChange;
1517
- if ((propertyChange === null || propertyChange === void 0 ? void 0 : propertyChange.operation) !== "UPSERT" || !(propertyChange !== null && propertyChange !== void 0 && propertyChange.propertyPath) || !(propertyChange !== null && propertyChange !== void 0 && propertyChange.propertyValue) || propertyChange !== null && propertyChange !== void 0 && propertyChange.propertyPath.startsWith("/")) {
1518
+ if ((propertyChange === null || propertyChange === void 0 ? void 0 : propertyChange.operation) !== "UPSERT" || !(propertyChange !== null && propertyChange !== void 0 && propertyChange.propertyPath) || (propertyChange === null || propertyChange === void 0 ? void 0 : propertyChange.propertyValue) === undefined || propertyChange !== null && propertyChange !== void 0 && propertyChange.propertyPath.startsWith("/")) {
1519
+ Log.error("Change content is not a valid");
1518
1520
  return manifest;
1519
1521
  }
1520
1522
  for (var p in targets) {
@@ -1528,6 +1530,7 @@ function applyChange(manifest, change) {
1528
1530
  }
1529
1531
  }
1530
1532
  if (!pageSettings) {
1533
+ Log.error(("No Fiori elements page with ID ").concat(pageID, " found in routing targets."));
1531
1534
  return manifest;
1532
1535
  }
1533
1536
  var propertyPath = propertyChange.propertyPath.split("/");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/task-adaptation",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "description": "Custom task for ui5-builder which allows building UI5 Flexibility Adaptation Projects for SAP BTP, Cloud Foundry environment",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -33,7 +33,9 @@ sap.ui.define([
33
33
  */
34
34
  Change.prototype.getChangeType = function () {
35
35
  if (this._oDefinition) {
36
- return this._oDefinition.changeType;
36
+ return this._oDefinition.flexObjectMetadata
37
+ ? this._oDefinition.flexObjectMetadata.changeType
38
+ : this._oDefinition.changeType
37
39
  }
38
40
  };
39
41
 
@@ -43,7 +45,7 @@ sap.ui.define([
43
45
  *
44
46
  * @public
45
47
  */
46
- Change.prototype.getLayer = function () {
48
+ Change.prototype.getLayer = function () {
47
49
  return this._oDefinition.layer;
48
50
  };
49
51
 
@@ -0,0 +1,16 @@
1
+ /*!
2
+ * OpenUI5
3
+ * (c) Copyright 2009-2020 SAP SE or an SAP affiliate company.
4
+ * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
+ */
6
+
7
+ sap.ui.define([
8
+
9
+ ], function (
10
+
11
+ ) {
12
+ var FlexObjectFactory = function () {
13
+ };
14
+
15
+ return FlexObjectFactory;
16
+ }, true);
@@ -6,7 +6,7 @@ metadata:
6
6
  allowSapInternal: true
7
7
  framework:
8
8
  name: SAPUI5
9
- version: "1.91.0"
9
+ version: "0.0.0"
10
10
  libraries:
11
11
  - name: sap.ui.fl
12
12
  - name: sap.suite.ui.generic.template
@@ -97,8 +97,8 @@ export default function (options: any) {
97
97
  code = code
98
98
  .replace(/sap\.ui\.define/g, "define")
99
99
  .replace(/\, \/\* bExport\= \*\/ true\)/g, ")")
100
- .replace(/}, (true|false)\);$/g, "});")
101
- .replace(/}, (true|false)\);(\n\/\/# sourceMappingURL=)*/g, "});\n//# sourceMappingURL=");
100
+ .replace(/},.*(true|false)\);$/g, "});")
101
+ .replace(/},.*(true|false)\);(\n\/\/# sourceMappingURL=)*/g, "});\n//# sourceMappingURL=");
102
102
  return convertAMDtoES6(code);
103
103
  }
104
104
 
@@ -108,7 +108,7 @@ export default function (options: any) {
108
108
 
109
109
  function replaceRequireAsync(code: string) {
110
110
  const requireAsyncPattern = /requireAsync((.bind\(this, ")|(\("))+(?<url>[\/\w]*)"\)/mg;
111
- let match, defineUrls = [], defineVars = [], matches = new Map();
111
+ let match, defineUrls = new Array<string>(), defineVars = new Array<string>(), matches = new Map();
112
112
  while (match = requireAsyncPattern.exec(code)) {
113
113
  if (match.groups?.url) {
114
114
  const varaibleName = match.groups.url.split("/").pop() + crypto.randomBytes(16).toString("hex");
package/scripts/rollup.ts CHANGED
@@ -14,28 +14,30 @@ const log = require("@ui5/logger").getLogger("rollup-plugin-ui5-resolve-task-ada
14
14
  const projectPaths = [
15
15
  path.resolve(__dirname, "rollup", "project")
16
16
  ];
17
+ const LATEST_VERSION_PLACEHOLDER = "0.0.0";
17
18
 
18
19
  export default class Builder {
19
20
 
20
21
  static async getProjectInfo(projectPaths: string[]) {
21
22
  for (const cwd of projectPaths) {
22
23
  try {
23
- let options = {
24
- cwd,
25
- frameworkOptions: {
24
+ const options = <any>{
25
+ cwd
26
+ };
27
+ const version = this.validateProjectSettings(cwd);
28
+ if (version === LATEST_VERSION_PLACEHOLDER) {
29
+ options.frameworkOptions = {
26
30
  versionOverride: "latest"
27
31
  }
28
- };
29
- const project = await normalizer.generateProjectTree(options);
30
- this.validateProjectSettings(cwd);
31
- return project;
32
+ }
33
+ return normalizer.generateProjectTree(options);
32
34
  } catch (error: any) {
33
35
  log.info(`${error.message}`);
34
36
  }
35
37
  }
36
38
  }
37
39
 
38
- static validateProjectSettings(projectPath: string) {
40
+ static validateProjectSettings(projectPath: string): string {
39
41
  const FRAMEWORK_TYPES = ["OpenUI5", "SAPUI5"];
40
42
  const content = fs.readFileSync(path.join(projectPath, "ui5.yaml"), { encoding: "utf-8" });
41
43
  const yamlJson = <any>yaml.load(content);
@@ -46,6 +48,7 @@ export default class Builder {
46
48
  if (!semver.valid(framework.version)) {
47
49
  throw new Error(`UI5 framework version should correspond semantic version standard, e.g: 1.85.2`);
48
50
  }
51
+ return framework.version;
49
52
  }
50
53
 
51
54
  static getBundledUI5Version(destination: string) {
@@ -65,9 +68,9 @@ export default class Builder {
65
68
  }
66
69
  const isSapUiFl = (dependency: any) => dependency.id.endsWith("/sap.ui.fl");
67
70
  const sapUiFlDependency = project.dependencies.find(isSapUiFl);
68
- if (bundledUI5Version == null || sapUiFlDependency && semver.lt(bundledUI5Version, sapUiFlDependency.version)) {
71
+ if (bundledUI5Version == null || sapUiFlDependency && semver.neq(bundledUI5Version, sapUiFlDependency.version)) {
69
72
  if (sapUiFlDependency.version) {
70
- log.info(`[ROLLUP] New UI5 version ${sapUiFlDependency.version.toString()} available to bundle`);
73
+ log.info(`Using UI5 version ${sapUiFlDependency.version.toString()} to bundle`);
71
74
  }
72
75
  const inputOptions = <rollup.RollupOptions>{
73
76
  input: "bundleDefinition.js",
@@ -100,7 +103,7 @@ export default class Builder {
100
103
  await bundle.write(outputOptions);
101
104
  await bundle.close();
102
105
  } else {
103
- log.info(`[ROLLUP] UI5 version ${bundledUI5Version!.toString()} is already bundled`);
106
+ log.info(`UI5 version ${bundledUI5Version!.toString()} is already bundled`);
104
107
  }
105
108
 
106
109
  }