@sap-ux/project-input-validator 0.4.0 → 0.5.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.
@@ -1,8 +1,23 @@
1
1
  /**
2
- * @param targetPath the target directory path.
3
- * @param appName the application directory name.
4
- * @param validateFioriAppFolder if true, validates the target path as a Fiori App project.
5
- * @returns true if validated for Fiori App Project and Project Folder. Otherwise appropriate validation message.
2
+ * Validates whether the specified target path is suitable for creating a Fiori App project.
3
+ * The function performs the following checks:
4
+ *
5
+ * 1. **CAP Project Check:** If `validateFioriAppFolder` is true, it checks if the target path is part of an existing CAP project.
6
+ * - Uses `findCapProjectRoot()` and `getCapProjectType()` to verify the presence of a CAP project.
7
+ * - Returns an error message if a CAP project is detected.
8
+ *
9
+ * 2. **Fiori App Project Check:** If `validateFioriAppFolder` is true, it checks if the target path contains a Fiori project.
10
+ * - Uses `findRootsForPath()` to determine if a Fiori application root exists.
11
+ * - Returns a success message if a valid Fiori app root is found, otherwise returns true.
12
+ *
13
+ * 3. **General Project Folder Check:**
14
+ * - Uses `validateProjectFolder()` to verify if the provided target path exists.
15
+ * - Ensures the target folder does not already contain a subfolder with the intended project name.
16
+ *
17
+ * @param targetPath - The target directory path where the Fiori app is to be created.
18
+ * @param appName - The application directory name.
19
+ * @param validateFioriAppFolder - If true, validates the target path as a Fiori App project folder.
20
+ * @returns A boolean value `true` if all validations pass; otherwise, an error message.
6
21
  */
7
- export declare function validateTargetFolderForFioriApp(targetPath: string, appName: string, validateFioriAppFolder?: boolean): Promise<string | boolean>;
22
+ export declare function validateFioriAppTargetFolder(targetPath: string, appName: string, validateFioriAppFolder?: boolean): Promise<string | boolean>;
8
23
  //# sourceMappingURL=project-path-validators.d.ts.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateTargetFolderForFioriApp = validateTargetFolderForFioriApp;
3
+ exports.validateFioriAppTargetFolder = validateFioriAppTargetFolder;
4
4
  const project_access_1 = require("@sap-ux/project-access");
5
5
  const validators_1 = require("./validators");
6
6
  const i18n_1 = require("../i18n");
@@ -25,12 +25,27 @@ async function validateFioriAppProjectFolder(targetDir) {
25
25
  }
26
26
  }
27
27
  /**
28
- * @param targetPath the target directory path.
29
- * @param appName the application directory name.
30
- * @param validateFioriAppFolder if true, validates the target path as a Fiori App project.
31
- * @returns true if validated for Fiori App Project and Project Folder. Otherwise appropriate validation message.
28
+ * Validates whether the specified target path is suitable for creating a Fiori App project.
29
+ * The function performs the following checks:
30
+ *
31
+ * 1. **CAP Project Check:** If `validateFioriAppFolder` is true, it checks if the target path is part of an existing CAP project.
32
+ * - Uses `findCapProjectRoot()` and `getCapProjectType()` to verify the presence of a CAP project.
33
+ * - Returns an error message if a CAP project is detected.
34
+ *
35
+ * 2. **Fiori App Project Check:** If `validateFioriAppFolder` is true, it checks if the target path contains a Fiori project.
36
+ * - Uses `findRootsForPath()` to determine if a Fiori application root exists.
37
+ * - Returns a success message if a valid Fiori app root is found, otherwise returns true.
38
+ *
39
+ * 3. **General Project Folder Check:**
40
+ * - Uses `validateProjectFolder()` to verify if the provided target path exists.
41
+ * - Ensures the target folder does not already contain a subfolder with the intended project name.
42
+ *
43
+ * @param targetPath - The target directory path where the Fiori app is to be created.
44
+ * @param appName - The application directory name.
45
+ * @param validateFioriAppFolder - If true, validates the target path as a Fiori App project folder.
46
+ * @returns A boolean value `true` if all validations pass; otherwise, an error message.
32
47
  */
33
- async function validateTargetFolderForFioriApp(targetPath, appName, validateFioriAppFolder) {
48
+ async function validateFioriAppTargetFolder(targetPath, appName, validateFioriAppFolder) {
34
49
  if (validateFioriAppFolder === true) {
35
50
  const isFioriValid = await validateFioriAppProjectFolder(targetPath);
36
51
  if (isFioriValid !== true) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap-ux/project-input-validator",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Library to validate Fiori project input formats",
5
5
  "repository": {
6
6
  "type": "git",