@pega/custom-dx-components 26.1.10-alpha-0.1 → 26.1.10-alpha-0.2

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/README.md CHANGED
@@ -37,9 +37,9 @@ Ensure you have access to the following in your system:
37
37
 
38
38
  - Git version 2.30 or later
39
39
 
40
- - System node version >= 22.15.0
40
+ - System node version >= 24.4.1
41
41
 
42
- - System npm version 10.9.2
42
+ - System npm version 11.4.2
43
43
 
44
44
  ## Latest Documentation
45
45
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/custom-dx-components",
3
- "version": "26.1.10-alpha-0.1",
3
+ "version": "26.1.10-alpha-0.2",
4
4
  "description": "Utility for building custom UI components",
5
5
  "bin": "./bin/index.js",
6
6
  "keywords": [
@@ -37,9 +37,9 @@ Ensure you have access to the following in your system:
37
37
 
38
38
  - Git version 2.30 or later
39
39
 
40
- - System node version >= 22.15.0
40
+ - System node version >= 24.4.1
41
41
 
42
- - System npm version 10.9.2
42
+ - System npm version 11.4.2
43
43
 
44
44
  ## Latest Documentation
45
45
 
@@ -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": "~26.1.10-alpha-0.1",
110
+ "@pega/custom-dx-components": "~26.1.10-alpha-0.2",
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
- addDebugLog } from '../../util.js';
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,33 @@ 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 !== componentToValidate) {
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
+
396
428
  console.log(`${chalk.bold.green(componentToValidate)} schema is valid`);
397
429
  } else {
398
430
  throw new Error(`Invalid: ${ajv.errorsText(validateSchema.errors)}`);
399
431
  }
432
+
433
+
434
+
435
+
400
436
  };
package/src/util.js CHANGED
@@ -1347,11 +1347,28 @@ export const showVersion = async () => {
1347
1347
 
1348
1348
  const nodeMajorVersion = parseInt(arNodeVersion[0]);
1349
1349
  const nodeMinorVersion = parseInt(arNodeVersion[1]);
1350
+ const nodePatchVersion = parseInt(arNodeVersion[2]);
1350
1351
 
1351
- if (nodeMajorVersion < 22 && nodeMinorVersion < 15 ) {
1352
+ if (nodeMajorVersion < 24) {
1352
1353
  console.log(
1353
1354
  chalk.redBright(
1354
- `DX Component Builder - requires node v22.15.0 or greater, current version: ${process.version}`
1355
+ `DX Component Builder - requires node v24.14.1 or greater, current version: ${process.version}`
1356
+ )
1357
+ );
1358
+ process.exit(1);
1359
+ }
1360
+ else if ( nodeMajorVersion == 24 && nodeMinorVersion < 4) {
1361
+ console.log(
1362
+ chalk.redBright(
1363
+ `DX Component Builder - requires node v24.14.1 or greater, current version: ${process.version}`
1364
+ )
1365
+ );
1366
+ process.exit(1);
1367
+ }
1368
+ else if (nodeMajorVersion == 24 && nodeMinorVersion == 4 && nodePatchVersion < 1 ) {
1369
+ console.log(
1370
+ chalk.redBright(
1371
+ `DX Component Builder - requires node v24.14.1 or greater, current version: ${process.version}`
1355
1372
  )
1356
1373
  );
1357
1374
  process.exit(1);