@sap-ux/odata-service-writer 0.17.2 → 0.18.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.
- package/dist/updates.js +17 -2
- package/package.json +1 -1
- package/templates/extend/manifest.json +2 -0
package/dist/updates.js
CHANGED
|
@@ -17,7 +17,7 @@ const semver_1 = __importDefault(require("semver"));
|
|
|
17
17
|
* @param templateRoot - root folder contain the ejs templates
|
|
18
18
|
*/
|
|
19
19
|
function updateManifest(basePath, service, fs, templateRoot) {
|
|
20
|
-
var _a;
|
|
20
|
+
var _a, _b, _c;
|
|
21
21
|
// manifest.json
|
|
22
22
|
const manifestPath = (0, path_1.join)(basePath, 'webapp', 'manifest.json');
|
|
23
23
|
// Get component app id
|
|
@@ -29,11 +29,26 @@ function updateManifest(basePath, service, fs, templateRoot) {
|
|
|
29
29
|
throw new Error((0, i18n_1.t)('error.requiredProjectPropertyNotFound', { property: `'${appProp}'.id`, path: manifestPath }));
|
|
30
30
|
}
|
|
31
31
|
const manifestJsonExt = fs.read((0, path_1.join)(templateRoot, 'extend', `manifest.json`));
|
|
32
|
+
const minUI5Version = (_c = (_b = manifest['sap.ui5']) === null || _b === void 0 ? void 0 : _b.dependencies) === null || _c === void 0 ? void 0 : _c.minUI5Version;
|
|
33
|
+
const manifestSettings = Object.assign(service, getModelSettings(minUI5Version));
|
|
32
34
|
// If the service object includes ejs options, for example 'client' (see: https://ejs.co/#docs),
|
|
33
35
|
// resulting in unexpected behaviour and problems when webpacking. Passing an empty options object prevents this.
|
|
34
|
-
fs.extendJSON(manifestPath, JSON.parse((0, ejs_1.render)(manifestJsonExt,
|
|
36
|
+
fs.extendJSON(manifestPath, JSON.parse((0, ejs_1.render)(manifestJsonExt, manifestSettings, {})));
|
|
35
37
|
}
|
|
36
38
|
exports.updateManifest = updateManifest;
|
|
39
|
+
/**
|
|
40
|
+
* Determines model settings based on the UI5 version.
|
|
41
|
+
*
|
|
42
|
+
* @param minUI5Version - The minimum UI5 version.
|
|
43
|
+
* @returns updated model settings.
|
|
44
|
+
*/
|
|
45
|
+
function getModelSettings(minUI5Version) {
|
|
46
|
+
let includeSynchronizationMode = false;
|
|
47
|
+
if (minUI5Version && semver_1.default.valid(minUI5Version)) {
|
|
48
|
+
includeSynchronizationMode = semver_1.default.satisfies(minUI5Version, '<=1.110');
|
|
49
|
+
}
|
|
50
|
+
return { includeSynchronizationMode };
|
|
51
|
+
}
|
|
37
52
|
/**
|
|
38
53
|
* Update the package.json with the required middlewares.
|
|
39
54
|
*
|
package/package.json
CHANGED
|
@@ -36,7 +36,9 @@
|
|
|
36
36
|
"dataSource": "<%=name%>",
|
|
37
37
|
"preload": true,
|
|
38
38
|
"settings": {<%if (version === '4') {%>
|
|
39
|
+
<% if (locals.includeSynchronizationMode) { %>
|
|
39
40
|
"synchronizationMode": "None",
|
|
41
|
+
<% } %>
|
|
40
42
|
"operationMode": "Server",
|
|
41
43
|
"autoExpandSelect": true,
|
|
42
44
|
"earlyRequests": true<% } %>
|