@sap-ux/project-access 1.20.2 → 1.20.4

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/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { FileName, DirName, FioriToolsSettings } from './constants';
2
2
  export { getFilePaths } from './file';
3
- export { createApplicationAccess, createProjectAccess, findAllApps, findCapProjects, findFioriArtifacts, findProjectRoot, getAppRootFromWebappPath, getAppProgrammingLanguage, getAppType, getCapCustomPaths, getCapEnvironment, getCapModelAndServices, getCapProjectType, getCdsFiles, getCdsRoots, getCdsServices, getCapI18nFolderNames, getI18nPropertiesPaths, getMtaPath, getNodeModulesPath, getProject, getProjectType, getWebappPath, isCapProject, isCapJavaProject, isCapNodeJsProject, loadModuleFromProject, readCapServiceMetadataEdmx, readUi5Yaml, toReferenceUri, clearCdsModuleCache } from './project';
3
+ export { createApplicationAccess, createProjectAccess, findAllApps, findCapProjects, findFioriArtifacts, findProjectRoot, getAppRootFromWebappPath, getAppProgrammingLanguage, getAppType, getCapCustomPaths, getCapEnvironment, getCapModelAndServices, getCapProjectType, getCdsFiles, getCdsRoots, getCdsServices, getCapI18nFolderNames, getI18nPropertiesPaths, getMinUI5VersionFromManifest, getMinUI5VersionAsArray, getMinimumUI5Version, getMtaPath, getNodeModulesPath, getProject, getProjectType, getWebappPath, isCapProject, isCapJavaProject, isCapNodeJsProject, loadModuleFromProject, readCapServiceMetadataEdmx, readUi5Yaml, toReferenceUri, clearCdsModuleCache } from './project';
4
4
  export * from './types';
5
5
  export * from './library';
6
6
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.clearCdsModuleCache = exports.toReferenceUri = exports.readUi5Yaml = exports.readCapServiceMetadataEdmx = exports.loadModuleFromProject = exports.isCapNodeJsProject = exports.isCapJavaProject = exports.isCapProject = exports.getWebappPath = exports.getProjectType = exports.getProject = exports.getNodeModulesPath = exports.getMtaPath = exports.getI18nPropertiesPaths = exports.getCapI18nFolderNames = exports.getCdsServices = exports.getCdsRoots = exports.getCdsFiles = exports.getCapProjectType = exports.getCapModelAndServices = exports.getCapEnvironment = exports.getCapCustomPaths = exports.getAppType = exports.getAppProgrammingLanguage = exports.getAppRootFromWebappPath = exports.findProjectRoot = exports.findFioriArtifacts = exports.findCapProjects = exports.findAllApps = exports.createProjectAccess = exports.createApplicationAccess = exports.getFilePaths = exports.FioriToolsSettings = exports.DirName = exports.FileName = void 0;
17
+ exports.clearCdsModuleCache = exports.toReferenceUri = exports.readUi5Yaml = exports.readCapServiceMetadataEdmx = exports.loadModuleFromProject = exports.isCapNodeJsProject = exports.isCapJavaProject = exports.isCapProject = exports.getWebappPath = exports.getProjectType = exports.getProject = exports.getNodeModulesPath = exports.getMtaPath = exports.getMinimumUI5Version = exports.getMinUI5VersionAsArray = exports.getMinUI5VersionFromManifest = exports.getI18nPropertiesPaths = exports.getCapI18nFolderNames = exports.getCdsServices = exports.getCdsRoots = exports.getCdsFiles = exports.getCapProjectType = exports.getCapModelAndServices = exports.getCapEnvironment = exports.getCapCustomPaths = exports.getAppType = exports.getAppProgrammingLanguage = exports.getAppRootFromWebappPath = exports.findProjectRoot = exports.findFioriArtifacts = exports.findCapProjects = exports.findAllApps = exports.createProjectAccess = exports.createApplicationAccess = exports.getFilePaths = exports.FioriToolsSettings = exports.DirName = exports.FileName = void 0;
18
18
  var constants_1 = require("./constants");
19
19
  Object.defineProperty(exports, "FileName", { enumerable: true, get: function () { return constants_1.FileName; } });
20
20
  Object.defineProperty(exports, "DirName", { enumerable: true, get: function () { return constants_1.DirName; } });
@@ -40,6 +40,9 @@ Object.defineProperty(exports, "getCdsRoots", { enumerable: true, get: function
40
40
  Object.defineProperty(exports, "getCdsServices", { enumerable: true, get: function () { return project_1.getCdsServices; } });
41
41
  Object.defineProperty(exports, "getCapI18nFolderNames", { enumerable: true, get: function () { return project_1.getCapI18nFolderNames; } });
42
42
  Object.defineProperty(exports, "getI18nPropertiesPaths", { enumerable: true, get: function () { return project_1.getI18nPropertiesPaths; } });
43
+ Object.defineProperty(exports, "getMinUI5VersionFromManifest", { enumerable: true, get: function () { return project_1.getMinUI5VersionFromManifest; } });
44
+ Object.defineProperty(exports, "getMinUI5VersionAsArray", { enumerable: true, get: function () { return project_1.getMinUI5VersionAsArray; } });
45
+ Object.defineProperty(exports, "getMinimumUI5Version", { enumerable: true, get: function () { return project_1.getMinimumUI5Version; } });
43
46
  Object.defineProperty(exports, "getMtaPath", { enumerable: true, get: function () { return project_1.getMtaPath; } });
44
47
  Object.defineProperty(exports, "getNodeModulesPath", { enumerable: true, get: function () { return project_1.getNodeModulesPath; } });
45
48
  Object.defineProperty(exports, "getProject", { enumerable: true, get: function () { return project_1.getProject; } });
@@ -1,7 +1,7 @@
1
1
  export { getCapCustomPaths, getCapModelAndServices, getCapProjectType, getCdsFiles, getCdsRoots, getCdsServices, isCapProject, isCapJavaProject, isCapNodeJsProject, getCapEnvironment, readCapServiceMetadataEdmx, toReferenceUri, clearCdsModuleCache } from './cap';
2
2
  export { getNodeModulesPath } from './dependencies';
3
3
  export { getCapI18nFolderNames, getI18nPropertiesPaths } from './i18n';
4
- export { getAppProgrammingLanguage, getAppType, getProject, getProjectType } from './info';
4
+ export { getAppProgrammingLanguage, getAppType, getMinUI5VersionFromManifest, getMinUI5VersionAsArray, getMinimumUI5Version, getProject, getProjectType } from './info';
5
5
  export { loadModuleFromProject } from './module-loader';
6
6
  export { findAllApps, findCapProjects, findFioriArtifacts, findProjectRoot, getAppRootFromWebappPath } from './search';
7
7
  export { getWebappPath, readUi5Yaml } from './ui5-config';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createProjectAccess = exports.createApplicationAccess = exports.getMtaPath = exports.readUi5Yaml = exports.getWebappPath = exports.getAppRootFromWebappPath = exports.findProjectRoot = exports.findFioriArtifacts = exports.findCapProjects = exports.findAllApps = exports.loadModuleFromProject = exports.getProjectType = exports.getProject = exports.getAppType = exports.getAppProgrammingLanguage = exports.getI18nPropertiesPaths = exports.getCapI18nFolderNames = exports.getNodeModulesPath = exports.clearCdsModuleCache = exports.toReferenceUri = exports.readCapServiceMetadataEdmx = exports.getCapEnvironment = exports.isCapNodeJsProject = exports.isCapJavaProject = exports.isCapProject = exports.getCdsServices = exports.getCdsRoots = exports.getCdsFiles = exports.getCapProjectType = exports.getCapModelAndServices = exports.getCapCustomPaths = void 0;
3
+ exports.createProjectAccess = exports.createApplicationAccess = exports.getMtaPath = exports.readUi5Yaml = exports.getWebappPath = exports.getAppRootFromWebappPath = exports.findProjectRoot = exports.findFioriArtifacts = exports.findCapProjects = exports.findAllApps = exports.loadModuleFromProject = exports.getProjectType = exports.getProject = exports.getMinimumUI5Version = exports.getMinUI5VersionAsArray = exports.getMinUI5VersionFromManifest = exports.getAppType = exports.getAppProgrammingLanguage = exports.getI18nPropertiesPaths = exports.getCapI18nFolderNames = exports.getNodeModulesPath = exports.clearCdsModuleCache = exports.toReferenceUri = exports.readCapServiceMetadataEdmx = exports.getCapEnvironment = exports.isCapNodeJsProject = exports.isCapJavaProject = exports.isCapProject = exports.getCdsServices = exports.getCdsRoots = exports.getCdsFiles = exports.getCapProjectType = exports.getCapModelAndServices = exports.getCapCustomPaths = void 0;
4
4
  var cap_1 = require("./cap");
5
5
  Object.defineProperty(exports, "getCapCustomPaths", { enumerable: true, get: function () { return cap_1.getCapCustomPaths; } });
6
6
  Object.defineProperty(exports, "getCapModelAndServices", { enumerable: true, get: function () { return cap_1.getCapModelAndServices; } });
@@ -23,6 +23,9 @@ Object.defineProperty(exports, "getI18nPropertiesPaths", { enumerable: true, get
23
23
  var info_1 = require("./info");
24
24
  Object.defineProperty(exports, "getAppProgrammingLanguage", { enumerable: true, get: function () { return info_1.getAppProgrammingLanguage; } });
25
25
  Object.defineProperty(exports, "getAppType", { enumerable: true, get: function () { return info_1.getAppType; } });
26
+ Object.defineProperty(exports, "getMinUI5VersionFromManifest", { enumerable: true, get: function () { return info_1.getMinUI5VersionFromManifest; } });
27
+ Object.defineProperty(exports, "getMinUI5VersionAsArray", { enumerable: true, get: function () { return info_1.getMinUI5VersionAsArray; } });
28
+ Object.defineProperty(exports, "getMinimumUI5Version", { enumerable: true, get: function () { return info_1.getMinimumUI5Version; } });
26
29
  Object.defineProperty(exports, "getProject", { enumerable: true, get: function () { return info_1.getProject; } });
27
30
  Object.defineProperty(exports, "getProjectType", { enumerable: true, get: function () { return info_1.getProjectType; } });
28
31
  var module_loader_1 = require("./module-loader");
@@ -1,5 +1,5 @@
1
1
  import type { Editor } from 'mem-fs-editor';
2
- import type { AppProgrammingLanguage, AppType, Project, ProjectType } from '../types';
2
+ import type { AppProgrammingLanguage, AppType, Manifest, Project, ProjectType } from '../types';
3
3
  /**
4
4
  * Returns the project structure for a given Fiori project.
5
5
  *
@@ -29,4 +29,26 @@ export declare function getAppType(appRoot: string): Promise<AppType | undefined
29
29
  * @returns - project type like Edmx, CAPJava, CAPNodejs
30
30
  */
31
31
  export declare function getProjectType(projectRoot: string): Promise<ProjectType>;
32
+ /**
33
+ * Returns the minUI5Version, as defined in manifest.
34
+ *
35
+ * @param manifest - manifest object
36
+ * @returns minUI5Version, if present
37
+ */
38
+ export declare function getMinUI5VersionFromManifest(manifest: Manifest): string | string[] | undefined;
39
+ /**
40
+ * Returns the minUI5Version as string[].
41
+ *
42
+ * @param manifest - manifest object
43
+ * @returns minUI5Version, as an array of strings
44
+ */
45
+ export declare function getMinUI5VersionAsArray(manifest: Manifest): string[];
46
+ /**
47
+ * Returns the minUI5Version in string format.
48
+ * If it is defined as an arry, returns the minimum version from it.
49
+ *
50
+ * @param manifest - manifest object
51
+ * @returns the minimum version as string
52
+ */
53
+ export declare function getMinimumUI5Version(manifest: Manifest): string | undefined;
32
54
  //# sourceMappingURL=info.d.ts.map
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.getProjectType = exports.getAppType = exports.getAppProgrammingLanguage = exports.getProject = void 0;
12
+ exports.getMinimumUI5Version = exports.getMinUI5VersionAsArray = exports.getMinUI5VersionFromManifest = exports.getProjectType = exports.getAppType = exports.getAppProgrammingLanguage = exports.getProject = void 0;
13
13
  const path_1 = require("path");
14
14
  const constants_1 = require("../constants");
15
15
  const file_1 = require("../file");
@@ -18,6 +18,7 @@ const i18n_1 = require("./i18n/i18n");
18
18
  const search_1 = require("./search");
19
19
  const service_1 = require("./service");
20
20
  const ui5_config_1 = require("./ui5-config");
21
+ const semver_1 = require("semver");
21
22
  /**
22
23
  * Returns the project structure for a given Fiori project.
23
24
  *
@@ -215,4 +216,54 @@ function getProjectType(projectRoot) {
215
216
  });
216
217
  }
217
218
  exports.getProjectType = getProjectType;
219
+ /**
220
+ * Returns the minUI5Version, as defined in manifest.
221
+ *
222
+ * @param manifest - manifest object
223
+ * @returns minUI5Version, if present
224
+ */
225
+ function getMinUI5VersionFromManifest(manifest) {
226
+ var _a;
227
+ const dependencies = (_a = manifest['sap.ui5']) === null || _a === void 0 ? void 0 : _a.dependencies;
228
+ if (dependencies) {
229
+ return dependencies.minUI5Version;
230
+ }
231
+ return undefined;
232
+ }
233
+ exports.getMinUI5VersionFromManifest = getMinUI5VersionFromManifest;
234
+ /**
235
+ * Returns the minUI5Version as string[].
236
+ *
237
+ * @param manifest - manifest object
238
+ * @returns minUI5Version, as an array of strings
239
+ */
240
+ function getMinUI5VersionAsArray(manifest) {
241
+ let result = [];
242
+ const minUI5Version = getMinUI5VersionFromManifest(manifest);
243
+ if (minUI5Version) {
244
+ result = Array.isArray(minUI5Version) ? minUI5Version : [minUI5Version];
245
+ }
246
+ return result;
247
+ }
248
+ exports.getMinUI5VersionAsArray = getMinUI5VersionAsArray;
249
+ /**
250
+ * Returns the minUI5Version in string format.
251
+ * If it is defined as an arry, returns the minimum version from it.
252
+ *
253
+ * @param manifest - manifest object
254
+ * @returns the minimum version as string
255
+ */
256
+ function getMinimumUI5Version(manifest) {
257
+ let result;
258
+ const minUI5VersionArray = getMinUI5VersionAsArray(manifest);
259
+ if (minUI5VersionArray.length > 0) {
260
+ minUI5VersionArray.forEach((version) => {
261
+ if ((0, semver_1.valid)(version) && (!result || (0, semver_1.gte)(result, version))) {
262
+ result = version;
263
+ }
264
+ });
265
+ }
266
+ return result;
267
+ }
268
+ exports.getMinimumUI5Version = getMinimumUI5Version;
218
269
  //# sourceMappingURL=info.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap-ux/project-access",
3
- "version": "1.20.2",
3
+ "version": "1.20.4",
4
4
  "description": "Library to access SAP Fiori tools projects",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,12 +27,14 @@
27
27
  "findit2": "2.2.3",
28
28
  "mem-fs": "2.1.0",
29
29
  "mem-fs-editor": "9.4.0",
30
- "@sap-ux/i18n": "0.0.6",
30
+ "semver": "7.5.4",
31
+ "@sap-ux/i18n": "0.0.7",
31
32
  "@sap-ux/ui5-config": "0.22.5"
32
33
  },
33
34
  "devDependencies": {
34
35
  "@types/mem-fs": "1.1.2",
35
36
  "@types/mem-fs-editor": "7.0.1",
37
+ "@types/semver": "7.5.2",
36
38
  "@ui5/manifest": "1.61.0",
37
39
  "vscode-uri": "3.0.7",
38
40
  "@sap-ux/logger": "0.5.1"