@sap-ux/project-access 1.17.5 → 1.18.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/constants.d.ts +1 -0
- package/dist/constants.js +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -1
- package/dist/project/cap.d.ts +7 -0
- package/dist/project/cap.js +13 -1
- package/dist/project/index.d.ts +1 -1
- package/dist/project/index.js +2 -1
- package/dist/project/search.js +30 -5
- package/dist/types/find/index.d.ts +6 -2
- package/package.json +1 -1
package/dist/constants.d.ts
CHANGED
|
@@ -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
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { FileName } from './constants';
|
|
2
2
|
export { getFilePaths } from './file';
|
|
3
|
-
export { createApplicationAccess, createProjectAccess, findAllApps, findCapProjects, findFioriArtifacts, findProjectRoot, getAppRootFromWebappPath, getAppProgrammingLanguage, getAppType, getCapCustomPaths, getCapEnvironment, getCapModelAndServices, getCapProjectType, getCdsFiles, getCdsRoots, getCdsServices, getCapI18nFolderNames, getI18nPropertiesPaths, getMtaPath, getNodeModulesPath, getProject, getProjectType, getWebappPath, isCapJavaProject, isCapNodeJsProject, loadModuleFromProject, readCapServiceMetadataEdmx, readUi5Yaml, toReferenceUri } from './project';
|
|
3
|
+
export { createApplicationAccess, createProjectAccess, findAllApps, findCapProjects, findFioriArtifacts, findProjectRoot, getAppRootFromWebappPath, getAppProgrammingLanguage, getAppType, getCapCustomPaths, getCapEnvironment, getCapModelAndServices, getCapProjectType, getCdsFiles, getCdsRoots, getCdsServices, getCapI18nFolderNames, getI18nPropertiesPaths, getMtaPath, getNodeModulesPath, getProject, getProjectType, getWebappPath, isCapProject, isCapJavaProject, isCapNodeJsProject, loadModuleFromProject, readCapServiceMetadataEdmx, readUi5Yaml, toReferenceUri } from './project';
|
|
4
4
|
export * from './types';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.toReferenceUri = exports.readUi5Yaml = exports.readCapServiceMetadataEdmx = exports.loadModuleFromProject = exports.isCapNodeJsProject = exports.isCapJavaProject = exports.getWebappPath = exports.getProjectType = exports.getProject = exports.getNodeModulesPath = exports.getMtaPath = exports.getI18nPropertiesPaths = exports.getCapI18nFolderNames = exports.getCdsServices = exports.getCdsRoots = exports.getCdsFiles = exports.getCapProjectType = exports.getCapModelAndServices = exports.getCapEnvironment = exports.getCapCustomPaths = exports.getAppType = exports.getAppProgrammingLanguage = exports.getAppRootFromWebappPath = exports.findProjectRoot = exports.findFioriArtifacts = exports.findCapProjects = exports.findAllApps = exports.createProjectAccess = exports.createApplicationAccess = exports.getFilePaths = exports.FileName = void 0;
|
|
17
|
+
exports.toReferenceUri = exports.readUi5Yaml = exports.readCapServiceMetadataEdmx = exports.loadModuleFromProject = exports.isCapNodeJsProject = exports.isCapJavaProject = exports.isCapProject = exports.getWebappPath = exports.getProjectType = exports.getProject = exports.getNodeModulesPath = exports.getMtaPath = exports.getI18nPropertiesPaths = exports.getCapI18nFolderNames = exports.getCdsServices = exports.getCdsRoots = exports.getCdsFiles = exports.getCapProjectType = exports.getCapModelAndServices = exports.getCapEnvironment = exports.getCapCustomPaths = exports.getAppType = exports.getAppProgrammingLanguage = exports.getAppRootFromWebappPath = exports.findProjectRoot = exports.findFioriArtifacts = exports.findCapProjects = exports.findAllApps = exports.createProjectAccess = exports.createApplicationAccess = exports.getFilePaths = exports.FileName = void 0;
|
|
18
18
|
var constants_1 = require("./constants");
|
|
19
19
|
Object.defineProperty(exports, "FileName", { enumerable: true, get: function () { return constants_1.FileName; } });
|
|
20
20
|
var file_1 = require("./file");
|
|
@@ -43,6 +43,7 @@ Object.defineProperty(exports, "getNodeModulesPath", { enumerable: true, get: fu
|
|
|
43
43
|
Object.defineProperty(exports, "getProject", { enumerable: true, get: function () { return project_1.getProject; } });
|
|
44
44
|
Object.defineProperty(exports, "getProjectType", { enumerable: true, get: function () { return project_1.getProjectType; } });
|
|
45
45
|
Object.defineProperty(exports, "getWebappPath", { enumerable: true, get: function () { return project_1.getWebappPath; } });
|
|
46
|
+
Object.defineProperty(exports, "isCapProject", { enumerable: true, get: function () { return project_1.isCapProject; } });
|
|
46
47
|
Object.defineProperty(exports, "isCapJavaProject", { enumerable: true, get: function () { return project_1.isCapJavaProject; } });
|
|
47
48
|
Object.defineProperty(exports, "isCapNodeJsProject", { enumerable: true, get: function () { return project_1.isCapNodeJsProject; } });
|
|
48
49
|
Object.defineProperty(exports, "loadModuleFromProject", { enumerable: true, get: function () { return project_1.loadModuleFromProject; } });
|
package/dist/project/cap.d.ts
CHANGED
|
@@ -27,6 +27,13 @@ export declare function isCapJavaProject(projectRoot: string, capCustomPaths?: C
|
|
|
27
27
|
* @returns - CAPJava for Java based CAP projects; CAPNodejs for node.js based CAP projects; undefined if it is no CAP project
|
|
28
28
|
*/
|
|
29
29
|
export declare function getCapProjectType(projectRoot: string): Promise<CapProjectType | undefined>;
|
|
30
|
+
/**
|
|
31
|
+
* Returns true if the project is either a CAP Node.js or a CAP Java project.
|
|
32
|
+
*
|
|
33
|
+
* @param projectRoot - the root path of the project
|
|
34
|
+
* @returns - true if the project is a CAP project
|
|
35
|
+
*/
|
|
36
|
+
export declare function isCapProject(projectRoot: string): Promise<boolean>;
|
|
30
37
|
/**
|
|
31
38
|
* Get CAP CDS project custom paths for project root.
|
|
32
39
|
*
|
package/dist/project/cap.js
CHANGED
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.toReferenceUri = exports.toAbsoluteUri = exports.getCapEnvironment = exports.readCapServiceMetadataEdmx = exports.getCdsServices = exports.getCdsRoots = exports.getCdsFiles = exports.getCapModelAndServices = exports.getCapCustomPaths = exports.getCapProjectType = exports.isCapJavaProject = exports.isCapNodeJsProject = void 0;
|
|
12
|
+
exports.toReferenceUri = exports.toAbsoluteUri = exports.getCapEnvironment = exports.readCapServiceMetadataEdmx = exports.getCdsServices = exports.getCdsRoots = exports.getCdsFiles = exports.getCapModelAndServices = exports.getCapCustomPaths = exports.isCapProject = exports.getCapProjectType = exports.isCapJavaProject = exports.isCapNodeJsProject = void 0;
|
|
13
13
|
const child_process_1 = require("child_process");
|
|
14
14
|
const path_1 = require("path");
|
|
15
15
|
const constants_1 = require("../constants");
|
|
@@ -70,6 +70,18 @@ function getCapProjectType(projectRoot) {
|
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
72
|
exports.getCapProjectType = getCapProjectType;
|
|
73
|
+
/**
|
|
74
|
+
* Returns true if the project is either a CAP Node.js or a CAP Java project.
|
|
75
|
+
*
|
|
76
|
+
* @param projectRoot - the root path of the project
|
|
77
|
+
* @returns - true if the project is a CAP project
|
|
78
|
+
*/
|
|
79
|
+
function isCapProject(projectRoot) {
|
|
80
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
+
return !!(yield getCapProjectType(projectRoot));
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
exports.isCapProject = isCapProject;
|
|
73
85
|
/**
|
|
74
86
|
* Get CAP CDS project custom paths for project root.
|
|
75
87
|
*
|
package/dist/project/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { getCapCustomPaths, getCapModelAndServices, getCapProjectType, getCdsFiles, getCdsRoots, getCdsServices, isCapJavaProject, isCapNodeJsProject, getCapEnvironment, readCapServiceMetadataEdmx, toReferenceUri } from './cap';
|
|
1
|
+
export { getCapCustomPaths, getCapModelAndServices, getCapProjectType, getCdsFiles, getCdsRoots, getCdsServices, isCapProject, isCapJavaProject, isCapNodeJsProject, getCapEnvironment, readCapServiceMetadataEdmx, toReferenceUri } from './cap';
|
|
2
2
|
export { getNodeModulesPath } from './dependencies';
|
|
3
3
|
export { getCapI18nFolderNames, getI18nPropertiesPaths } from './i18n';
|
|
4
4
|
export { getAppProgrammingLanguage, getAppType, getProject, getProjectType } from './info';
|
package/dist/project/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createProjectAccess = exports.createApplicationAccess = exports.getMtaPath = exports.readUi5Yaml = exports.getWebappPath = exports.getAppRootFromWebappPath = exports.findProjectRoot = exports.findFioriArtifacts = exports.findCapProjects = exports.findAllApps = exports.loadModuleFromProject = exports.getProjectType = exports.getProject = exports.getAppType = exports.getAppProgrammingLanguage = exports.getI18nPropertiesPaths = exports.getCapI18nFolderNames = exports.getNodeModulesPath = exports.toReferenceUri = exports.readCapServiceMetadataEdmx = exports.getCapEnvironment = exports.isCapNodeJsProject = exports.isCapJavaProject = exports.getCdsServices = exports.getCdsRoots = exports.getCdsFiles = exports.getCapProjectType = exports.getCapModelAndServices = exports.getCapCustomPaths = void 0;
|
|
3
|
+
exports.createProjectAccess = exports.createApplicationAccess = exports.getMtaPath = exports.readUi5Yaml = exports.getWebappPath = exports.getAppRootFromWebappPath = exports.findProjectRoot = exports.findFioriArtifacts = exports.findCapProjects = exports.findAllApps = exports.loadModuleFromProject = exports.getProjectType = exports.getProject = exports.getAppType = exports.getAppProgrammingLanguage = exports.getI18nPropertiesPaths = exports.getCapI18nFolderNames = exports.getNodeModulesPath = exports.toReferenceUri = exports.readCapServiceMetadataEdmx = exports.getCapEnvironment = exports.isCapNodeJsProject = exports.isCapJavaProject = exports.isCapProject = exports.getCdsServices = exports.getCdsRoots = exports.getCdsFiles = exports.getCapProjectType = exports.getCapModelAndServices = exports.getCapCustomPaths = void 0;
|
|
4
4
|
var cap_1 = require("./cap");
|
|
5
5
|
Object.defineProperty(exports, "getCapCustomPaths", { enumerable: true, get: function () { return cap_1.getCapCustomPaths; } });
|
|
6
6
|
Object.defineProperty(exports, "getCapModelAndServices", { enumerable: true, get: function () { return cap_1.getCapModelAndServices; } });
|
|
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "getCapProjectType", { enumerable: true, get: fun
|
|
|
8
8
|
Object.defineProperty(exports, "getCdsFiles", { enumerable: true, get: function () { return cap_1.getCdsFiles; } });
|
|
9
9
|
Object.defineProperty(exports, "getCdsRoots", { enumerable: true, get: function () { return cap_1.getCdsRoots; } });
|
|
10
10
|
Object.defineProperty(exports, "getCdsServices", { enumerable: true, get: function () { return cap_1.getCdsServices; } });
|
|
11
|
+
Object.defineProperty(exports, "isCapProject", { enumerable: true, get: function () { return cap_1.isCapProject; } });
|
|
11
12
|
Object.defineProperty(exports, "isCapJavaProject", { enumerable: true, get: function () { return cap_1.isCapJavaProject; } });
|
|
12
13
|
Object.defineProperty(exports, "isCapNodeJsProject", { enumerable: true, get: function () { return cap_1.isCapNodeJsProject; } });
|
|
13
14
|
Object.defineProperty(exports, "getCapEnvironment", { enumerable: true, get: function () { return cap_1.getCapEnvironment; } });
|
package/dist/project/search.js
CHANGED
|
@@ -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
|
-
|
|
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
|
|
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
|
|
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[];
|