@sap-ux/project-access 1.28.7 → 1.28.9
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/file/file-search.d.ts +4 -1
- package/dist/file/file-search.js +6 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -1
- package/dist/project/index.d.ts +1 -1
- package/dist/project/index.js +2 -1
- package/dist/project/ui5-config.d.ts +14 -1
- package/dist/project/ui5-config.js +22 -2
- package/package.json +2 -2
|
@@ -8,6 +8,7 @@ import type { Editor } from 'mem-fs-editor';
|
|
|
8
8
|
* @param options.root - folder to start recursive search
|
|
9
9
|
* @param [options.excludeFolders] - optional array of folder names to exclude
|
|
10
10
|
* @param [options.memFs] - optional memfs editor instance
|
|
11
|
+
* @param [options.noTraversal] - optional flag to disable root path traversal
|
|
11
12
|
* @returns - array of paths that contain the file
|
|
12
13
|
*/
|
|
13
14
|
export declare function findBy(options: {
|
|
@@ -15,6 +16,7 @@ export declare function findBy(options: {
|
|
|
15
16
|
extensionNames?: string[];
|
|
16
17
|
root: string;
|
|
17
18
|
excludeFolders?: string[];
|
|
19
|
+
noTraversal?: boolean;
|
|
18
20
|
memFs?: Editor;
|
|
19
21
|
}): Promise<string[]>;
|
|
20
22
|
/**
|
|
@@ -34,9 +36,10 @@ export declare function findFiles(filename: string, root: string, excludeFolders
|
|
|
34
36
|
* @param root - root folder to start search
|
|
35
37
|
* @param excludeFolders - list of folder names to exclude (search doesn't traverse into these folders)
|
|
36
38
|
* @param [memFs] - optional mem-fs-editor instance
|
|
39
|
+
* @param noTraversal - optional flag to disable root path traversal
|
|
37
40
|
* @returns - array of file paths that have the extension
|
|
38
41
|
*/
|
|
39
|
-
export declare function findFilesByExtension(extension: string, root: string, excludeFolders: string[], memFs?: Editor): Promise<string[]>;
|
|
42
|
+
export declare function findFilesByExtension(extension: string, root: string, excludeFolders: string[], memFs?: Editor, noTraversal?: boolean): Promise<string[]>;
|
|
40
43
|
/**
|
|
41
44
|
* Find a file by name in parent folders starting from 'startPath'.
|
|
42
45
|
*
|
package/dist/file/file-search.js
CHANGED
|
@@ -43,6 +43,7 @@ function getMemFsChanges(changes, fileNames, extensionNames) {
|
|
|
43
43
|
* @param options.root - folder to start recursive search
|
|
44
44
|
* @param [options.excludeFolders] - optional array of folder names to exclude
|
|
45
45
|
* @param [options.memFs] - optional memfs editor instance
|
|
46
|
+
* @param [options.noTraversal] - optional flag to disable root path traversal
|
|
46
47
|
* @returns - array of paths that contain the file
|
|
47
48
|
*/
|
|
48
49
|
function findBy(options) {
|
|
@@ -51,10 +52,11 @@ function findBy(options) {
|
|
|
51
52
|
const fileNames = Array.isArray(options.fileNames) ? options.fileNames : [];
|
|
52
53
|
const extensionNames = Array.isArray(options.extensionNames) ? options.extensionNames : [];
|
|
53
54
|
const excludeFolders = Array.isArray(options.excludeFolders) ? options.excludeFolders : [];
|
|
55
|
+
const noTraversal = options.noTraversal ?? false;
|
|
54
56
|
const finder = (0, findit2_1.default)(options.root);
|
|
55
57
|
finder.on('directory', (dir, _stat, stop) => {
|
|
56
58
|
const base = (0, path_1.basename)(dir);
|
|
57
|
-
if (excludeFolders.includes(base)) {
|
|
59
|
+
if (excludeFolders.includes(base) || (noTraversal && dir !== options.root)) {
|
|
58
60
|
stop();
|
|
59
61
|
}
|
|
60
62
|
});
|
|
@@ -97,10 +99,11 @@ async function findFiles(filename, root, excludeFolders, memFs) {
|
|
|
97
99
|
* @param root - root folder to start search
|
|
98
100
|
* @param excludeFolders - list of folder names to exclude (search doesn't traverse into these folders)
|
|
99
101
|
* @param [memFs] - optional mem-fs-editor instance
|
|
102
|
+
* @param noTraversal - optional flag to disable root path traversal
|
|
100
103
|
* @returns - array of file paths that have the extension
|
|
101
104
|
*/
|
|
102
|
-
function findFilesByExtension(extension, root, excludeFolders, memFs) {
|
|
103
|
-
return findBy({ extensionNames: [extension], root, excludeFolders, memFs });
|
|
105
|
+
function findFilesByExtension(extension, root, excludeFolders, memFs, noTraversal) {
|
|
106
|
+
return findBy({ extensionNames: [extension], root, excludeFolders, noTraversal, memFs });
|
|
104
107
|
}
|
|
105
108
|
/**
|
|
106
109
|
* Find a file by name in parent folders starting from 'startPath'.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { FileName, DirName, FioriToolsSettings } from './constants';
|
|
2
2
|
export { getFilePaths } from './file';
|
|
3
|
-
export { addPackageDevDependency, clearCdsModuleCache, createApplicationAccess, createProjectAccess, deleteCapApp, filterDataSourcesByType, findAllApps, findCapProjectRoot, findCapProjects, findFioriArtifacts, findProjectRoot, findRootsForPath, getAppRootFromWebappPath, getAppProgrammingLanguage, getAppType, getCapCustomPaths, getCapEnvironment, getCapModelAndServices, getCapServiceName, getCapProjectType, getCdsFiles, getCdsRoots, getCdsServices, getCapI18nFolderNames, getSpecification, getSpecificationPath, getI18nPropertiesPaths, getMinUI5VersionFromManifest, getMinUI5VersionAsArray, getMinimumUI5Version, getMtaPath, getNodeModulesPath, getProject, getProjectType, getWebappPath, hasUI5CliV3, isCapProject, isCapJavaProject, isCapNodeJsProject, loadModuleFromProject, readCapServiceMetadataEdmx, readUi5Yaml, refreshSpecificationDistTags, toReferenceUri, updatePackageScript } from './project';
|
|
3
|
+
export { addPackageDevDependency, clearCdsModuleCache, createApplicationAccess, createProjectAccess, deleteCapApp, filterDataSourcesByType, findAllApps, findCapProjectRoot, findCapProjects, findFioriArtifacts, findProjectRoot, findRootsForPath, getAllUi5YamlFileNames, getAppRootFromWebappPath, getAppProgrammingLanguage, getAppType, getCapCustomPaths, getCapEnvironment, getCapModelAndServices, getCapServiceName, getCapProjectType, getCdsFiles, getCdsRoots, getCdsServices, getCapI18nFolderNames, getSpecification, getSpecificationPath, getI18nPropertiesPaths, getMinUI5VersionFromManifest, getMinUI5VersionAsArray, getMinimumUI5Version, getMtaPath, getNodeModulesPath, getProject, getProjectType, getWebappPath, hasUI5CliV3, isCapProject, isCapJavaProject, isCapNodeJsProject, loadModuleFromProject, readCapServiceMetadataEdmx, readUi5Yaml, refreshSpecificationDistTags, toReferenceUri, updatePackageScript } from './project';
|
|
4
4
|
export { execNpmCommand } from './command/npm-command';
|
|
5
5
|
export * from './types';
|
|
6
6
|
export * from './library';
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,8 @@ 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.
|
|
17
|
+
exports.updatePackageScript = exports.toReferenceUri = exports.refreshSpecificationDistTags = exports.readUi5Yaml = exports.readCapServiceMetadataEdmx = exports.loadModuleFromProject = exports.isCapNodeJsProject = exports.isCapJavaProject = exports.isCapProject = exports.hasUI5CliV3 = exports.getWebappPath = exports.getProjectType = exports.getProject = exports.getNodeModulesPath = exports.getMtaPath = exports.getMinimumUI5Version = exports.getMinUI5VersionAsArray = exports.getMinUI5VersionFromManifest = exports.getI18nPropertiesPaths = exports.getSpecificationPath = exports.getSpecification = exports.getCapI18nFolderNames = exports.getCdsServices = exports.getCdsRoots = exports.getCdsFiles = exports.getCapProjectType = exports.getCapServiceName = exports.getCapModelAndServices = exports.getCapEnvironment = exports.getCapCustomPaths = exports.getAppType = exports.getAppProgrammingLanguage = exports.getAppRootFromWebappPath = exports.getAllUi5YamlFileNames = exports.findRootsForPath = exports.findProjectRoot = exports.findFioriArtifacts = exports.findCapProjects = exports.findCapProjectRoot = exports.findAllApps = exports.filterDataSourcesByType = exports.deleteCapApp = exports.createProjectAccess = exports.createApplicationAccess = exports.clearCdsModuleCache = exports.addPackageDevDependency = exports.getFilePaths = exports.FioriToolsSettings = exports.DirName = exports.FileName = void 0;
|
|
18
|
+
exports.execNpmCommand = void 0;
|
|
18
19
|
var constants_1 = require("./constants");
|
|
19
20
|
Object.defineProperty(exports, "FileName", { enumerable: true, get: function () { return constants_1.FileName; } });
|
|
20
21
|
Object.defineProperty(exports, "DirName", { enumerable: true, get: function () { return constants_1.DirName; } });
|
|
@@ -34,6 +35,7 @@ Object.defineProperty(exports, "findCapProjects", { enumerable: true, get: funct
|
|
|
34
35
|
Object.defineProperty(exports, "findFioriArtifacts", { enumerable: true, get: function () { return project_1.findFioriArtifacts; } });
|
|
35
36
|
Object.defineProperty(exports, "findProjectRoot", { enumerable: true, get: function () { return project_1.findProjectRoot; } });
|
|
36
37
|
Object.defineProperty(exports, "findRootsForPath", { enumerable: true, get: function () { return project_1.findRootsForPath; } });
|
|
38
|
+
Object.defineProperty(exports, "getAllUi5YamlFileNames", { enumerable: true, get: function () { return project_1.getAllUi5YamlFileNames; } });
|
|
37
39
|
Object.defineProperty(exports, "getAppRootFromWebappPath", { enumerable: true, get: function () { return project_1.getAppRootFromWebappPath; } });
|
|
38
40
|
Object.defineProperty(exports, "getAppProgrammingLanguage", { enumerable: true, get: function () { return project_1.getAppProgrammingLanguage; } });
|
|
39
41
|
Object.defineProperty(exports, "getAppType", { enumerable: true, get: function () { return project_1.getAppType; } });
|
package/dist/project/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export { getCapI18nFolderNames, getI18nPropertiesPaths } from './i18n';
|
|
|
5
5
|
export { getAppProgrammingLanguage, getAppType, getMinUI5VersionFromManifest, getMinUI5VersionAsArray, getMinimumUI5Version, getProject, getProjectType } from './info';
|
|
6
6
|
export { loadModuleFromProject } from './module-loader';
|
|
7
7
|
export { findAllApps, findCapProjects, findFioriArtifacts, findProjectRoot, getAppRootFromWebappPath, findCapProjectRoot, findRootsForPath } from './search';
|
|
8
|
-
export { getWebappPath, readUi5Yaml } from './ui5-config';
|
|
8
|
+
export { getWebappPath, readUi5Yaml, getAllUi5YamlFileNames } from './ui5-config';
|
|
9
9
|
export { getMtaPath } from './mta';
|
|
10
10
|
export { createApplicationAccess, createProjectAccess } from './access';
|
|
11
11
|
export { updatePackageScript, hasUI5CliV3 } from './script';
|
package/dist/project/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.refreshSpecificationDistTags = exports.getSpecificationPath = exports.getSpecification = exports.hasUI5CliV3 = exports.updatePackageScript = exports.createProjectAccess = exports.createApplicationAccess = exports.getMtaPath = exports.readUi5Yaml = exports.getWebappPath = exports.findRootsForPath = exports.findCapProjectRoot = exports.getAppRootFromWebappPath = exports.findProjectRoot = exports.findFioriArtifacts = exports.findCapProjects = exports.findAllApps = exports.loadModuleFromProject = exports.getProjectType = exports.getProject = exports.getMinimumUI5Version = exports.getMinUI5VersionAsArray = exports.getMinUI5VersionFromManifest = exports.getAppType = exports.getAppProgrammingLanguage = exports.getI18nPropertiesPaths = exports.getCapI18nFolderNames = exports.getNodeModulesPath = exports.addPackageDevDependency = exports.filterDataSourcesByType = exports.toReferenceUri = exports.readCapServiceMetadataEdmx = exports.isCapNodeJsProject = exports.isCapJavaProject = exports.isCapProject = exports.getCdsServices = exports.getCdsRoots = exports.getCdsFiles = exports.getCapServiceName = exports.getCapProjectType = exports.getCapModelAndServices = exports.getCapEnvironment = exports.getCapCustomPaths = exports.deleteCapApp = exports.clearCdsModuleCache = void 0;
|
|
3
|
+
exports.refreshSpecificationDistTags = exports.getSpecificationPath = exports.getSpecification = exports.hasUI5CliV3 = exports.updatePackageScript = exports.createProjectAccess = exports.createApplicationAccess = exports.getMtaPath = exports.getAllUi5YamlFileNames = exports.readUi5Yaml = exports.getWebappPath = exports.findRootsForPath = exports.findCapProjectRoot = exports.getAppRootFromWebappPath = exports.findProjectRoot = exports.findFioriArtifacts = exports.findCapProjects = exports.findAllApps = exports.loadModuleFromProject = exports.getProjectType = exports.getProject = exports.getMinimumUI5Version = exports.getMinUI5VersionAsArray = exports.getMinUI5VersionFromManifest = exports.getAppType = exports.getAppProgrammingLanguage = exports.getI18nPropertiesPaths = exports.getCapI18nFolderNames = exports.getNodeModulesPath = exports.addPackageDevDependency = exports.filterDataSourcesByType = exports.toReferenceUri = exports.readCapServiceMetadataEdmx = exports.isCapNodeJsProject = exports.isCapJavaProject = exports.isCapProject = exports.getCdsServices = exports.getCdsRoots = exports.getCdsFiles = exports.getCapServiceName = exports.getCapProjectType = exports.getCapModelAndServices = exports.getCapEnvironment = exports.getCapCustomPaths = exports.deleteCapApp = exports.clearCdsModuleCache = void 0;
|
|
4
4
|
var cap_1 = require("./cap");
|
|
5
5
|
Object.defineProperty(exports, "clearCdsModuleCache", { enumerable: true, get: function () { return cap_1.clearCdsModuleCache; } });
|
|
6
6
|
Object.defineProperty(exports, "deleteCapApp", { enumerable: true, get: function () { return cap_1.deleteCapApp; } });
|
|
@@ -46,6 +46,7 @@ Object.defineProperty(exports, "findRootsForPath", { enumerable: true, get: func
|
|
|
46
46
|
var ui5_config_1 = require("./ui5-config");
|
|
47
47
|
Object.defineProperty(exports, "getWebappPath", { enumerable: true, get: function () { return ui5_config_1.getWebappPath; } });
|
|
48
48
|
Object.defineProperty(exports, "readUi5Yaml", { enumerable: true, get: function () { return ui5_config_1.readUi5Yaml; } });
|
|
49
|
+
Object.defineProperty(exports, "getAllUi5YamlFileNames", { enumerable: true, get: function () { return ui5_config_1.getAllUi5YamlFileNames; } });
|
|
49
50
|
var mta_1 = require("./mta");
|
|
50
51
|
Object.defineProperty(exports, "getMtaPath", { enumerable: true, get: function () { return mta_1.getMtaPath; } });
|
|
51
52
|
var access_1 = require("./access");
|
|
@@ -14,8 +14,21 @@ export declare function getWebappPath(projectRoot: string, memFs?: Editor): Prom
|
|
|
14
14
|
* @param projectRoot - path to project root
|
|
15
15
|
* @param fileName - name of yaml file to be read
|
|
16
16
|
* @param [memFs] - optional mem-fs editor instance
|
|
17
|
+
* @param options - options
|
|
18
|
+
* @param [options.validateSchema] - optional flag to validate the schema of the yaml file
|
|
17
19
|
* @returns {UI5Config} UI5 config file in yaml format
|
|
18
20
|
* @throws {Error} if file is not found
|
|
19
21
|
*/
|
|
20
|
-
export declare function readUi5Yaml(projectRoot: string, fileName: string, memFs?: Editor
|
|
22
|
+
export declare function readUi5Yaml(projectRoot: string, fileName: string, memFs?: Editor, options?: {
|
|
23
|
+
validateSchema: boolean;
|
|
24
|
+
}): Promise<UI5Config>;
|
|
25
|
+
/**
|
|
26
|
+
* Scans the project directory for ui5 configuration yaml files.
|
|
27
|
+
*
|
|
28
|
+
* @param projectRoot - path to project root, where ui5 configuration y*ml files are located
|
|
29
|
+
* @param [memFs] - optional mem-fs editor instance
|
|
30
|
+
* @returns list of valid and invalid UI5 configuration yaml file names
|
|
31
|
+
* @throws {Error} if an error occurs while reading files from projectRoot
|
|
32
|
+
*/
|
|
33
|
+
export declare function getAllUi5YamlFileNames(projectRoot: string, memFs?: Editor): Promise<string[]>;
|
|
21
34
|
//# sourceMappingURL=ui5-config.d.ts.map
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getWebappPath = getWebappPath;
|
|
4
4
|
exports.readUi5Yaml = readUi5Yaml;
|
|
5
|
+
exports.getAllUi5YamlFileNames = getAllUi5YamlFileNames;
|
|
5
6
|
const path_1 = require("path");
|
|
6
7
|
const ui5_config_1 = require("@sap-ux/ui5-config");
|
|
7
8
|
const constants_1 = require("../constants");
|
|
@@ -32,15 +33,34 @@ async function getWebappPath(projectRoot, memFs) {
|
|
|
32
33
|
* @param projectRoot - path to project root
|
|
33
34
|
* @param fileName - name of yaml file to be read
|
|
34
35
|
* @param [memFs] - optional mem-fs editor instance
|
|
36
|
+
* @param options - options
|
|
37
|
+
* @param [options.validateSchema] - optional flag to validate the schema of the yaml file
|
|
35
38
|
* @returns {UI5Config} UI5 config file in yaml format
|
|
36
39
|
* @throws {Error} if file is not found
|
|
37
40
|
*/
|
|
38
|
-
async function readUi5Yaml(projectRoot, fileName, memFs) {
|
|
41
|
+
async function readUi5Yaml(projectRoot, fileName, memFs, options) {
|
|
39
42
|
const ui5YamlPath = (0, path_1.join)(projectRoot, fileName);
|
|
40
43
|
if (await (0, file_1.fileExists)(ui5YamlPath, memFs)) {
|
|
41
44
|
const yamlString = await (0, file_1.readFile)(ui5YamlPath, memFs);
|
|
42
|
-
return await ui5_config_1.UI5Config.newInstance(yamlString);
|
|
45
|
+
return await ui5_config_1.UI5Config.newInstance(yamlString, { validateSchema: options?.validateSchema });
|
|
43
46
|
}
|
|
44
47
|
throw Error(`File '${fileName}' not found in project '${projectRoot}'`);
|
|
45
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Scans the project directory for ui5 configuration yaml files.
|
|
51
|
+
*
|
|
52
|
+
* @param projectRoot - path to project root, where ui5 configuration y*ml files are located
|
|
53
|
+
* @param [memFs] - optional mem-fs editor instance
|
|
54
|
+
* @returns list of valid and invalid UI5 configuration yaml file names
|
|
55
|
+
* @throws {Error} if an error occurs while reading files from projectRoot
|
|
56
|
+
*/
|
|
57
|
+
async function getAllUi5YamlFileNames(projectRoot, memFs) {
|
|
58
|
+
try {
|
|
59
|
+
const yamlFilePaths = await (0, file_1.findFilesByExtension)('.yaml', projectRoot, [], memFs, true);
|
|
60
|
+
return yamlFilePaths.map((path) => (0, path_1.basename)(path));
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
throw new Error(`There was an error reading files from the directory '${projectRoot}': ${error}`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
46
66
|
//# sourceMappingURL=ui5-config.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/project-access",
|
|
3
|
-
"version": "1.28.
|
|
3
|
+
"version": "1.28.9",
|
|
4
4
|
"description": "Library to access SAP Fiori tools projects",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"mem-fs-editor": "9.4.0",
|
|
31
31
|
"semver": "7.5.4",
|
|
32
32
|
"@sap-ux/i18n": "0.2.0",
|
|
33
|
-
"@sap-ux/ui5-config": "0.
|
|
33
|
+
"@sap-ux/ui5-config": "0.26.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/mem-fs": "1.1.2",
|