@sap-ux/ui5-application-writer 0.17.7 → 0.17.9

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.
@@ -1,4 +1,4 @@
1
- import type { App, Package, UI5 } from '../types';
1
+ import type { App, AppOptions, Package, UI5 } from '../types';
2
2
  /**
3
3
  * Returns a package instance with default properties.
4
4
  *
@@ -26,7 +26,8 @@ export declare const enum UI5_DEFAULT {
26
26
  OPENUI5_CDN = "https://openui5.hana.ondemand.com",
27
27
  TYPES_VERSION_SINCE = "1.76.0",
28
28
  TYPES_VERSION_PREVIOUS = "1.71.18",
29
- TYPES_VERSION_BEST = "1.102.7",
29
+ TYPES_VERSION_BEST = "1.102.9",
30
+ ESM_TYPES_VERSION_SINCE = "1.90.0",
30
31
  MANIFEST_VERSION = "1.12.0",
31
32
  BASE_COMPONENT = "sap/ui/core/UIComponent"
32
33
  }
@@ -43,17 +44,25 @@ export declare const defaultUI5Libs: string[];
43
44
  * Coerces provided UI5 versions to valid semantic versions.
44
45
  *
45
46
  * @param {UI5} [ui5] - the UI5 instance
47
+ * @param options - application options
46
48
  * @returns {UI5} the updated copy of UI5 instance (does not change `ui5`)
47
49
  */
48
- export declare function mergeUi5(ui5: Partial<UI5>): UI5;
50
+ export declare function mergeUi5(ui5: Partial<UI5>, options?: Partial<AppOptions>): UI5;
49
51
  /**
50
- * Get the best types version for the given minUI5Version.
51
- * For the latest versions the LTS S/4 on-premise version (1.102.x) is used, for anything before we match the versions as far back as available.
52
+ * Get the best types version for the given minUI5Version for https://www.npmjs.com/package/@sapui5/ts-types where specific versions are missing.
52
53
  *
53
- * @param minUI5Version the mininum UI5 version that needs to be supported
54
+ * @param minUI5Version the minimum UI5 version that needs to be supported
54
55
  * @returns semantic version representing the types version.
55
56
  */
56
57
  export declare function getTypesVersion(minUI5Version?: string): string;
58
+ /**
59
+ * Get the best types version for the given minUI5Version within a selective range, starting at 1.90.0 for https://www.npmjs.com/package/@sapui5/ts-types-esm
60
+ * For the latest versions the LTS S/4 on-premise version (1.102.x) is used, for anything before we match the versions as far back as available.
61
+ *
62
+ * @param minUI5Version the minimum UI5 version that needs to be supported
63
+ * @returns semantic version representing the types version.
64
+ */
65
+ export declare function getEsmTypesVersion(minUI5Version?: string): string;
57
66
  /**
58
67
  * Retrieve the tag version of the @sap/ux-specification based on the given version.
59
68
  *
@@ -3,7 +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.getSpecTagVersion = exports.getTypesVersion = exports.mergeUi5 = exports.defaultUI5Libs = exports.mergeApp = exports.mergeObjects = exports.packageDefaults = void 0;
6
+ exports.getSpecTagVersion = exports.getEsmTypesVersion = exports.getTypesVersion = exports.mergeUi5 = exports.defaultUI5Libs = exports.mergeApp = exports.mergeObjects = exports.packageDefaults = void 0;
7
7
  const version_to_descriptor_mapping_json_1 = __importDefault(require("./version-to-descriptor-mapping.json")); // from https://github.com/SAP/ui5-manifest/blob/master/mapping.json
8
8
  const ui5Libs_1 = require("./ui5Libs");
9
9
  const semver_1 = __importDefault(require("semver"));
@@ -83,9 +83,10 @@ exports.defaultUI5Libs = ['sap.m', 'sap.ui.core'];
83
83
  * Coerces provided UI5 versions to valid semantic versions.
84
84
  *
85
85
  * @param {UI5} [ui5] - the UI5 instance
86
+ * @param options - application options
86
87
  * @returns {UI5} the updated copy of UI5 instance (does not change `ui5`)
87
88
  */
88
- function mergeUi5(ui5) {
89
+ function mergeUi5(ui5, options) {
89
90
  var _a, _b, _c, _d, _e;
90
91
  const version = (_a = ui5.version) !== null && _a !== void 0 ? _a : "" /* DEFAULT_UI5_VERSION */; // Undefined or null indicates the latest available should be used
91
92
  const framework = (_b = ui5.framework) !== null && _b !== void 0 ? _b : 'SAPUI5';
@@ -98,26 +99,26 @@ function mergeUi5(ui5) {
98
99
  frameworkUrl: (_c = ui5.frameworkUrl) !== null && _c !== void 0 ? _c : defaultFrameworkUrl
99
100
  };
100
101
  merged.descriptorVersion = getManifestVersion(merged.minUI5Version, ui5.descriptorVersion);
101
- merged.typesVersion = (_d = ui5.typesVersion) !== null && _d !== void 0 ? _d : getTypesVersion(merged.minUI5Version);
102
+ merged.typesVersion =
103
+ (_d = ui5.typesVersion) !== null && _d !== void 0 ? _d : ((options === null || options === void 0 ? void 0 : options.typescript) ? getEsmTypesVersion : getTypesVersion)(merged.minUI5Version);
102
104
  merged.ui5Theme = (_e = ui5.ui5Theme) !== null && _e !== void 0 ? _e : 'sap_fiori_3';
103
105
  merged.ui5Libs = ui5Libs_1.getUI5Libs(ui5.ui5Libs);
104
106
  return Object.assign({}, ui5, merged);
105
107
  }
106
108
  exports.mergeUi5 = mergeUi5;
107
109
  /**
108
- * Get the best types version for the given minUI5Version.
109
- * For the latest versions the LTS S/4 on-premise version (1.102.x) is used, for anything before we match the versions as far back as available.
110
+ * Get the best types version for the given minUI5Version for https://www.npmjs.com/package/@sapui5/ts-types where specific versions are missing.
110
111
  *
111
- * @param minUI5Version the mininum UI5 version that needs to be supported
112
+ * @param minUI5Version the minimum UI5 version that needs to be supported
112
113
  * @returns semantic version representing the types version.
113
114
  */
114
115
  function getTypesVersion(minUI5Version) {
115
116
  const version = semver_1.default.coerce(minUI5Version);
116
117
  if (!version) {
117
- return `~${"1.102.7" /* TYPES_VERSION_BEST */}`;
118
+ return `~${"1.102.9" /* TYPES_VERSION_BEST */}`;
118
119
  }
119
- else if (semver_1.default.gte(version, "1.102.7" /* TYPES_VERSION_BEST */)) {
120
- return `~${"1.102.7" /* TYPES_VERSION_BEST */}`;
120
+ else if (semver_1.default.gte(version, "1.102.9" /* TYPES_VERSION_BEST */)) {
121
+ return `~${"1.102.9" /* TYPES_VERSION_BEST */}`;
121
122
  }
122
123
  else {
123
124
  return semver_1.default.gte(version, "1.76.0" /* TYPES_VERSION_SINCE */)
@@ -126,6 +127,25 @@ function getTypesVersion(minUI5Version) {
126
127
  }
127
128
  }
128
129
  exports.getTypesVersion = getTypesVersion;
130
+ /**
131
+ * Get the best types version for the given minUI5Version within a selective range, starting at 1.90.0 for https://www.npmjs.com/package/@sapui5/ts-types-esm
132
+ * For the latest versions the LTS S/4 on-premise version (1.102.x) is used, for anything before we match the versions as far back as available.
133
+ *
134
+ * @param minUI5Version the minimum UI5 version that needs to be supported
135
+ * @returns semantic version representing the types version.
136
+ */
137
+ function getEsmTypesVersion(minUI5Version) {
138
+ const version = semver_1.default.coerce(minUI5Version);
139
+ if (!version || semver_1.default.gte(version, "1.102.9" /* TYPES_VERSION_BEST */)) {
140
+ return `~${"1.102.9" /* TYPES_VERSION_BEST */}`;
141
+ }
142
+ else {
143
+ return semver_1.default.gte(version, "1.90.0" /* ESM_TYPES_VERSION_SINCE */)
144
+ ? `~${semver_1.default.major(version)}.${semver_1.default.minor(version)}.0`
145
+ : `~${"1.90.0" /* ESM_TYPES_VERSION_SINCE */}`;
146
+ }
147
+ }
148
+ exports.getEsmTypesVersion = getEsmTypesVersion;
129
149
  /**
130
150
  * Gets the miminum UI5 version based on the specified version.
131
151
  *
@@ -14,7 +14,7 @@ function mergeWithDefaults(ui5App) {
14
14
  validators_1.validate(ui5App);
15
15
  ui5App.app = defaults_1.mergeApp(ui5App.app);
16
16
  ui5App.appOptions = ui5App.appOptions || {};
17
- ui5App.ui5 = defaults_1.mergeUi5(ui5App.ui5 || {});
17
+ ui5App.ui5 = defaults_1.mergeUi5(ui5App.ui5 || {}, ui5App.appOptions);
18
18
  ui5App.package = defaults_1.mergeObjects(defaults_1.packageDefaults(ui5App.package.version, ui5App.app.description), ui5App.package);
19
19
  if (ui5App.appOptions.sapux) {
20
20
  ui5App.package.devDependencies = ui5App.package.devDependencies || {};
package/dist/index.js CHANGED
@@ -113,7 +113,7 @@ function enableTypescript(basePath, fs) {
113
113
  const ui5App = {
114
114
  app: manifest['sap.app'],
115
115
  ui5: {
116
- typesVersion: defaults_1.getTypesVersion((_b = (_a = manifest['sap.ui5']) === null || _a === void 0 ? void 0 : _a.dependencies) === null || _b === void 0 ? void 0 : _b.minUI5Version)
116
+ typesVersion: defaults_1.getEsmTypesVersion((_b = (_a = manifest['sap.ui5']) === null || _a === void 0 ? void 0 : _a.dependencies) === null || _b === void 0 ? void 0 : _b.minUI5Version)
117
117
  }
118
118
  };
119
119
  options_1.enableTypescript({ basePath, fs, ui5Configs: [ui5Config], tmplPath, ui5App }, true);
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "bugs": {
10
10
  "url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Aui5-application-writer"
11
11
  },
12
- "version": "0.17.7",
12
+ "version": "0.17.9",
13
13
  "license": "Apache-2.0",
14
14
  "main": "dist/index.js",
15
15
  "files": [
@@ -20,7 +20,7 @@
20
20
  "!dist/**/*.map"
21
21
  ],
22
22
  "dependencies": {
23
- "@sap-ux/ui5-config": "0.15.3",
23
+ "@sap-ux/ui5-config": "0.15.4",
24
24
  "ejs": "3.1.7",
25
25
  "i18next": "21.6.11",
26
26
  "lodash": "4.17.21",
@@ -29,7 +29,7 @@
29
29
  "semver": "7.3.5"
30
30
  },
31
31
  "devDependencies": {
32
- "@sap-ux/project-access": "1.0.0",
32
+ "@sap-ux/project-access": "1.0.1",
33
33
  "@types/ejs": "3.1.0",
34
34
  "@types/fs-extra": "9.0.13",
35
35
  "@types/lodash": "4.14.176",