@sap-ux/project-access 1.5.1 → 1.7.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.
@@ -46,4 +46,12 @@ export declare function findFilesByExtension(extension: string, root: string, ex
46
46
  * @returns - path to file name if found, otherwise undefined
47
47
  */
48
48
  export declare function findFileUp(fileName: string, startPath: string, fs?: Editor): Promise<string | undefined>;
49
+ /**
50
+ * @description Returns a flat list of all file paths under a directory tree,
51
+ * recursing through all subdirectories
52
+ * @param {string} dir - the directory to walk
53
+ * @returns {string[]} - array of file path strings
54
+ * @throws if an error occurs reading a file path
55
+ */
56
+ export declare function getFilePaths(dir: string): Promise<string[] | []>;
49
57
  //# sourceMappingURL=file-search.d.ts.map
@@ -12,10 +12,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.findFileUp = exports.findFilesByExtension = exports.findFiles = exports.findBy = void 0;
15
+ exports.getFilePaths = exports.findFileUp = exports.findFilesByExtension = exports.findFiles = exports.findBy = void 0;
16
16
  const path_1 = require("path");
17
17
  const findit2_1 = __importDefault(require("findit2"));
18
18
  const file_access_1 = require("./file-access");
19
+ const fs_1 = require("fs");
19
20
  /**
20
21
  * Get deleted and modified files from mem-fs editor filtered by query and 'by' (name|extension).
21
22
  *
@@ -131,4 +132,24 @@ function findFileUp(fileName, startPath, fs) {
131
132
  });
132
133
  }
133
134
  exports.findFileUp = findFileUp;
135
+ /**
136
+ * @description Returns a flat list of all file paths under a directory tree,
137
+ * recursing through all subdirectories
138
+ * @param {string} dir - the directory to walk
139
+ * @returns {string[]} - array of file path strings
140
+ * @throws if an error occurs reading a file path
141
+ */
142
+ function getFilePaths(dir) {
143
+ return __awaiter(this, void 0, void 0, function* () {
144
+ const entries = yield fs_1.promises.readdir(dir);
145
+ const filePathsPromises = entries.map((entry) => __awaiter(this, void 0, void 0, function* () {
146
+ const entryPath = (0, path_1.join)(dir, entry);
147
+ const isDirectory = (yield fs_1.promises.stat(entryPath)).isDirectory();
148
+ return isDirectory ? getFilePaths(entryPath) : entryPath;
149
+ }));
150
+ const filePaths = yield Promise.all(filePathsPromises);
151
+ return [].concat(...filePaths);
152
+ });
153
+ }
154
+ exports.getFilePaths = getFilePaths;
134
155
  //# sourceMappingURL=file-search.js.map
@@ -1,3 +1,3 @@
1
1
  export { fileExists, readFile, readJSON } from './file-access';
2
- export { findBy, findFiles, findFilesByExtension, findFileUp } from './file-search';
2
+ export { findBy, findFiles, findFilesByExtension, findFileUp, getFilePaths } from './file-search';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.findFileUp = exports.findFilesByExtension = exports.findFiles = exports.findBy = exports.readJSON = exports.readFile = exports.fileExists = void 0;
3
+ exports.getFilePaths = exports.findFileUp = exports.findFilesByExtension = exports.findFiles = exports.findBy = exports.readJSON = exports.readFile = exports.fileExists = void 0;
4
4
  var file_access_1 = require("./file-access");
5
5
  Object.defineProperty(exports, "fileExists", { enumerable: true, get: function () { return file_access_1.fileExists; } });
6
6
  Object.defineProperty(exports, "readFile", { enumerable: true, get: function () { return file_access_1.readFile; } });
@@ -10,4 +10,5 @@ Object.defineProperty(exports, "findBy", { enumerable: true, get: function () {
10
10
  Object.defineProperty(exports, "findFiles", { enumerable: true, get: function () { return file_search_1.findFiles; } });
11
11
  Object.defineProperty(exports, "findFilesByExtension", { enumerable: true, get: function () { return file_search_1.findFilesByExtension; } });
12
12
  Object.defineProperty(exports, "findFileUp", { enumerable: true, get: function () { return file_search_1.findFileUp; } });
13
+ Object.defineProperty(exports, "getFilePaths", { enumerable: true, get: function () { return file_search_1.getFilePaths; } });
13
14
  //# sourceMappingURL=index.js.map
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { FileName } from './constants';
2
2
  export { findAllApps, findFioriArtifacts, findProjectRoot, getAppRootFromWebappPath, getAppProgrammingLanguage, getCapEnvironment, getCapModelAndServices, getCapProjectType, getWebappPath, isCapJavaProject, isCapNodeJsProject, loadModuleFromProject, readUi5Yaml } from './project';
3
+ export { getFilePaths } from './file';
3
4
  export * from './types';
4
5
  //# 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.readUi5Yaml = exports.loadModuleFromProject = exports.isCapNodeJsProject = exports.isCapJavaProject = exports.getWebappPath = exports.getCapProjectType = exports.getCapModelAndServices = exports.getCapEnvironment = exports.getAppProgrammingLanguage = exports.getAppRootFromWebappPath = exports.findProjectRoot = exports.findFioriArtifacts = exports.findAllApps = exports.FileName = void 0;
17
+ exports.getFilePaths = exports.readUi5Yaml = exports.loadModuleFromProject = exports.isCapNodeJsProject = exports.isCapJavaProject = exports.getWebappPath = exports.getCapProjectType = exports.getCapModelAndServices = exports.getCapEnvironment = exports.getAppProgrammingLanguage = exports.getAppRootFromWebappPath = exports.findProjectRoot = exports.findFioriArtifacts = exports.findAllApps = 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
  var project_1 = require("./project");
@@ -31,5 +31,7 @@ Object.defineProperty(exports, "isCapJavaProject", { enumerable: true, get: func
31
31
  Object.defineProperty(exports, "isCapNodeJsProject", { enumerable: true, get: function () { return project_1.isCapNodeJsProject; } });
32
32
  Object.defineProperty(exports, "loadModuleFromProject", { enumerable: true, get: function () { return project_1.loadModuleFromProject; } });
33
33
  Object.defineProperty(exports, "readUi5Yaml", { enumerable: true, get: function () { return project_1.readUi5Yaml; } });
34
+ var file_1 = require("./file");
35
+ Object.defineProperty(exports, "getFilePaths", { enumerable: true, get: function () { return file_1.getFilePaths; } });
34
36
  __exportStar(require("./types"), exports);
35
37
  //# sourceMappingURL=index.js.map
@@ -272,7 +272,7 @@ function filterAdaptations(pathMap) {
272
272
  for (const manifestAppDescrVar of manifestAppDescrVars) {
273
273
  const adpPath = yield (0, file_1.findFileUp)('.adp', (0, path_1.dirname)(manifestAppDescrVar));
274
274
  if (adpPath && (yield (0, file_1.fileExists)((0, path_1.join)(adpPath, constants_1.FileName.AdaptationConfig)))) {
275
- results.push({ appRoot: (0, path_1.dirname)(adpPath) });
275
+ results.push({ appRoot: (0, path_1.dirname)(adpPath), manifestAppdescrVariantPath: manifestAppDescrVar });
276
276
  }
277
277
  }
278
278
  return results;
@@ -35,6 +35,10 @@ export interface AdaptationResults {
35
35
  * Root of the adapted application where package.json and ui5.yaml resides.
36
36
  */
37
37
  appRoot: string;
38
+ /**
39
+ * Path to manifest.appdescr_variant
40
+ */
41
+ manifestAppdescrVariantPath: string;
38
42
  }
39
43
  /**
40
44
  * Search result when searching for extension projects.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap-ux/project-access",
3
- "version": "1.5.1",
3
+ "version": "1.7.0",
4
4
  "description": "Library to access SAP Fiori tools projects",
5
5
  "repository": {
6
6
  "type": "git",
@@ -24,10 +24,10 @@
24
24
  "node": ">= 14.16.0 < 15.0.0 || >=16.1.0 < 17.0.0 || >=18.0.0 < 19.0.0"
25
25
  },
26
26
  "dependencies": {
27
- "@sap-ux/ui5-config": "0.16.6",
28
27
  "findit2": "2.2.3",
29
28
  "mem-fs": "2.1.0",
30
- "mem-fs-editor": "9.4.0"
29
+ "mem-fs-editor": "9.4.0",
30
+ "@sap-ux/ui5-config": "0.17.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/mem-fs": "1.1.2",