@pega/custom-dx-components 25.1.14 → 25.1.15
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
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
"@babel/preset-react": "^7.27.1",
|
|
109
109
|
"@babel/preset-typescript": "^7.27.1",
|
|
110
110
|
"@pega/configs": "^0.16.3",
|
|
111
|
-
"@pega/custom-dx-components": "~25.1.
|
|
111
|
+
"@pega/custom-dx-components": "~25.1.15",
|
|
112
112
|
"@pega/pcore-pconnect-typedefs": "^4.1.0",
|
|
113
113
|
"@storybook/addon-actions": "^8.6.14",
|
|
114
114
|
"@storybook/addon-essentials": "^8.6.14",
|
|
@@ -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,29 @@ 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
|
+
}
|
|
423
|
+
|
|
396
424
|
console.log(`${chalk.bold.green(componentToValidate)} schema is valid`);
|
|
397
425
|
} else {
|
|
398
426
|
throw new Error(`Invalid: ${ajv.errorsText(validateSchema.errors)}`);
|
|
399
427
|
}
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
|
|
400
432
|
};
|