@sap-ux/project-access 1.29.7 → 1.29.8
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type LibraryResults, type Manifest, type ReuseLib } from '../types';
|
|
1
|
+
import { type LibraryResults, type Manifest, type ReuseLib, type LibraryXml } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* Returns an array of the reuse libraries found in the folders.
|
|
4
4
|
*
|
|
@@ -21,14 +21,14 @@ export declare function checkDependencies(answers: ReuseLib[], reuseLibs: ReuseL
|
|
|
21
21
|
* @param libraryPath - library path
|
|
22
22
|
* @returns library description
|
|
23
23
|
*/
|
|
24
|
-
export declare function getLibraryDesc(library:
|
|
24
|
+
export declare function getLibraryDesc(library: LibraryXml, libraryPath: string): Promise<string>;
|
|
25
25
|
/**
|
|
26
26
|
* Returns the library dependencies.
|
|
27
27
|
*
|
|
28
28
|
* @param library - library object
|
|
29
29
|
* @returns array of dependencies
|
|
30
30
|
*/
|
|
31
|
-
export declare function getLibraryDependencies(library:
|
|
31
|
+
export declare function getLibraryDependencies(library: LibraryXml): string[];
|
|
32
32
|
/**
|
|
33
33
|
* Returns the manifest description.
|
|
34
34
|
*
|
package/dist/library/helpers.js
CHANGED
|
@@ -66,7 +66,7 @@ const getLibraryFromLibraryFile = async (library, libraryPath, projectRoot) => {
|
|
|
66
66
|
name: `${parsedFile.library.name}`,
|
|
67
67
|
path: (0, path_1.dirname)(libraryPath),
|
|
68
68
|
type: reuseType,
|
|
69
|
-
uri: parsedFile.library?.appData?.manifest?.['sap.platform.abap']?.uri
|
|
69
|
+
uri: parsedFile.library?.appData?.manifest?.['sap.platform.abap']?.uri ?? '',
|
|
70
70
|
dependencies: libDeps,
|
|
71
71
|
libRoot: projectRoot,
|
|
72
72
|
description
|
|
@@ -111,7 +111,7 @@ const getReuseLibs = async (libs) => {
|
|
|
111
111
|
];
|
|
112
112
|
for (const manifestPath of manifestPaths) {
|
|
113
113
|
const manifestFilePath = (0, path_1.join)(manifestPath, constants_2.FileName.Manifest);
|
|
114
|
-
const manifest =
|
|
114
|
+
const manifest = await (0, file_1.readJSON)(manifestFilePath);
|
|
115
115
|
const library = await getLibraryFromManifest(manifest, manifestFilePath, reuseLibs, lib.projectRoot);
|
|
116
116
|
if (library) {
|
|
117
117
|
reuseLibs.push(library);
|
|
@@ -174,9 +174,9 @@ async function getLibraryDesc(library, libraryPath) {
|
|
|
174
174
|
let libraryDesc = library?.library?.documentation;
|
|
175
175
|
if (typeof libraryDesc === 'string' && libraryDesc.startsWith('{{')) {
|
|
176
176
|
const key = libraryDesc.substring(2, libraryDesc.length - 2);
|
|
177
|
-
libraryDesc = await geti18nPropertyValue((0, path_1.join)((0, path_1.dirname)(libraryPath), library.library?.appData?.manifest?.i18n?.toString()), key);
|
|
177
|
+
libraryDesc = await geti18nPropertyValue((0, path_1.join)((0, path_1.dirname)(libraryPath), library.library?.appData?.manifest?.i18n?.toString() ?? ''), key);
|
|
178
178
|
}
|
|
179
|
-
return libraryDesc
|
|
179
|
+
return libraryDesc?.toString() ?? '';
|
|
180
180
|
}
|
|
181
181
|
/**
|
|
182
182
|
* Returns the library dependencies.
|
|
@@ -247,7 +247,8 @@ async function getManifestDesc(manifest, manifestPath) {
|
|
|
247
247
|
*/
|
|
248
248
|
function getManifestDependencies(manifest) {
|
|
249
249
|
const result = [];
|
|
250
|
-
|
|
250
|
+
const depTypes = ['libs', 'components'];
|
|
251
|
+
Object.values(depTypes).forEach((reuseType) => {
|
|
251
252
|
const dependencies = manifest['sap.ui5']?.dependencies?.[reuseType];
|
|
252
253
|
if (dependencies) {
|
|
253
254
|
const libs = manifest?.['sap.ui5']?.dependencies?.libs;
|
package/dist/project/cap.js
CHANGED
|
@@ -535,11 +535,10 @@ async function getPackageNameInFolder(baseUri, relativeUri) {
|
|
|
535
535
|
async function readPackageNameForFolder(baseUri, relativeUri) {
|
|
536
536
|
let packageName = '';
|
|
537
537
|
try {
|
|
538
|
-
const path = (0, path_1.normalize)(baseUri + '/' + relativeUri + '/' +
|
|
539
|
-
const content = await (0, file_1.
|
|
540
|
-
if (content) {
|
|
541
|
-
|
|
542
|
-
packageName = parsed.name;
|
|
538
|
+
const path = (0, path_1.normalize)(baseUri + '/' + relativeUri + '/' + constants_1.FileName.Package);
|
|
539
|
+
const content = await (0, file_1.readJSON)(path);
|
|
540
|
+
if (typeof content?.name === 'string') {
|
|
541
|
+
packageName = content.name;
|
|
543
542
|
}
|
|
544
543
|
}
|
|
545
544
|
catch (e) {
|
package/dist/project/search.d.ts
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import type { Editor } from 'mem-fs-editor';
|
|
2
|
-
import type { AllAppResults, FioriArtifactTypes, FoundFioriArtifacts, WorkspaceFolder } from '../types';
|
|
2
|
+
import type { AllAppResults, CapProjectType, FioriArtifactTypes, FoundFioriArtifacts, WorkspaceFolder } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Type that is used locally only to keep list of found files with cache of the
|
|
5
|
+
* content in order to avoid multiple file reads. It also caches result of call
|
|
6
|
+
* getCapProjectType() this is expensive.
|
|
7
|
+
*/
|
|
8
|
+
type FileMapAndCache = {
|
|
9
|
+
files: {
|
|
10
|
+
[path: string]: null | string | object;
|
|
11
|
+
};
|
|
12
|
+
capProjectType: Map<string, CapProjectType | undefined>;
|
|
13
|
+
};
|
|
3
14
|
/**
|
|
4
15
|
* Find root folder of the project containing the given file.
|
|
5
16
|
*
|
|
@@ -30,10 +41,13 @@ export declare function getAppRootFromWebappPath(webappPath: string): Promise<st
|
|
|
30
41
|
* - Freestyle application (non CAP) has in package.json dependency to @sap/ux-ui5-tooling and <appRoot>/ui5-local.yaml.
|
|
31
42
|
*
|
|
32
43
|
* @param path - path to check, e.g. to the manifest.json
|
|
33
|
-
* @param
|
|
44
|
+
* @param options - optional mem-fs-editor instance or options object with optional memFs and cache
|
|
34
45
|
* @returns - in case a supported app is found this function returns the appRoot and projectRoot path
|
|
35
46
|
*/
|
|
36
|
-
export declare function findRootsForPath(path: string,
|
|
47
|
+
export declare function findRootsForPath(path: string, options?: Editor | {
|
|
48
|
+
memFs?: Editor;
|
|
49
|
+
cache?: FileMapAndCache;
|
|
50
|
+
}): Promise<{
|
|
37
51
|
appRoot: string;
|
|
38
52
|
projectRoot: string;
|
|
39
53
|
} | null>;
|
|
@@ -42,10 +56,13 @@ export declare function findRootsForPath(path: string, memFs?: Editor): Promise<
|
|
|
42
56
|
*
|
|
43
57
|
* @param path - path inside CAP project
|
|
44
58
|
* @param checkForAppRouter - if true, checks for app router in CAP project app folder
|
|
45
|
-
* @param
|
|
59
|
+
* @param options - optional mem-fs-editor instance or options object with optional memFs and cache
|
|
46
60
|
* @returns - CAP project root path
|
|
47
61
|
*/
|
|
48
|
-
export declare function findCapProjectRoot(path: string, checkForAppRouter?: boolean,
|
|
62
|
+
export declare function findCapProjectRoot(path: string, checkForAppRouter?: boolean, options?: Editor | {
|
|
63
|
+
memFs?: Editor;
|
|
64
|
+
cache?: FileMapAndCache;
|
|
65
|
+
}): Promise<string | null>;
|
|
49
66
|
/**
|
|
50
67
|
* Find all app that are supported by Fiori tools for a given list of roots (workspace folders).
|
|
51
68
|
* This is a convenient function to retrieve all apps. Same result can be achieved with call
|
|
@@ -62,7 +79,7 @@ export declare function findAllApps(wsFolders: readonly WorkspaceFolder[] | stri
|
|
|
62
79
|
* @param options - find options
|
|
63
80
|
* @param options.wsFolders - list of roots, either as vscode WorkspaceFolder[] or array of paths
|
|
64
81
|
* @param options.artifacts - list of artifacts to search for: 'application', 'adaptation', 'extension' see FioriArtifactTypes
|
|
65
|
-
* @param options.memFs
|
|
82
|
+
* @param options.memFs - optional mem-fs-editor instance
|
|
66
83
|
* @returns - data structure containing the search results, for app e.g. as path to app plus files already parsed, e.g. manifest.json
|
|
67
84
|
*/
|
|
68
85
|
export declare function findFioriArtifacts(options: {
|
|
@@ -80,4 +97,5 @@ export declare function findFioriArtifacts(options: {
|
|
|
80
97
|
export declare function findCapProjects(options: {
|
|
81
98
|
readonly wsFolders: WorkspaceFolder[] | string[];
|
|
82
99
|
}): Promise<string[]>;
|
|
100
|
+
export {};
|
|
83
101
|
//# sourceMappingURL=search.d.ts.map
|
package/dist/project/search.js
CHANGED
|
@@ -136,6 +136,36 @@ async function getAppRootFromWebappPath(webappPath) {
|
|
|
136
136
|
}
|
|
137
137
|
return appRoot;
|
|
138
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* Type guard for Editor or Editor and FileMapAndCache.
|
|
141
|
+
*
|
|
142
|
+
* @param argument - argument to check
|
|
143
|
+
* @returns true if argument is Editor, false if it is FileMapAndCache
|
|
144
|
+
*/
|
|
145
|
+
function isEditor(argument) {
|
|
146
|
+
return argument.commit !== undefined;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Internal helper function to resolve options for findRootsForPath() and findCapProjectRoot().
|
|
150
|
+
*
|
|
151
|
+
* @param options - optional mem-fs-editor instance or options object with optional memFs and cache
|
|
152
|
+
* @returns memFs and cache
|
|
153
|
+
*/
|
|
154
|
+
function getFindOptions(options) {
|
|
155
|
+
let memFs;
|
|
156
|
+
let cache = { files: {}, capProjectType: new Map() };
|
|
157
|
+
if (options) {
|
|
158
|
+
// Check if options is Editor or { memFs?: Editor; cache?: FileMapAndCache }
|
|
159
|
+
if (isEditor(options)) {
|
|
160
|
+
memFs = options;
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
memFs = options.memFs;
|
|
164
|
+
cache = options.cache ?? cache;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return { memFs, cache };
|
|
168
|
+
}
|
|
139
169
|
/**
|
|
140
170
|
* Find the app root and project root folder for a given path. In case of apps in non CAP projects they are the same.
|
|
141
171
|
* This function also validates if an app is supported by tools considering Fiori elements apps and SAPUI5
|
|
@@ -149,28 +179,25 @@ async function getAppRootFromWebappPath(webappPath) {
|
|
|
149
179
|
* - Freestyle application (non CAP) has in package.json dependency to @sap/ux-ui5-tooling and <appRoot>/ui5-local.yaml.
|
|
150
180
|
*
|
|
151
181
|
* @param path - path to check, e.g. to the manifest.json
|
|
152
|
-
* @param
|
|
182
|
+
* @param options - optional mem-fs-editor instance or options object with optional memFs and cache
|
|
153
183
|
* @returns - in case a supported app is found this function returns the appRoot and projectRoot path
|
|
154
184
|
*/
|
|
155
|
-
async function findRootsForPath(path,
|
|
185
|
+
async function findRootsForPath(path, options) {
|
|
156
186
|
try {
|
|
187
|
+
const { memFs, cache } = getFindOptions(options);
|
|
157
188
|
// Get the root of the app, that is where the package.json is, otherwise not supported
|
|
158
189
|
const appRoot = await findProjectRoot(path, false, false, memFs);
|
|
159
190
|
if (!appRoot) {
|
|
160
191
|
return null;
|
|
161
192
|
}
|
|
162
|
-
|
|
193
|
+
cache.files[path] ??= await (0, file_1.readJSON)((0, path_1.join)(appRoot, constants_1.FileName.Package), memFs);
|
|
194
|
+
const appPckJson = cache.files[path];
|
|
163
195
|
// Check for most common app, Fiori elements with sapux=true in package.json
|
|
164
196
|
if (appPckJson.sapux) {
|
|
165
197
|
return findRootsWithSapux(appPckJson.sapux, path, appRoot);
|
|
166
198
|
}
|
|
167
|
-
if ((await (0, cap_1.getCapProjectType)(appRoot, memFs)) !== undefined) {
|
|
168
|
-
// App is part of a CAP project, but doesn't have own package.json and is not mentioned in sapux array
|
|
169
|
-
// in root -> not supported
|
|
170
|
-
return null;
|
|
171
|
-
}
|
|
172
199
|
// Check if app is included in CAP project
|
|
173
|
-
const projectRoot = await findCapProjectRoot(appRoot, undefined, memFs);
|
|
200
|
+
const projectRoot = await findCapProjectRoot(appRoot, undefined, { memFs, cache });
|
|
174
201
|
if (projectRoot) {
|
|
175
202
|
// App included in CAP
|
|
176
203
|
return {
|
|
@@ -198,18 +225,23 @@ async function findRootsForPath(path, memFs) {
|
|
|
198
225
|
*
|
|
199
226
|
* @param path - path inside CAP project
|
|
200
227
|
* @param checkForAppRouter - if true, checks for app router in CAP project app folder
|
|
201
|
-
* @param
|
|
228
|
+
* @param options - optional mem-fs-editor instance or options object with optional memFs and cache
|
|
202
229
|
* @returns - CAP project root path
|
|
203
230
|
*/
|
|
204
|
-
async function findCapProjectRoot(path, checkForAppRouter = true,
|
|
231
|
+
async function findCapProjectRoot(path, checkForAppRouter = true, options) {
|
|
205
232
|
try {
|
|
206
233
|
if (!(0, path_1.isAbsolute)(path)) {
|
|
207
234
|
return null;
|
|
208
235
|
}
|
|
236
|
+
const { memFs, cache } = getFindOptions(options);
|
|
209
237
|
const { root } = (0, path_1.parse)(path);
|
|
210
238
|
let projectRoot = (0, path_1.dirname)(path);
|
|
211
239
|
while (projectRoot !== root) {
|
|
212
|
-
if (
|
|
240
|
+
if (!cache.capProjectType.has(projectRoot)) {
|
|
241
|
+
cache.capProjectType.set(projectRoot, await (0, cap_1.getCapProjectType)(projectRoot, memFs));
|
|
242
|
+
}
|
|
243
|
+
const capProjectType = cache.capProjectType.get(projectRoot);
|
|
244
|
+
if (capProjectType) {
|
|
213
245
|
// We have found a CAP project as root. Check if the found app is not directly in CAP's 'app/' folder.
|
|
214
246
|
// Sometime there is a <CAP_ROOT>/app/package.json file that is used for app router (not an app)
|
|
215
247
|
// or skip app router check if checkForAppRouter is false and return the project root.
|
|
@@ -246,23 +278,26 @@ async function findAllApps(wsFolders, memFs) {
|
|
|
246
278
|
* @returns - results as path to apps plus files already parsed, e.g. manifest.json
|
|
247
279
|
*/
|
|
248
280
|
async function filterApplications(pathMap, memFs) {
|
|
249
|
-
const
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
281
|
+
const result = [];
|
|
282
|
+
const manifestPaths = Object.keys(pathMap.files).filter((path) => (0, path_1.basename)(path) === constants_1.FileName.Manifest);
|
|
283
|
+
for (const manifestPath of manifestPaths) {
|
|
284
|
+
try {
|
|
285
|
+
// All UI5 apps have at least sap.app: { id: <ID>, type: "application" } in manifest.json
|
|
286
|
+
pathMap.files[manifestPath] ??= await (0, file_1.readJSON)(manifestPath, memFs);
|
|
287
|
+
const manifest = pathMap.files[manifestPath];
|
|
288
|
+
if (!manifest['sap.app']?.id || manifest['sap.app'].type !== 'application') {
|
|
289
|
+
continue;
|
|
290
|
+
}
|
|
291
|
+
const roots = await findRootsForPath((0, path_1.dirname)(manifestPath), { memFs, cache: pathMap });
|
|
255
292
|
if (roots && !(await (0, file_1.fileExists)((0, path_1.join)(roots.appRoot, '.adp', constants_1.FileName.AdaptationConfig), memFs))) {
|
|
256
|
-
|
|
293
|
+
result.push({ appRoot: roots.appRoot, projectRoot: roots.projectRoot, manifest, manifestPath });
|
|
257
294
|
}
|
|
258
295
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
return
|
|
264
|
-
.filter(isFulFilled) // returning only valid applications
|
|
265
|
-
.map(({ value }) => value);
|
|
296
|
+
catch {
|
|
297
|
+
// ignore exceptions for invalid manifests
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
return result;
|
|
266
301
|
}
|
|
267
302
|
/**
|
|
268
303
|
* Filter adaptation projects from a list of files.
|
|
@@ -273,7 +308,7 @@ async function filterApplications(pathMap, memFs) {
|
|
|
273
308
|
*/
|
|
274
309
|
async function filterAdaptations(pathMap, memFs) {
|
|
275
310
|
const results = [];
|
|
276
|
-
const manifestAppDescrVars = Object.keys(pathMap).filter((path) => path.endsWith(constants_1.FileName.ManifestAppDescrVar));
|
|
311
|
+
const manifestAppDescrVars = Object.keys(pathMap.files).filter((path) => path.endsWith(constants_1.FileName.ManifestAppDescrVar));
|
|
277
312
|
for (const manifestAppDescrVar of manifestAppDescrVars) {
|
|
278
313
|
const packageJsonPath = await (0, file_1.findFileUp)(constants_1.FileName.Package, (0, path_1.dirname)(manifestAppDescrVar), memFs);
|
|
279
314
|
const projectRoot = packageJsonPath ? (0, path_1.dirname)(packageJsonPath) : null;
|
|
@@ -292,14 +327,14 @@ async function filterAdaptations(pathMap, memFs) {
|
|
|
292
327
|
*/
|
|
293
328
|
async function filterExtensions(pathMap, memFs) {
|
|
294
329
|
const results = [];
|
|
295
|
-
const extensionConfigs = Object.keys(pathMap).filter((path) => (0, path_1.basename)(path) === constants_1.FileName.ExtConfigJson);
|
|
330
|
+
const extensionConfigs = Object.keys(pathMap.files).filter((path) => (0, path_1.basename)(path) === constants_1.FileName.ExtConfigJson);
|
|
296
331
|
for (const extensionConfig of extensionConfigs) {
|
|
297
332
|
try {
|
|
298
333
|
let manifest = null;
|
|
299
334
|
let manifestPath = Object.keys(pathMap).find((path) => path.startsWith((0, path_1.dirname)(extensionConfig) + path_1.sep) && (0, path_1.basename)(path) === constants_1.FileName.Manifest);
|
|
300
335
|
if (manifestPath) {
|
|
301
|
-
pathMap[manifestPath] ??= await (0, file_1.readJSON)(manifestPath, memFs);
|
|
302
|
-
manifest = pathMap[manifestPath];
|
|
336
|
+
pathMap.files[manifestPath] ??= await (0, file_1.readJSON)(manifestPath, memFs);
|
|
337
|
+
manifest = pathMap.files[manifestPath];
|
|
303
338
|
}
|
|
304
339
|
else {
|
|
305
340
|
const manifests = await (0, file_1.findBy)({
|
|
@@ -333,7 +368,7 @@ async function filterExtensions(pathMap, memFs) {
|
|
|
333
368
|
*/
|
|
334
369
|
async function filterDotLibraries(pathMap, manifestPaths, memFs) {
|
|
335
370
|
const dotLibraries = [];
|
|
336
|
-
const dotLibraryPaths = Object.keys(pathMap)
|
|
371
|
+
const dotLibraryPaths = Object.keys(pathMap.files)
|
|
337
372
|
.filter((path) => (0, path_1.basename)(path) === constants_1.FileName.Library)
|
|
338
373
|
.map((path) => (0, path_1.dirname)(path))
|
|
339
374
|
.filter((path) => !manifestPaths.map((manifestPath) => (0, path_1.dirname)(manifestPath)).includes(path));
|
|
@@ -354,12 +389,12 @@ async function filterDotLibraries(pathMap, manifestPaths, memFs) {
|
|
|
354
389
|
*/
|
|
355
390
|
async function filterLibraries(pathMap, memFs) {
|
|
356
391
|
const results = [];
|
|
357
|
-
const manifestPaths = Object.keys(pathMap).filter((path) => (0, path_1.basename)(path) === constants_1.FileName.Manifest);
|
|
392
|
+
const manifestPaths = Object.keys(pathMap.files).filter((path) => (0, path_1.basename)(path) === constants_1.FileName.Manifest);
|
|
358
393
|
results.push(...(await filterDotLibraries(pathMap, manifestPaths, memFs)));
|
|
359
394
|
for (const manifestPath of manifestPaths) {
|
|
360
395
|
try {
|
|
361
|
-
pathMap[manifestPath] ??= await (0, file_1.readJSON)(manifestPath, memFs);
|
|
362
|
-
const manifest = pathMap[manifestPath];
|
|
396
|
+
pathMap.files[manifestPath] ??= await (0, file_1.readJSON)(manifestPath, memFs);
|
|
397
|
+
const manifest = pathMap.files[manifestPath];
|
|
363
398
|
if (manifest['sap.app'] && manifest['sap.app'].type === 'library') {
|
|
364
399
|
const packageJsonPath = await (0, file_1.findFileUp)(constants_1.FileName.Package, (0, path_1.dirname)(manifestPath), memFs);
|
|
365
400
|
const projectRoot = packageJsonPath ? (0, path_1.dirname)(packageJsonPath) : null;
|
|
@@ -383,11 +418,11 @@ async function filterLibraries(pathMap, memFs) {
|
|
|
383
418
|
*/
|
|
384
419
|
async function filterComponents(pathMap, memFs) {
|
|
385
420
|
const results = [];
|
|
386
|
-
const manifestPaths = Object.keys(pathMap).filter((path) => (0, path_1.basename)(path) === constants_1.FileName.Manifest);
|
|
421
|
+
const manifestPaths = Object.keys(pathMap.files).filter((path) => (0, path_1.basename)(path) === constants_1.FileName.Manifest);
|
|
387
422
|
for (const manifestPath of manifestPaths) {
|
|
388
423
|
try {
|
|
389
|
-
pathMap[manifestPath] ??= await (0, file_1.readJSON)(manifestPath, memFs);
|
|
390
|
-
const manifest = pathMap[manifestPath];
|
|
424
|
+
pathMap.files[manifestPath] ??= await (0, file_1.readJSON)(manifestPath, memFs);
|
|
425
|
+
const manifest = pathMap.files[manifestPath];
|
|
391
426
|
if (manifest['sap.app'] && manifest['sap.app'].type === 'component') {
|
|
392
427
|
const packageJsonPath = await (0, file_1.findFileUp)(constants_1.FileName.Package, (0, path_1.dirname)(manifestPath), memFs);
|
|
393
428
|
const projectRoot = packageJsonPath ? (0, path_1.dirname)(packageJsonPath) : null;
|
|
@@ -423,14 +458,14 @@ function getFilterFileNames(artifacts) {
|
|
|
423
458
|
* @param options - find options
|
|
424
459
|
* @param options.wsFolders - list of roots, either as vscode WorkspaceFolder[] or array of paths
|
|
425
460
|
* @param options.artifacts - list of artifacts to search for: 'application', 'adaptation', 'extension' see FioriArtifactTypes
|
|
426
|
-
* @param options.memFs
|
|
461
|
+
* @param options.memFs - optional mem-fs-editor instance
|
|
427
462
|
* @returns - data structure containing the search results, for app e.g. as path to app plus files already parsed, e.g. manifest.json
|
|
428
463
|
*/
|
|
429
464
|
async function findFioriArtifacts(options) {
|
|
430
465
|
const results = {};
|
|
431
466
|
const fileNames = getFilterFileNames(options.artifacts);
|
|
432
467
|
const wsRoots = wsFoldersToRootPaths(options.wsFolders);
|
|
433
|
-
const pathMap = {};
|
|
468
|
+
const pathMap = { files: {}, capProjectType: new Map() };
|
|
434
469
|
for (const root of wsRoots) {
|
|
435
470
|
try {
|
|
436
471
|
const foundFiles = await (0, file_1.findBy)({
|
|
@@ -439,7 +474,7 @@ async function findFioriArtifacts(options) {
|
|
|
439
474
|
excludeFolders,
|
|
440
475
|
memFs: options.memFs
|
|
441
476
|
});
|
|
442
|
-
foundFiles.forEach((path) => (pathMap[path] = null));
|
|
477
|
+
foundFiles.forEach((path) => (pathMap.files[path] = null));
|
|
443
478
|
}
|
|
444
479
|
catch {
|
|
445
480
|
// ignore exceptions during find
|
|
@@ -14,4 +14,72 @@ export interface ReuseLib {
|
|
|
14
14
|
libRoot: string;
|
|
15
15
|
description?: string;
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Type definition for the library.xml file. Not complete, just parts we need.
|
|
19
|
+
*/
|
|
20
|
+
export interface LibraryXml {
|
|
21
|
+
library?: {
|
|
22
|
+
name: string;
|
|
23
|
+
vendor?: string;
|
|
24
|
+
version?: string;
|
|
25
|
+
copyright?: string;
|
|
26
|
+
title?: string;
|
|
27
|
+
documentation?: string;
|
|
28
|
+
dependencies?: {
|
|
29
|
+
dependency: {
|
|
30
|
+
libraryName: string;
|
|
31
|
+
}[];
|
|
32
|
+
};
|
|
33
|
+
appData?: {
|
|
34
|
+
manifest?: {
|
|
35
|
+
i18n?: string;
|
|
36
|
+
offline?: boolean;
|
|
37
|
+
deviceTypes?: {
|
|
38
|
+
desktop?: boolean;
|
|
39
|
+
phone?: boolean;
|
|
40
|
+
tablet?: boolean;
|
|
41
|
+
};
|
|
42
|
+
supportedTheme?: string | string[];
|
|
43
|
+
contentDensities?: {
|
|
44
|
+
cozy?: boolean;
|
|
45
|
+
compact?: boolean;
|
|
46
|
+
};
|
|
47
|
+
'sap.fiori'?: {
|
|
48
|
+
registrationId?: string;
|
|
49
|
+
archeType?: string;
|
|
50
|
+
};
|
|
51
|
+
'sap.platform.abap'?: {
|
|
52
|
+
uri?: string;
|
|
53
|
+
};
|
|
54
|
+
'sap.platform.hcp'?: {
|
|
55
|
+
uri?: string;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
selenium?: {
|
|
59
|
+
package?: string;
|
|
60
|
+
};
|
|
61
|
+
jscoverage?: {
|
|
62
|
+
exclude?: {
|
|
63
|
+
name: string;
|
|
64
|
+
}[];
|
|
65
|
+
};
|
|
66
|
+
documentation?: {
|
|
67
|
+
indexUrl?: string;
|
|
68
|
+
resolve?: string;
|
|
69
|
+
};
|
|
70
|
+
releasenotes?: {
|
|
71
|
+
url?: string;
|
|
72
|
+
resolve?: string;
|
|
73
|
+
};
|
|
74
|
+
ownership?: {
|
|
75
|
+
component?: string | {
|
|
76
|
+
name: string;
|
|
77
|
+
modules?: {
|
|
78
|
+
module: string[];
|
|
79
|
+
};
|
|
80
|
+
}[];
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
}
|
|
17
85
|
//# sourceMappingURL=index.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/project-access",
|
|
3
|
-
"version": "1.29.
|
|
3
|
+
"version": "1.29.8",
|
|
4
4
|
"description": "Library to access SAP Fiori tools projects",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"fast-xml-parser": "4.4.1",
|
|
27
27
|
"findit2": "2.2.3",
|
|
28
|
-
"json-parse-even-better-errors": "
|
|
28
|
+
"json-parse-even-better-errors": "4.0.0",
|
|
29
29
|
"mem-fs": "2.1.0",
|
|
30
30
|
"mem-fs-editor": "9.4.0",
|
|
31
31
|
"semver": "7.5.4",
|