@pega/custom-dx-components 0.26.6 → 0.26.7
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/package.json
CHANGED
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"@babel/preset-react": "^7.27.1",
|
|
108
108
|
"@babel/preset-typescript": "^7.27.1",
|
|
109
109
|
"@pega/configs": "^0.16.3",
|
|
110
|
-
"@pega/custom-dx-components": "~0.26.
|
|
110
|
+
"@pega/custom-dx-components": "~0.26.7",
|
|
111
111
|
"@pega/pcore-pconnect-typedefs": "^4.1.0",
|
|
112
112
|
"@storybook/addon-docs": "^9.1.7",
|
|
113
113
|
"@storybook/addon-essentials": "^9.0.0-alpha.12",
|
|
@@ -11,14 +11,17 @@ import {
|
|
|
11
11
|
import {
|
|
12
12
|
getComponentDirectoryPath,
|
|
13
13
|
getComponents,
|
|
14
|
-
getOOTBComponents,
|
|
15
14
|
isComponentValidLength,
|
|
16
|
-
|
|
15
|
+
getConfigDefaults,
|
|
16
|
+
getLibraryBasedCL } from '../../util.js';
|
|
17
17
|
|
|
18
18
|
const ajv = new Ajv({ allErrors: true });
|
|
19
19
|
|
|
20
20
|
const combinationTypes = ['PAGE', 'CASE'];
|
|
21
21
|
|
|
22
|
+
const configDef = getConfigDefaults();
|
|
23
|
+
const isLibraryBasedCL = getLibraryBasedCL();
|
|
24
|
+
|
|
22
25
|
const allowedSubtypes = [
|
|
23
26
|
...new Set([
|
|
24
27
|
...COMPONENT_SCHEMA.subtype.field.map(({ value }) => value),
|
|
@@ -343,6 +346,14 @@ export default async (option) => {
|
|
|
343
346
|
throw new Error(`Invalid: componentName is too long.`);
|
|
344
347
|
}
|
|
345
348
|
|
|
349
|
+
if (isLibraryBasedCL) {
|
|
350
|
+
if (componentToValidate.indexOf(configDef.currentOrgLib + "_") != 0) {
|
|
351
|
+
const arPrefix = componentToValidate.split("_");
|
|
352
|
+
const sPrefix = `${arPrefix[0]}_${arPrefix[1]}`;
|
|
353
|
+
throw new Error(`Component: ${componentToValidate} prefix invalid.\n --> '${sPrefix}' prefix does not match configuration '${configDef.currentOrgLib}'. \n --> Org_Lib prefix of component must match Organization and Library values \n --> in package.json and tasks.config.json respectively.`);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
346
357
|
const componentDirectory = await getComponentDirectoryPath(componentToValidate);
|
|
347
358
|
let configFileName = "config.json";
|
|
348
359
|
|
|
@@ -393,8 +404,34 @@ export default async (option) => {
|
|
|
393
404
|
process.exit(1);
|
|
394
405
|
}
|
|
395
406
|
|
|
407
|
+
if (isLibraryBasedCL) {
|
|
408
|
+
if (data.library !== configDef.library) {
|
|
409
|
+
throw new Error (`${chalk.redBright(`Error: Invalid library in config.json for component '${data.name}'.\n -->Library: '${data.library}' must match tasks.config library: '${configDef.library}'.`)}`);
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
if (data.organization !== configDef.organization) {
|
|
413
|
+
throw new Error (`${chalk.redBright(`Error: Invalid organization in config.json for component '${data.name}'.\n -->Organization: '${data.organization}' must match package.json organization: '${configDef.organization}'.`)}`);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
if (data.componentKey.indexOf(configDef.currentOrgLib + "_") !== 0) {
|
|
417
|
+
const arPrefix = data.componentKey.split("_");
|
|
418
|
+
const sPrefix = `${arPrefix[0]}_${arPrefix[1]}`
|
|
419
|
+
throw new Error (`${chalk.redBright(`Error: Invalid componentKey in config.json for component '${data.name}'.\n --> Component prefix Org_Lib: '${sPrefix}' must match '${configDef.currentOrgLib}'. \n --> These represent organization and library values found in package.json and tasks.config.json respectively. `)}`);
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
if (data.componentKey.indexOf(componentToValidate) !== 0) {
|
|
423
|
+
throw new Error (`${chalk.redBright(`Error: Invalid folder name or componentKey in config.json for component '${data.name}'.\n --> Component folder name: '${componentToValidate}' must match component key '${data.componentKey}'.\n --> NOTE: Values are case sensitve.`)}`);
|
|
424
|
+
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
}
|
|
428
|
+
|
|
396
429
|
console.log(`${chalk.bold.green(componentToValidate)} schema is valid`);
|
|
397
430
|
} else {
|
|
398
431
|
throw new Error(`Invalid: ${ajv.errorsText(validateSchema.errors)}`);
|
|
399
432
|
}
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
|
|
400
437
|
};
|