@sap-ux/project-access 1.26.5 → 1.26.6
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/project/search.js +14 -17
- package/package.json +1 -1
package/dist/project/search.js
CHANGED
|
@@ -236,26 +236,23 @@ exports.findAllApps = findAllApps;
|
|
|
236
236
|
* @returns - results as path to apps plus files already parsed, e.g. manifest.json
|
|
237
237
|
*/
|
|
238
238
|
async function filterApplications(pathMap) {
|
|
239
|
-
const
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
const manifest = pathMap[manifestPath];
|
|
246
|
-
if (!manifest['sap.app']?.id || manifest['sap.app'].type !== 'application') {
|
|
247
|
-
continue;
|
|
248
|
-
}
|
|
249
|
-
const roots = await findRootsForPath(manifestPath);
|
|
239
|
+
const filterApplicationByManifest = async (manifestPath) => {
|
|
240
|
+
pathMap[manifestPath] ??= await (0, file_1.readJSON)(manifestPath);
|
|
241
|
+
const manifest = pathMap[manifestPath]; // cast needed as pathMap also allows strings and any other objects
|
|
242
|
+
// cast allowed, as this is the only place pathMap is filled for manifests
|
|
243
|
+
if (manifest['sap.app'].id && manifest['sap.app'].type === 'application') {
|
|
244
|
+
const roots = await findRootsForPath((0, path_1.dirname)(manifestPath));
|
|
250
245
|
if (roots && !(await (0, file_1.fileExists)((0, path_1.join)(roots.appRoot, '.adp', constants_1.FileName.AdaptationConfig)))) {
|
|
251
|
-
|
|
246
|
+
return { appRoot: roots.appRoot, projectRoot: roots.projectRoot, manifest: manifest, manifestPath };
|
|
252
247
|
}
|
|
253
248
|
}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
return
|
|
249
|
+
throw new Error('Not relevant');
|
|
250
|
+
};
|
|
251
|
+
const isFulFilled = (input) => input.status === 'fulfilled';
|
|
252
|
+
const manifestPaths = Object.keys(pathMap).filter((path) => (0, path_1.basename)(path) === constants_1.FileName.Manifest);
|
|
253
|
+
return (await Promise.allSettled(manifestPaths.map(filterApplicationByManifest)))
|
|
254
|
+
.filter(isFulFilled) // returning only valid applications
|
|
255
|
+
.map(({ value }) => value);
|
|
259
256
|
}
|
|
260
257
|
/**
|
|
261
258
|
* Filter adaptation projects from a list of files.
|