@sap-ux/adp-tooling 0.14.8 → 0.14.10

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/types.d.ts CHANGED
@@ -134,6 +134,10 @@ export interface VersionDetail {
134
134
  support: string;
135
135
  lts: boolean;
136
136
  }
137
+ export interface TypesConfig {
138
+ typesPackage: string;
139
+ typesVersion: string;
140
+ }
137
141
  export interface ResourceModel {
138
142
  key: string;
139
143
  path: string;
@@ -1,5 +1,5 @@
1
1
  import type { Editor } from 'mem-fs-editor';
2
- import type { AdpWriterConfig, CustomConfig } from '../types';
2
+ import type { AdpWriterConfig, CustomConfig, TypesConfig } from '../types';
3
3
  import type { Package } from '@sap-ux/project-access';
4
4
  import type { OperationsType } from '@sap-ux/axios-extension';
5
5
  /**
@@ -8,6 +8,17 @@ import type { OperationsType } from '@sap-ux/axios-extension';
8
8
  * @returns {Package} An object containing the `name` and `version` of the package.
9
9
  */
10
10
  export declare function getPackageJSONInfo(): Package;
11
+ /**
12
+ * Determines the correct TypeScript definitions package and version based on a given UI5 version.
13
+ *
14
+ * If the version includes `"snapshot"`, it returns a predefined default types package and version.
15
+ * Otherwise, it selects the appropriate package and computes the corresponding version using either
16
+ * `getTypesVersion` or `getEsmTypesVersion`.
17
+ *
18
+ * @param {string} [ui5Version] - The version of UI5 (e.g., `"1.108.0"` or `"snapshot"`).
19
+ * @returns {TypesConfig} - The package name and version string for the UI5 types.
20
+ */
21
+ export declare function getTypes(ui5Version?: string): TypesConfig;
11
22
  /**
12
23
  * Constructs a custom configuration object for the Adaptation Project (ADP).
13
24
  *
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getPackageJSONInfo = getPackageJSONInfo;
4
+ exports.getTypes = getTypes;
4
5
  exports.getCustomConfig = getCustomConfig;
5
6
  exports.writeTemplateToFolder = writeTemplateToFolder;
6
7
  exports.writeUI5Yaml = writeUI5Yaml;
@@ -27,6 +28,31 @@ function getPackageJSONInfo() {
27
28
  return defaultPackage;
28
29
  }
29
30
  }
31
+ /**
32
+ * Determines the correct TypeScript definitions package and version based on a given UI5 version.
33
+ *
34
+ * If the version includes `"snapshot"`, it returns a predefined default types package and version.
35
+ * Otherwise, it selects the appropriate package and computes the corresponding version using either
36
+ * `getTypesVersion` or `getEsmTypesVersion`.
37
+ *
38
+ * @param {string} [ui5Version] - The version of UI5 (e.g., `"1.108.0"` or `"snapshot"`).
39
+ * @returns {TypesConfig} - The package name and version string for the UI5 types.
40
+ */
41
+ function getTypes(ui5Version) {
42
+ if (ui5Version?.includes('snapshot')) {
43
+ return {
44
+ typesPackage: "@sapui5/types" /* UI5_DEFAULT.TYPES_PACKAGE_NAME */,
45
+ typesVersion: `~${"1.136.0" /* UI5_DEFAULT.TYPES_VERSION_BEST */}`
46
+ };
47
+ }
48
+ const typesPackage = (0, ui5_config_1.getTypesPackage)(ui5Version);
49
+ const isTypesPackage = typesPackage === "@sapui5/types" /* UI5_DEFAULT.TYPES_PACKAGE_NAME */;
50
+ const typesVersion = isTypesPackage ? (0, ui5_config_1.getTypesVersion)(ui5Version) : (0, ui5_config_1.getEsmTypesVersion)(ui5Version);
51
+ return {
52
+ typesPackage,
53
+ typesVersion
54
+ };
55
+ }
30
56
  /**
31
57
  * Constructs a custom configuration object for the Adaptation Project (ADP).
32
58
  *
@@ -58,10 +84,10 @@ function getCustomConfig(environment, { name: id, version }) {
58
84
  * @returns {void}
59
85
  */
60
86
  function writeTemplateToFolder(baseTmplPath, projectPath, data, fs) {
87
+ const ui5Version = data.ui5?.version;
61
88
  const tmplPath = (0, path_1.join)(baseTmplPath, 'project', '**/*.*');
62
89
  const tsConfigPath = (0, path_1.join)(baseTmplPath, 'typescript', 'tsconfig.json');
63
- const typesVersion = (0, ui5_config_1.getEsmTypesVersion)(data.ui5?.version);
64
- const typesPackage = (0, ui5_config_1.getTypesPackage)(typesVersion);
90
+ const { typesPackage, typesVersion } = getTypes(ui5Version);
65
91
  try {
66
92
  fs.copyTpl(tmplPath, projectPath, { ...data, typesPackage, typesVersion }, undefined, {
67
93
  globOptions: { dot: 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%3Aadp-tooling"
11
11
  },
12
- "version": "0.14.8",
12
+ "version": "0.14.10",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -34,13 +34,13 @@
34
34
  "uuid": "10.0.0",
35
35
  "@sap-ux/axios-extension": "1.21.1",
36
36
  "@sap-ux/btp-utils": "1.1.0",
37
- "@sap-ux/inquirer-common": "0.7.3",
37
+ "@sap-ux/inquirer-common": "0.7.4",
38
38
  "@sap-ux/logger": "0.7.0",
39
- "@sap-ux/project-access": "1.30.1",
40
- "@sap-ux/project-input-validator": "0.6.1",
39
+ "@sap-ux/project-access": "1.30.2",
40
+ "@sap-ux/project-input-validator": "0.6.2",
41
41
  "@sap-ux/system-access": "0.6.1",
42
- "@sap-ux/ui5-config": "0.28.1",
43
- "@sap-ux/odata-service-writer": "0.27.3",
42
+ "@sap-ux/ui5-config": "0.28.2",
43
+ "@sap-ux/odata-service-writer": "0.27.5",
44
44
  "@sap-ux/nodejs-utils": "0.2.0",
45
45
  "@sap-ux/i18n": "0.3.0",
46
46
  "@sap-ux/store": "1.1.0"