@sap-ux/project-access 1.25.1 → 1.25.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 { addPackageDevDependency, clearCdsModuleCache, createApplicationAccess, createProjectAccess, findAllApps, findCapProjects, findFioriArtifacts, findProjectRoot, getAppRootFromWebappPath, getAppProgrammingLanguage, getAppType, getCapCustomPaths, getCapEnvironment, getCapModelAndServices, getCapProjectType, getCdsFiles, getCdsRoots, getCdsServices, getCapI18nFolderNames, getSpecification, getSpecificationPath, getI18nPropertiesPaths, getMinUI5VersionFromManifest, getMinUI5VersionAsArray, getMinimumUI5Version, getMtaPath, getNodeModulesPath, getProject, getProjectType, getWebappPath, isCapProject, isCapJavaProject, isCapNodeJsProject, loadModuleFromProject, readCapServiceMetadataEdmx, readUi5Yaml, refreshSpecificationDistTags, toReferenceUri, filterDataSourcesByType, updatePackageScript } from './project';
3
+ export { addPackageDevDependency, clearCdsModuleCache, createApplicationAccess, createProjectAccess, findAllApps, findCapProjects, findFioriArtifacts, findProjectRoot, getAppRootFromWebappPath, getAppProgrammingLanguage, getAppType, getCapCustomPaths, getCapEnvironment, getCapModelAndServices, getCapProjectType, getCdsFiles, getCdsRoots, getCdsServices, getCapI18nFolderNames, getSpecification, getSpecificationPath, getI18nPropertiesPaths, getMinUI5VersionFromManifest, getMinUI5VersionAsArray, getMinimumUI5Version, getMtaPath, getNodeModulesPath, getProject, getProjectType, getWebappPath, isCapProject, isCapJavaProject, isCapNodeJsProject, loadModuleFromProject, readCapServiceMetadataEdmx, readUi5Yaml, refreshSpecificationDistTags, toReferenceUri, filterDataSourcesByType, updatePackageScript, findCapProjectRoot } 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.updatePackageScript = exports.filterDataSourcesByType = exports.toReferenceUri = exports.refreshSpecificationDistTags = 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.getSpecificationPath = exports.getSpecification = 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.clearCdsModuleCache = exports.addPackageDevDependency = exports.getFilePaths = exports.FioriToolsSettings = exports.DirName = exports.FileName = void 0;
17
+ exports.findCapProjectRoot = exports.updatePackageScript = exports.filterDataSourcesByType = exports.toReferenceUri = exports.refreshSpecificationDistTags = 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.getSpecificationPath = exports.getSpecification = 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.clearCdsModuleCache = exports.addPackageDevDependency = 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; } });
@@ -62,6 +62,7 @@ Object.defineProperty(exports, "refreshSpecificationDistTags", { enumerable: tru
62
62
  Object.defineProperty(exports, "toReferenceUri", { enumerable: true, get: function () { return project_1.toReferenceUri; } });
63
63
  Object.defineProperty(exports, "filterDataSourcesByType", { enumerable: true, get: function () { return project_1.filterDataSourcesByType; } });
64
64
  Object.defineProperty(exports, "updatePackageScript", { enumerable: true, get: function () { return project_1.updatePackageScript; } });
65
+ Object.defineProperty(exports, "findCapProjectRoot", { enumerable: true, get: function () { return project_1.findCapProjectRoot; } });
65
66
  __exportStar(require("./types"), exports);
66
67
  __exportStar(require("./library"), exports);
67
68
  //# sourceMappingURL=index.js.map
@@ -4,7 +4,7 @@ export { addPackageDevDependency, getNodeModulesPath } from './dependencies';
4
4
  export { getCapI18nFolderNames, getI18nPropertiesPaths } from './i18n';
5
5
  export { getAppProgrammingLanguage, getAppType, getMinUI5VersionFromManifest, getMinUI5VersionAsArray, getMinimumUI5Version, getProject, getProjectType } from './info';
6
6
  export { loadModuleFromProject } from './module-loader';
7
- export { findAllApps, findCapProjects, findFioriArtifacts, findProjectRoot, getAppRootFromWebappPath } from './search';
7
+ export { findAllApps, findCapProjects, findFioriArtifacts, findProjectRoot, getAppRootFromWebappPath, findCapProjectRoot } from './search';
8
8
  export { getWebappPath, readUi5Yaml } from './ui5-config';
9
9
  export { getMtaPath } from './mta';
10
10
  export { createApplicationAccess, createProjectAccess } from './access';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.refreshSpecificationDistTags = exports.getSpecificationPath = exports.getSpecification = exports.updatePackageScript = 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.addPackageDevDependency = exports.filterDataSourcesByType = 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.refreshSpecificationDistTags = exports.getSpecificationPath = exports.getSpecification = exports.updatePackageScript = exports.createProjectAccess = exports.createApplicationAccess = exports.getMtaPath = exports.readUi5Yaml = exports.getWebappPath = exports.findCapProjectRoot = 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.addPackageDevDependency = exports.filterDataSourcesByType = 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; } });
@@ -39,6 +39,7 @@ Object.defineProperty(exports, "findCapProjects", { enumerable: true, get: funct
39
39
  Object.defineProperty(exports, "findFioriArtifacts", { enumerable: true, get: function () { return search_1.findFioriArtifacts; } });
40
40
  Object.defineProperty(exports, "findProjectRoot", { enumerable: true, get: function () { return search_1.findProjectRoot; } });
41
41
  Object.defineProperty(exports, "getAppRootFromWebappPath", { enumerable: true, get: function () { return search_1.getAppRootFromWebappPath; } });
42
+ Object.defineProperty(exports, "findCapProjectRoot", { enumerable: true, get: function () { return search_1.findCapProjectRoot; } });
42
43
  var ui5_config_1 = require("./ui5-config");
43
44
  Object.defineProperty(exports, "getWebappPath", { enumerable: true, get: function () { return ui5_config_1.getWebappPath; } });
44
45
  Object.defineProperty(exports, "readUi5Yaml", { enumerable: true, get: function () { return ui5_config_1.readUi5Yaml; } });
@@ -15,6 +15,13 @@ export declare function findProjectRoot(path: string, sapuxRequired?: boolean, s
15
15
  * @returns - root path of the application, where usually ui5.yaml and package.json are
16
16
  */
17
17
  export declare function getAppRootFromWebappPath(webappPath: string): Promise<string | null>;
18
+ /**
19
+ * Find CAP project root path.
20
+ *
21
+ * @param path - path inside CAP project
22
+ * @returns - CAP project root path
23
+ */
24
+ export declare function findCapProjectRoot(path: string): Promise<string | null>;
18
25
  /**
19
26
  * Find all app that are supported by Fiori tools for a given list of roots (workspace folders).
20
27
  * This is a convenient function to retrieve all apps. Same result can be achieved with call
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.findCapProjects = exports.findFioriArtifacts = exports.findAllApps = exports.getAppRootFromWebappPath = exports.findProjectRoot = void 0;
3
+ exports.findCapProjects = exports.findFioriArtifacts = exports.findAllApps = exports.findCapProjectRoot = exports.getAppRootFromWebappPath = exports.findProjectRoot = void 0;
4
4
  const path_1 = require("path");
5
5
  const constants_1 = require("../constants");
6
6
  const file_1 = require("../file");
@@ -215,6 +215,7 @@ async function findCapProjectRoot(path) {
215
215
  }
216
216
  return null;
217
217
  }
218
+ exports.findCapProjectRoot = findCapProjectRoot;
218
219
  /**
219
220
  * Find all app that are supported by Fiori tools for a given list of roots (workspace folders).
220
221
  * This is a convenient function to retrieve all apps. Same result can be achieved with call
@@ -57,10 +57,10 @@ async function hasSpecificationDevDependency(root) {
57
57
  async function getSpecificationModule(root, options) {
58
58
  const logger = options?.logger;
59
59
  let specification;
60
- const distTag = await getProjectDistTag(root, { logger });
60
+ const version = await getSpecificationVersion(root, { logger });
61
61
  try {
62
- specification = await getSpecificationByDistTag(distTag, { logger });
63
- logger?.debug(`Specification loaded from cache using dist-tag '${distTag}'`);
62
+ specification = await getSpecificationByVersion(version, { logger });
63
+ logger?.debug(`Specification loaded from cache using version '${version}'`);
64
64
  }
65
65
  catch (error) {
66
66
  logger?.error(`Failed to load specification: ${error}`);
@@ -128,16 +128,15 @@ async function refreshSpecificationDistTags(options) {
128
128
  }
129
129
  exports.refreshSpecificationDistTags = refreshSpecificationDistTags;
130
130
  /**
131
- * Loads and return specification from cache by dist-tag.
131
+ * Loads and return specification from cache by version.
132
132
  *
133
- * @param distTag - dist-tag of the specification, like 'latest' or 'UI5-1.71'
133
+ * @param version - version of the specification
134
134
  * @param [options] - optional options
135
135
  * @param [options.logger] - optional logger instance
136
136
  * @returns - specification instance
137
137
  */
138
- async function getSpecificationByDistTag(distTag, options) {
138
+ async function getSpecificationByVersion(version, options) {
139
139
  const logger = options?.logger;
140
- const version = await convertDistTagToVersion(distTag, { logger });
141
140
  const specification = await (0, module_loader_1.getModule)('@sap/ux-specification', version, { logger });
142
141
  return specification;
143
142
  }
@@ -187,14 +186,14 @@ async function getSpecificationPath(root, options) {
187
186
  if (await hasSpecificationDevDependency(root)) {
188
187
  const modulePath = await (0, module_loader_1.getModulePath)(root, moduleName);
189
188
  logger?.debug(`Specification root found in project '${root}'`);
190
- return modulePath.slice(0, modulePath.lastIndexOf(moduleName) + moduleName.length);
189
+ return modulePath.slice(0, modulePath.lastIndexOf((0, path_1.join)(moduleName)) + (0, path_1.join)(moduleName).length);
191
190
  }
192
- logger?.debug(`Specification not found in project '${root}', trying to find in cache`);
193
191
  await getSpecificationModule(root, { logger });
194
192
  const version = await getSpecificationVersion(root, { logger });
193
+ logger?.debug(`Specification not found in project '${root}', using path from cache with version '${version}'`);
195
194
  const moduleRoot = (0, path_1.join)(constants_1.moduleCacheRoot, moduleName, version);
196
195
  const modulePath = await (0, module_loader_1.getModulePath)(moduleRoot, moduleName);
197
- return modulePath.slice(0, modulePath.lastIndexOf(moduleName) + moduleName.length);
196
+ return modulePath.slice(0, modulePath.lastIndexOf((0, path_1.join)(moduleName)) + (0, path_1.join)(moduleName).length);
198
197
  }
199
198
  exports.getSpecificationPath = getSpecificationPath;
200
199
  //# sourceMappingURL=specification.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap-ux/project-access",
3
- "version": "1.25.1",
3
+ "version": "1.25.4",
4
4
  "description": "Library to access SAP Fiori tools projects",
5
5
  "repository": {
6
6
  "type": "git",
@@ -30,7 +30,7 @@
30
30
  "mem-fs-editor": "9.4.0",
31
31
  "semver": "7.5.4",
32
32
  "@sap-ux/i18n": "0.1.0",
33
- "@sap-ux/ui5-config": "0.23.0"
33
+ "@sap-ux/ui5-config": "0.23.1"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/mem-fs": "1.1.2",