@sap-ux/project-access 1.17.5 → 1.17.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.
@@ -2,6 +2,7 @@ export declare const FileName: {
2
2
  readonly AdaptationConfig: "config.json";
3
3
  readonly CapJavaApplicationYaml: "application.yaml";
4
4
  readonly ExtConfigJson: ".extconfig.json";
5
+ readonly Library: ".library";
5
6
  readonly Manifest: "manifest.json";
6
7
  readonly ManifestAppDescrVar: "manifest.appdescr_variant";
7
8
  readonly MtaYaml: "mta.yaml";
package/dist/constants.js CHANGED
@@ -5,6 +5,7 @@ exports.FileName = {
5
5
  AdaptationConfig: 'config.json',
6
6
  CapJavaApplicationYaml: 'application.yaml',
7
7
  ExtConfigJson: '.extconfig.json',
8
+ Library: '.library',
8
9
  Manifest: 'manifest.json',
9
10
  ManifestAppDescrVar: 'manifest.appdescr_variant',
10
11
  MtaYaml: 'mta.yaml',
@@ -23,10 +23,10 @@ const ui5_config_1 = require("./ui5-config");
23
23
  * functions.
24
24
  */
25
25
  const filterFileMap = {
26
- applications: constants_1.FileName.Manifest,
27
- adaptations: constants_1.FileName.ManifestAppDescrVar,
28
- extensions: constants_1.FileName.ExtConfigJson,
29
- libraries: constants_1.FileName.Manifest
26
+ applications: [constants_1.FileName.Manifest],
27
+ adaptations: [constants_1.FileName.ManifestAppDescrVar],
28
+ extensions: [constants_1.FileName.ExtConfigJson],
29
+ libraries: [constants_1.FileName.Library, constants_1.FileName.Manifest]
30
30
  };
31
31
  /**
32
32
  * Default folders to exclude from search.
@@ -337,6 +337,30 @@ function filterExtensions(pathMap) {
337
337
  return results;
338
338
  });
339
339
  }
340
+ /**
341
+ * Find and filter libraries with only a `.library` and no `manifest.json`.
342
+ *
343
+ * @param pathMap - path to files
344
+ * @param manifestPaths - paths to manifest.json files
345
+ * @returns - results as array of found .library projects.
346
+ */
347
+ function filterDotLibraries(pathMap, manifestPaths) {
348
+ var _a;
349
+ return __awaiter(this, void 0, void 0, function* () {
350
+ const dotLibraries = [];
351
+ const dotLibraryPaths = Object.keys(pathMap)
352
+ .filter((path) => (0, path_1.basename)(path) === constants_1.FileName.Library)
353
+ .map((path) => (0, path_1.dirname)(path))
354
+ .filter((path) => !manifestPaths.map((manifestPath) => (0, path_1.dirname)(manifestPath)).includes(path));
355
+ if (dotLibraryPaths) {
356
+ for (const libraryPath of dotLibraryPaths) {
357
+ const projectRoot = (0, path_1.dirname)((_a = (yield (0, file_1.findFileUp)(constants_1.FileName.Package, (0, path_1.dirname)(libraryPath)))) !== null && _a !== void 0 ? _a : libraryPath);
358
+ dotLibraries.push({ projectRoot, libraryPath });
359
+ }
360
+ }
361
+ return dotLibraries;
362
+ });
363
+ }
340
364
  /**
341
365
  * Filter extensions projects from a list of files.
342
366
  *
@@ -348,6 +372,7 @@ function filterLibraries(pathMap) {
348
372
  return __awaiter(this, void 0, void 0, function* () {
349
373
  const results = [];
350
374
  const manifestPaths = Object.keys(pathMap).filter((path) => (0, path_1.basename)(path) === constants_1.FileName.Manifest);
375
+ results.push(...(yield filterDotLibraries(pathMap, manifestPaths)));
351
376
  for (const manifestPath of manifestPaths) {
352
377
  try {
353
378
  (_a = pathMap[manifestPath]) !== null && _a !== void 0 ? _a : (pathMap[manifestPath] = yield (0, file_1.readJSON)(manifestPath));
@@ -377,7 +402,7 @@ function getFilterFileNames(artifacts) {
377
402
  const uniqueFilterFiles = new Set();
378
403
  for (const artifact of artifacts) {
379
404
  if (filterFileMap[artifact]) {
380
- uniqueFilterFiles.add(filterFileMap[artifact]);
405
+ filterFileMap[artifact].forEach((artifactFile) => uniqueFilterFiles.add(artifactFile));
381
406
  }
382
407
  }
383
408
  return Array.from(uniqueFilterFiles);
@@ -70,12 +70,16 @@ export interface LibraryResults {
70
70
  /**
71
71
  * Path to the manifest.json of the library.
72
72
  */
73
- manifestPath: string;
73
+ manifestPath?: string;
74
74
  /**
75
75
  * Parsed content of the manifest.json to avoid multiple reads when working with
76
76
  * the search results.
77
77
  */
78
- manifest: Manifest;
78
+ manifest?: Manifest;
79
+ /**
80
+ * Path to the .library file of the library, if existing.
81
+ */
82
+ libraryPath?: string;
79
83
  }
80
84
  export interface FoundFioriArtifacts {
81
85
  applications?: AllAppResults[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap-ux/project-access",
3
- "version": "1.17.5",
3
+ "version": "1.17.6",
4
4
  "description": "Library to access SAP Fiori tools projects",
5
5
  "repository": {
6
6
  "type": "git",