@sap-ux/project-access 1.24.0 → 1.25.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.
- package/dist/project/info.js +13 -10
- package/dist/project/search.js +3 -0
- package/dist/types/info/index.d.ts +4 -0
- package/package.json +1 -1
package/dist/project/info.js
CHANGED
|
@@ -17,10 +17,12 @@ const semver_1 = require("semver");
|
|
|
17
17
|
* @returns - project structure with project info like project type, apps, root folder
|
|
18
18
|
*/
|
|
19
19
|
async function getProject(root) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const
|
|
20
|
+
if (!(await (0, file_1.fileExists)((0, path_1.join)(root, constants_1.FileName.Package)))) {
|
|
21
|
+
throw new Error(`The project root folder '${root}' is not a Fiori project. No 'package.json' found.`);
|
|
22
|
+
}
|
|
23
|
+
const capProjectType = await (0, cap_1.getCapProjectType)(root);
|
|
24
|
+
const projectType = capProjectType ?? 'EDMXBackend';
|
|
25
|
+
const appFolders = await getAppFolders(root);
|
|
24
26
|
const apps = await getApps(root, appFolders);
|
|
25
27
|
return {
|
|
26
28
|
root,
|
|
@@ -30,17 +32,16 @@ async function getProject(root) {
|
|
|
30
32
|
}
|
|
31
33
|
exports.getProject = getProject;
|
|
32
34
|
/**
|
|
33
|
-
* Returns the
|
|
35
|
+
* Returns the applications for the project. For single app
|
|
34
36
|
* projects, this is just an array with one empty string. For CAP projects, this is an
|
|
35
37
|
* array of operating system specific relative paths to the apps.
|
|
36
38
|
*
|
|
37
|
-
* @param
|
|
39
|
+
* @param root - project root folder
|
|
38
40
|
* @returns - array of operating specific application folders
|
|
39
41
|
*/
|
|
40
|
-
function getAppFolders(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
: [''];
|
|
42
|
+
async function getAppFolders(root) {
|
|
43
|
+
const apps = await (0, search_1.findAllApps)([root]);
|
|
44
|
+
return apps.length > 0 ? apps.map((app) => (0, path_1.relative)(root, app.appRoot)) : [''];
|
|
44
45
|
}
|
|
45
46
|
/**
|
|
46
47
|
* Get the application structure for each application in the project.
|
|
@@ -69,6 +70,7 @@ async function getApps(root, appFolders) {
|
|
|
69
70
|
async function getApplicationStructure(root, appFolder) {
|
|
70
71
|
const appRoot = (0, path_1.join)(root, appFolder);
|
|
71
72
|
const absoluteWebappPath = await (0, ui5_config_1.getWebappPath)(appRoot);
|
|
73
|
+
const appType = (await getAppType(appRoot));
|
|
72
74
|
const manifest = (0, path_1.join)(absoluteWebappPath, constants_1.FileName.Manifest);
|
|
73
75
|
if (!(await (0, file_1.fileExists)(manifest))) {
|
|
74
76
|
return undefined;
|
|
@@ -80,6 +82,7 @@ async function getApplicationStructure(root, appFolder) {
|
|
|
80
82
|
const services = await (0, service_1.getServicesAndAnnotations)(manifest, manifestObject);
|
|
81
83
|
return {
|
|
82
84
|
appRoot,
|
|
85
|
+
appType,
|
|
83
86
|
manifest,
|
|
84
87
|
changes,
|
|
85
88
|
i18n,
|
package/dist/project/search.js
CHANGED
|
@@ -194,6 +194,9 @@ async function findRootsForPath(path) {
|
|
|
194
194
|
*/
|
|
195
195
|
async function findCapProjectRoot(path) {
|
|
196
196
|
try {
|
|
197
|
+
if (!(0, path_1.isAbsolute)(path)) {
|
|
198
|
+
return null;
|
|
199
|
+
}
|
|
197
200
|
const { root } = (0, path_1.parse)(path);
|
|
198
201
|
let projectRoot = (0, path_1.dirname)(path);
|
|
199
202
|
while (projectRoot !== root) {
|