@sap-ux/project-input-validator 0.6.3 → 0.6.5
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/adp/validators.d.ts +2 -4
- package/dist/adp/validators.js +9 -13
- package/package.json +2 -2
package/dist/adp/validators.d.ts
CHANGED
|
@@ -36,18 +36,16 @@ export declare function validateProjectName(value: string, destinationPath: stri
|
|
|
36
36
|
* Validates that project name is valid for CUSTOMER_BASE layer.
|
|
37
37
|
*
|
|
38
38
|
* @param {string} value - The project name.
|
|
39
|
-
* @param {string} destinationPath - The project directory.
|
|
40
39
|
* @returns {string | boolean} If value is valid returns true otherwise error message.
|
|
41
40
|
*/
|
|
42
|
-
export declare function validateProjectNameExternal(value: string
|
|
41
|
+
export declare function validateProjectNameExternal(value: string): boolean | string;
|
|
43
42
|
/**
|
|
44
43
|
* Validates that project name is valid for VENDOR layer.
|
|
45
44
|
*
|
|
46
45
|
* @param {string} value - The project name.
|
|
47
|
-
* @param {string} destinationPath - The project directory.
|
|
48
46
|
* @returns {string | boolean} If value is valid returns true otherwise error message.
|
|
49
47
|
*/
|
|
50
|
-
export declare function validateProjectNameInternal(value: string
|
|
48
|
+
export declare function validateProjectNameInternal(value: string): boolean | string;
|
|
51
49
|
/**
|
|
52
50
|
* Validates that project name is unique in directory.
|
|
53
51
|
*
|
package/dist/adp/validators.js
CHANGED
|
@@ -45,7 +45,6 @@ function hasCustomerPrefix(value) {
|
|
|
45
45
|
function isDataSourceURI(uri) {
|
|
46
46
|
return /^(?!.*\/\/)\/([^\s]*)\/$/.test(uri);
|
|
47
47
|
}
|
|
48
|
-
const projectNamePattern = /^(\w\.\w|[a-zA-Z0-9]){1,61}$/;
|
|
49
48
|
/**
|
|
50
49
|
* Validates that the project name is not empty and it is correct for VENDOR and CUSTOMER_BASE layer.
|
|
51
50
|
*
|
|
@@ -63,46 +62,43 @@ function validateProjectName(value, destinationPath, isCustomerBase) {
|
|
|
63
62
|
return (0, i18n_1.t)('adp.projectNameUppercaseError');
|
|
64
63
|
}
|
|
65
64
|
if (!isCustomerBase) {
|
|
66
|
-
return validateProjectNameInternal(value
|
|
65
|
+
return validateProjectNameInternal(value);
|
|
67
66
|
}
|
|
68
67
|
else {
|
|
69
|
-
return validateProjectNameExternal(value
|
|
68
|
+
return validateProjectNameExternal(value);
|
|
70
69
|
}
|
|
71
70
|
}
|
|
72
71
|
/**
|
|
73
72
|
* Validates that project name is valid for CUSTOMER_BASE layer.
|
|
74
73
|
*
|
|
75
74
|
* @param {string} value - The project name.
|
|
76
|
-
* @param {string} destinationPath - The project directory.
|
|
77
75
|
* @returns {string | boolean} If value is valid returns true otherwise error message.
|
|
78
76
|
*/
|
|
79
|
-
function validateProjectNameExternal(value
|
|
77
|
+
function validateProjectNameExternal(value) {
|
|
80
78
|
if (value.length > 61 || value.toLocaleLowerCase().endsWith('component')) {
|
|
81
79
|
return (0, i18n_1.t)('adp.projectNameLengthErrorExt');
|
|
82
80
|
}
|
|
83
|
-
|
|
84
|
-
if (!projectNamePattern.test(value)) {
|
|
81
|
+
if (!/^[a-z][a-z0-9]*(\.[a-z][a-z0-9]*)*$/.test(value)) {
|
|
85
82
|
return (0, i18n_1.t)('adp.projectNameValidationErrorExt');
|
|
86
83
|
}
|
|
87
|
-
return
|
|
84
|
+
return true;
|
|
88
85
|
}
|
|
89
86
|
/**
|
|
90
87
|
* Validates that project name is valid for VENDOR layer.
|
|
91
88
|
*
|
|
92
89
|
* @param {string} value - The project name.
|
|
93
|
-
* @param {string} destinationPath - The project directory.
|
|
94
90
|
* @returns {string | boolean} If value is valid returns true otherwise error message.
|
|
95
91
|
*/
|
|
96
|
-
function validateProjectNameInternal(value
|
|
92
|
+
function validateProjectNameInternal(value) {
|
|
97
93
|
if (value.toLowerCase().startsWith('customer') ||
|
|
98
94
|
value.length > 61 ||
|
|
99
95
|
value.toLocaleLowerCase().endsWith('component')) {
|
|
100
96
|
return (0, i18n_1.t)('adp.projectNameLengthErrorInt');
|
|
101
97
|
}
|
|
102
|
-
if (
|
|
98
|
+
if (!/^[a-z]+[a-z0-9]*(\.[a-z]+[a-z0-9]*)+$/i.test(value)) {
|
|
103
99
|
return (0, i18n_1.t)('adp.projectNameValidationErrorInt');
|
|
104
100
|
}
|
|
105
|
-
return
|
|
101
|
+
return true;
|
|
106
102
|
}
|
|
107
103
|
/**
|
|
108
104
|
* Validates that project name is unique in directory.
|
|
@@ -144,7 +140,7 @@ function validateNamespaceAdp(namespace, projectName, isCustomerBase) {
|
|
|
144
140
|
if (namespace.length > 61 || namespace.toLowerCase().endsWith('component') === true) {
|
|
145
141
|
return (0, i18n_1.t)('adp.namespaceLengthError');
|
|
146
142
|
}
|
|
147
|
-
else if (namespace !== '' &&
|
|
143
|
+
else if (namespace !== '' && /^[a-z]+((\.)?[a-z0-9])*$/.test(namespace) === false) {
|
|
148
144
|
return (0, i18n_1.t)('adp.namespaceValidationError');
|
|
149
145
|
}
|
|
150
146
|
return true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/project-input-validator",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.5",
|
|
4
4
|
"description": "Library to validate Fiori project input formats",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"i18next": "23.5.1",
|
|
18
18
|
"validate-npm-package-name": "5.0.0",
|
|
19
|
-
"@sap-ux/project-access": "1.30.
|
|
19
|
+
"@sap-ux/project-access": "1.30.3"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/validate-npm-package-name": "4.0.1",
|