@sap-ux/project-access 1.16.0 → 1.16.1
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/constants.d.ts +1 -0
- package/dist/constants.js +1 -0
- package/dist/project/cap.js +1 -1
- package/dist/project/info.js +7 -3
- package/dist/project/search.js +48 -22
- package/package.json +1 -1
package/dist/constants.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const FileName: {
|
|
2
2
|
readonly AdaptationConfig: "config.json";
|
|
3
|
+
readonly CapJavaApplicationYaml: "application.yaml";
|
|
3
4
|
readonly ExtConfigJson: ".extconfig.json";
|
|
4
5
|
readonly Manifest: "manifest.json";
|
|
5
6
|
readonly ManifestAppDescrVar: "manifest.appdescr_variant";
|
package/dist/constants.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.FileName = void 0;
|
|
4
4
|
exports.FileName = {
|
|
5
5
|
AdaptationConfig: 'config.json',
|
|
6
|
+
CapJavaApplicationYaml: 'application.yaml',
|
|
6
7
|
ExtConfigJson: '.extconfig.json',
|
|
7
8
|
Manifest: 'manifest.json',
|
|
8
9
|
ManifestAppDescrVar: 'manifest.appdescr_variant',
|
package/dist/project/cap.js
CHANGED
|
@@ -37,7 +37,7 @@ function isCapJavaProject(projectRoot, capCustomPaths) {
|
|
|
37
37
|
var _a;
|
|
38
38
|
return __awaiter(this, void 0, void 0, function* () {
|
|
39
39
|
const srv = (_a = capCustomPaths === null || capCustomPaths === void 0 ? void 0 : capCustomPaths.srv) !== null && _a !== void 0 ? _a : (yield getCapCustomPaths(projectRoot)).srv;
|
|
40
|
-
return (0, file_1.fileExists)((0, path_1.join)(projectRoot, srv, 'src', 'main', 'resources',
|
|
40
|
+
return (0, file_1.fileExists)((0, path_1.join)(projectRoot, srv, 'src', 'main', 'resources', constants_1.FileName.CapJavaApplicationYaml));
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
exports.isCapJavaProject = isCapJavaProject;
|
package/dist/project/info.js
CHANGED
|
@@ -96,17 +96,21 @@ exports.getAppType = getAppType;
|
|
|
96
96
|
function getApplicationType(application) {
|
|
97
97
|
return __awaiter(this, void 0, void 0, function* () {
|
|
98
98
|
let appType;
|
|
99
|
-
const
|
|
99
|
+
const rootPackageJsonPath = (0, path_1.join)(application.projectRoot, constants_1.FileName.Package);
|
|
100
|
+
const packageJson = (yield (0, file_1.fileExists)(rootPackageJsonPath)) ? yield (0, file_1.readJSON)(rootPackageJsonPath) : null;
|
|
100
101
|
if (application.projectRoot === application.appRoot) {
|
|
101
|
-
appType = packageJson.sapux ? 'SAP Fiori elements' : 'SAPUI5 freestyle';
|
|
102
|
+
appType = (packageJson === null || packageJson === void 0 ? void 0 : packageJson.sapux) ? 'SAP Fiori elements' : 'SAPUI5 freestyle';
|
|
102
103
|
}
|
|
103
|
-
else {
|
|
104
|
+
else if (packageJson) {
|
|
104
105
|
appType =
|
|
105
106
|
Array.isArray(packageJson.sapux) &&
|
|
106
107
|
packageJson.sapux.find((relAppPath) => (0, path_1.join)(application.projectRoot, ...relAppPath.split(/[/\\]/)) === application.appRoot)
|
|
107
108
|
? 'SAP Fiori elements'
|
|
108
109
|
: 'SAPUI5 freestyle';
|
|
109
110
|
}
|
|
111
|
+
else {
|
|
112
|
+
appType = 'SAPUI5 freestyle';
|
|
113
|
+
}
|
|
110
114
|
return appType;
|
|
111
115
|
});
|
|
112
116
|
}
|
package/dist/project/search.js
CHANGED
|
@@ -185,29 +185,44 @@ function findRootsForPath(path) {
|
|
|
185
185
|
};
|
|
186
186
|
}
|
|
187
187
|
// Project must be CAP, find project root
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
188
|
+
const projectRoot = yield findCapProjectRoot(appRoot);
|
|
189
|
+
if (projectRoot) {
|
|
190
|
+
return {
|
|
191
|
+
appRoot,
|
|
192
|
+
projectRoot
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
catch (_a) {
|
|
197
|
+
// Finding root should not throw error. Return null instead.
|
|
198
|
+
}
|
|
199
|
+
return null;
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Find CAP project root path.
|
|
204
|
+
*
|
|
205
|
+
* @param path - path inside CAP project
|
|
206
|
+
* @returns - CAP project root path
|
|
207
|
+
*/
|
|
208
|
+
function findCapProjectRoot(path) {
|
|
209
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
210
|
+
try {
|
|
211
|
+
const { root } = (0, path_1.parse)(path);
|
|
212
|
+
let projectRoot = (0, path_1.dirname)(path);
|
|
213
|
+
while (projectRoot !== root) {
|
|
214
|
+
if (yield (0, cap_1.getCapProjectType)(projectRoot)) {
|
|
215
|
+
// We have found a CAP project as root. Check if the found app is not directly in CAP's 'app/' folder.
|
|
216
|
+
// Sometime there is a <CAP_ROOT>/app/package.json file that is used for app router (not an app)
|
|
217
|
+
if ((0, path_1.join)(projectRoot, 'app') !== path) {
|
|
218
|
+
return projectRoot;
|
|
201
219
|
}
|
|
202
|
-
projectRoot = (0, path_1.dirname)(projectRoot);
|
|
203
220
|
}
|
|
204
|
-
|
|
205
|
-
catch (_a) {
|
|
206
|
-
// No project root can be found at parent folder.
|
|
221
|
+
projectRoot = (0, path_1.dirname)(projectRoot);
|
|
207
222
|
}
|
|
208
223
|
}
|
|
209
|
-
catch (
|
|
210
|
-
//
|
|
224
|
+
catch (_a) {
|
|
225
|
+
// No project root can be found at parent folder.
|
|
211
226
|
}
|
|
212
227
|
return null;
|
|
213
228
|
});
|
|
@@ -418,8 +433,8 @@ exports.findFioriArtifacts = findFioriArtifacts;
|
|
|
418
433
|
function findCapProjects(options) {
|
|
419
434
|
return __awaiter(this, void 0, void 0, function* () {
|
|
420
435
|
const result = new Set();
|
|
421
|
-
const excludeFolders = ['node_modules', 'dist', '
|
|
422
|
-
const fileNames = [constants_1.FileName.Pom, constants_1.FileName.Package];
|
|
436
|
+
const excludeFolders = ['node_modules', 'dist', 'webapp', 'MDKModule', 'gen'];
|
|
437
|
+
const fileNames = [constants_1.FileName.Pom, constants_1.FileName.Package, constants_1.FileName.CapJavaApplicationYaml];
|
|
423
438
|
const wsRoots = wsFoldersToRootPaths(options.wsFolders);
|
|
424
439
|
for (const root of wsRoots) {
|
|
425
440
|
const filesToCheck = yield (0, file_1.findBy)({
|
|
@@ -427,7 +442,18 @@ function findCapProjects(options) {
|
|
|
427
442
|
root,
|
|
428
443
|
excludeFolders
|
|
429
444
|
});
|
|
430
|
-
const
|
|
445
|
+
const appYamlsToCheck = Array.from(new Set(filesToCheck
|
|
446
|
+
.filter((file) => (0, path_1.basename)(file) === constants_1.FileName.CapJavaApplicationYaml)
|
|
447
|
+
.map((file) => (0, path_1.dirname)(file))));
|
|
448
|
+
const foldersToCheck = Array.from(new Set(filesToCheck
|
|
449
|
+
.filter((file) => (0, path_1.basename)(file) !== constants_1.FileName.CapJavaApplicationYaml)
|
|
450
|
+
.map((file) => (0, path_1.dirname)(file))));
|
|
451
|
+
for (const appYamlToCheck of appYamlsToCheck) {
|
|
452
|
+
const capRoot = yield findCapProjectRoot(appYamlToCheck);
|
|
453
|
+
if (capRoot) {
|
|
454
|
+
result.add(capRoot);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
431
457
|
for (const folderToCheck of foldersToCheck) {
|
|
432
458
|
if ((yield (0, cap_1.getCapProjectType)(folderToCheck)) !== undefined) {
|
|
433
459
|
result.add(folderToCheck);
|