@pega/custom-dx-components 0.26.7 → 0.26.8

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": "0.26.7",
3
+ "version": "0.26.8",
4
4
  "description": "Utility for building custom UI components",
5
5
  "bin": "./bin/index.js",
6
6
  "keywords": [
@@ -13,6 +13,7 @@ import {
13
13
  getComponentDirectoryPath,
14
14
  getComponents,
15
15
  getPegaServerConfig,
16
+ getServerType,
16
17
  sanitize,
17
18
  validateSemver,
18
19
  showVersion,
@@ -25,7 +26,9 @@ import {
25
26
  getConfigDefaults,
26
27
  getSubTypeLabel,
27
28
  getMaxComponentNameCount,
28
- getStandaloneMaxComponentNameCount
29
+ getStandaloneMaxLibraryCount,
30
+ getStandaloneMaxComponentNameCount,
31
+ getStandaloneMaxLibraryFromPrefixCount
29
32
  } from '../../util.js';
30
33
  import { COMPONENT_SCHEMA, SHARED_FILE_NAMES } from '../../constants.js';
31
34
 
@@ -305,7 +308,9 @@ addDebugLog("create", "", "+");
305
308
  options
306
309
  );
307
310
  } else {
311
+ const framework = "Constellation";
308
312
  const componentDefaults = getConfigDefaults();
313
+ const serverType = getServerType();
309
314
  const maxChars = isLibraryBased ? getMaxComponentNameCount() : getStandaloneMaxComponentNameCount();
310
315
  const questions = [
311
316
  {
@@ -354,7 +359,14 @@ addDebugLog("create", "", "+");
354
359
  },
355
360
  {
356
361
  name: 'componentName',
357
- message: `Enter component name (required) (${maxChars} max chars)`,
362
+ message: value => {
363
+ if (serverType === "launchpad") {
364
+ return `Enter component name (required)`;
365
+ }
366
+ else {
367
+ return `Enter component name (required) (${maxChars} max chars)`;
368
+ }
369
+ },
358
370
  validate: value => {
359
371
  /* value should not be empty
360
372
  It should not have spaces
@@ -362,7 +374,7 @@ addDebugLog("create", "", "+");
362
374
  Only case-insensitive alphanumeric values are allowed
363
375
  */
364
376
  if (value && !/^\d/.test(value) && value === sanitize(value)) {
365
- if (value.length > maxChars) {
377
+ if (value.length > maxChars && serverType != "launchpad") {
366
378
  return `${value.length - maxChars} too many characters.`
367
379
  }
368
380
  return true;
@@ -392,10 +404,24 @@ addDebugLog("create", "", "+");
392
404
  return 'Please provide semver compatible version e.g 0.0.1';
393
405
  },
394
406
  when: () => !isLibraryBased
395
- },
407
+ }
408
+
409
+ ];
410
+
411
+ const answers = await inquirer.prompt(questions);
412
+ const maxLibChars = await getStandaloneMaxLibraryCount(answers.componentName);
413
+
414
+ const libQuestions = [
396
415
  {
397
416
  name: 'library',
398
- message: 'Enter library name (required)',
417
+ message: value => {
418
+ if (serverType === "launchpad") {
419
+ return `Enter library name (required)`;
420
+ }
421
+ else {
422
+ return `Enter library name (required) (${maxLibChars} max chars)`;
423
+ }
424
+ },
399
425
  default: componentDefaults.library,
400
426
  validate: value => {
401
427
  /* value should not be empty
@@ -404,6 +430,9 @@ addDebugLog("create", "", "+");
404
430
  Only case-insensitive alphanumeric values are allowed
405
431
  */
406
432
  if (value && !/^\d/.test(value) && value === sanitize(value)) {
433
+ if (value.length > maxLibChars && serverType != "launchpad") {
434
+ return `${value.length - maxLibChars} too many characters.`
435
+ }
407
436
  return true;
408
437
  }
409
438
  return 'Only alphanumeric values are allowed, starting with alphabets';
@@ -418,32 +447,22 @@ addDebugLog("create", "", "+");
418
447
  }
419
448
  ];
420
449
 
421
- await inquirer.prompt(questions).then(async answers => {
422
- const {
423
- componentName,
424
- componentLabel,
425
- library,
426
- version,
450
+ const libAnswers = await inquirer.prompt(libQuestions);
451
+
452
+ await validateCompile(
453
+ {
454
+ componentName : answers.componentName,
455
+ componentLabel : answers.componentLabel,
456
+ library : libAnswers.library,
457
+ version : answers.version,
427
458
  framework,
428
- type,
429
- subtype,
430
- description
431
- } = answers;
432
-
433
- await validateCompile(
434
- {
435
- componentName,
436
- componentLabel,
437
- library,
438
- version,
439
- framework,
440
- type,
441
- subtype,
442
- description
443
- },
444
- options
445
- );
446
- });
459
+ type : answers.type,
460
+ subtype : answers.subtype,
461
+ description : libAnswers.description
462
+ },
463
+ options
464
+ );
465
+
447
466
  }
448
467
 
449
468
  addDebugLog("create", "END", "-");
@@ -14,6 +14,7 @@ import { checkPathAccess, showVersion ,
14
14
  compileMustacheTemplate,
15
15
  getComponentDirectoryPath,
16
16
  getPegaServerConfig,
17
+ getServerType,
17
18
  getComponents,
18
19
  sanitize,
19
20
  validateSemver,
@@ -26,10 +27,13 @@ import { checkPathAccess, showVersion ,
26
27
  getConfigDefaults,
27
28
  getSubTypeLabel,
28
29
  getMaxPrefixCount,
29
- getStandaloneMaxPrefixCount
30
+ getStandaloneMaxPrefixCount,
31
+ getMaxComponentLibraryCount,
32
+ getStandaloneMaxLibraryFromPrefixCount
30
33
  } from '../../util.js';
31
34
 
32
35
  import { COMPONENT_SCHEMA, COMPONENTS_DIRECTORY_PATH, TASKS_CONFIG_JSON_FILENAME, COMPONENTS_PATH, CATEGORY_CONSTELLATION, SHARED_FILE_NAMES } from '../../constants.js';
36
+ import lib from 'babel-loader';
33
37
 
34
38
  export const DXCB_CONFIG_INTERNAL_JSON_FILENAME = 'src/dxcb.config.json';
35
39
 
@@ -405,17 +409,25 @@ addDebugLog("createAll", "", "+");
405
409
  );
406
410
  } else {
407
411
  const maxPrefixCount = isLibraryBased ? getMaxPrefixCount() : getStandaloneMaxPrefixCount();
412
+ const serverType = getServerType();
408
413
  const questions = [
409
414
  {
410
415
  name: 'prefix',
411
- message: `Enter prefix label (${maxPrefixCount} max chars)`,
412
- validate: value => {
416
+ message: value => {
417
+ if (serverType === "launchpad") {
418
+ return `Enter prefix label`;
419
+ }
420
+ else {
421
+ return `Enter prefix label (${maxPrefixCount} max chars)`;
422
+ }
423
+ },
424
+ validate: value => {
413
425
  /* value should not be empty
414
426
  It should not start with a number
415
427
  Only case-insensitive alphanumeric values are allowed
416
428
  */
417
429
  if (value && !/^\d/.test(value) ) {
418
- if (value.length > maxPrefixCount) {
430
+ if (value.length > maxPrefixCount && serverType != "launchpad") {
419
431
  return `${value.length - maxPrefixCount} too many characters.`
420
432
  }
421
433
  return true;
@@ -435,10 +447,24 @@ addDebugLog("createAll", "", "+");
435
447
  return 'Please provide semver compatible version e.g 0.0.1';
436
448
  },
437
449
  when: () => !isLibraryBased
438
- },
439
- {
450
+ }
451
+
452
+ ];
453
+
454
+ const answers = await inquirer.prompt(questions);
455
+ const maxLibChars = await getStandaloneMaxLibraryFromPrefixCount(answers.prefix);
456
+
457
+ const libQuestions = [
458
+ {
440
459
  name: 'library',
441
- message: 'Enter library name (required)',
460
+ message: value => {
461
+ if (serverType === "launchpad") {
462
+ return `Enter library name (required)`;
463
+ }
464
+ else {
465
+ return `Enter library name (required) (${maxLibChars} max chars)`;
466
+ }
467
+ },
442
468
  default: componentDefaults.library,
443
469
  validate: (value) => {
444
470
  /* value should not be empty
@@ -447,6 +473,9 @@ addDebugLog("createAll", "", "+");
447
473
  Only case-insensitive alphanumeric values are allowed
448
474
  */
449
475
  if (value && !/^\d/.test(value) && value === sanitize(value)) {
476
+ if (value.length > maxLibChars && serverType != "launchpad") {
477
+ return `${value.length - maxLibChars} too many characters.`
478
+ }
450
479
  return true;
451
480
  }
452
481
  return 'Only alphanumeric values are allowed, starting with alphabets';
@@ -455,28 +484,28 @@ addDebugLog("createAll", "", "+");
455
484
  }
456
485
  ];
457
486
 
458
- await inquirer.prompt(questions).then(async (answers) => {
459
- ({library} = answers);
487
+ const libAnswers = await inquirer.prompt(libQuestions);
488
+ library = libAnswers.library;
460
489
 
461
- if (isLibraryBased) {
462
- // library comes from config
463
- const orgLib = getConfigDefaults();
464
- library = orgLib.library;
465
- }
490
+ if (isLibraryBased) {
491
+ // library comes from config
492
+ const orgLib = getConfigDefaults();
493
+ library = orgLib.library;
494
+ }
495
+
496
+ const { version } = answers;
497
+ let { prefix } = answers;
498
+ prefix = prefix.replace(/[^a-zA-Z0-9 ]/g, '');
499
+ await validateCompileAll(
500
+ {
501
+ prefix,
502
+ library,
503
+ version,
504
+ organization
505
+ },
506
+ options
507
+ );
466
508
 
467
- const { version } = answers;
468
- let { prefix } = answers;
469
- prefix = prefix.replace(/[^a-zA-Z0-9 ]/g, '');
470
- await validateCompileAll(
471
- {
472
- prefix,
473
- library,
474
- version,
475
- organization
476
- },
477
- options
478
- );
479
- });
480
509
  }
481
510
 
482
511
  addDebugLog("createAll", "END", "-");
@@ -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
 
@@ -31,6 +31,7 @@
31
31
  "publishAll": "custom-dx-components publishAll",
32
32
  "promoteWebPack": "custom-dx-components promoteWebPack",
33
33
  "revertWebPack": "custom-dx-components revertWebPack",
34
+ "exportRC": "custom-dx-components exportRC",
34
35
  "_***Library_mode_only***": "Library CL mode only commands",
35
36
  "createLib": "custom-dx-components createLibrary",
36
37
  "switchLib": "custom-dx-components switchLibrary",
@@ -107,7 +108,7 @@
107
108
  "@babel/preset-react": "^7.27.1",
108
109
  "@babel/preset-typescript": "^7.27.1",
109
110
  "@pega/configs": "^0.16.3",
110
- "@pega/custom-dx-components": "~0.26.7",
111
+ "@pega/custom-dx-components": "~0.26.8",
111
112
  "@pega/pcore-pconnect-typedefs": "^4.1.0",
112
113
  "@storybook/addon-docs": "^9.1.7",
113
114
  "@storybook/addon-essentials": "^9.0.0-alpha.12",
@@ -419,9 +419,22 @@ export default async (option) => {
419
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
420
  }
421
421
 
422
- if (data.componentKey.indexOf(componentToValidate) !== 0) {
422
+ if (data.componentKey !== componentToValidate) {
423
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
+ if (data.name !== componentToValidate) {
427
+ throw new Error (`${chalk.redBright(`Error: Invalid folder name or name in config.json for component '${data.name}'.\n --> Component folder name: '${componentToValidate}' must match name '${data.name}'.\n --> NOTE: Values are case sensitve.`)}`);
428
+ }
429
+
430
+ }
431
+ else {
432
+ if (data.componentKey !== componentToValidate) {
433
+ 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.`)}`);
434
+ }
424
435
 
436
+ if (data.name !== componentToValidate) {
437
+ throw new Error (`${chalk.redBright(`Error: Invalid folder name or name in config.json for component '${data.name}'.\n --> Component folder name: '${componentToValidate}' must match name '${data.name}'.\n --> NOTE: Values are case sensitve.`)}`);
425
438
  }
426
439
 
427
440
  }
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);
@@ -2822,7 +2839,20 @@ export const getSubTypeLabel = (type, subtype) => {
2822
2839
  export const getMaxComponentNameCount = () => {
2823
2840
  let count = MAX_RFT_CHARS;
2824
2841
  const configDef = getConfigDefaults();
2825
- const orgLibCount = configDef.currentOrgLib.length + 1;
2842
+ const orgLibCount = configDef.currentOrgLib.length + 1; // trailing underscore
2843
+ const versionCount = configDef.version.length - 2;
2844
+ const prefixCount = versionCount + 4;
2845
+
2846
+ count = count - orgLibCount - prefixCount - 9; // 9 chars for trailing hash
2847
+
2848
+ return count;
2849
+
2850
+ }
2851
+
2852
+ export const getMaxComponentLibraryCount = (componentName) => {
2853
+ let count = MAX_RFT_CHARS;
2854
+ const configDef = getConfigDefaults();
2855
+ const orgLibCount = configDef.organization.length + componentName.length + 2; // 2 underscores
2826
2856
  const versionCount = configDef.version.length - 2;
2827
2857
  const prefixCount = versionCount + 4;
2828
2858
 
@@ -2843,16 +2873,35 @@ export const getStandaloneMaxComponentNameCount = () => {
2843
2873
 
2844
2874
  }
2845
2875
 
2876
+ export const getStandaloneMaxLibraryCount = async(componentName) => {
2877
+
2878
+ let count = MAX_RFT_CHARS;
2879
+ const configDef = await getConfigDefaults();
2880
+ const orgComp = `${configDef.organization}__${componentName}`;
2881
+ const orgCompCount = orgComp.length + 1;
2882
+
2883
+ count = count - orgCompCount; // 9 chars for trailing hash
2884
+
2885
+ return count;
2886
+
2887
+ }
2888
+
2846
2889
  export const getMaxPrefixCount = () => {
2847
2890
  // TwoColumnDetails is 16 chars
2848
2891
  return (getMaxComponentNameCount() - 16);
2849
2892
  }
2850
2893
 
2894
+
2895
+
2851
2896
  export const getStandaloneMaxPrefixCount = () => {
2852
2897
  // TwoColumnDetails is 16 chars
2853
2898
  return (getStandaloneMaxComponentNameCount() - 16);
2854
2899
  }
2855
2900
 
2901
+ export const getStandaloneMaxLibraryFromPrefixCount = async(componentName) => {
2902
+ return (await getStandaloneMaxLibraryCount(componentName) - 16);
2903
+ }
2904
+
2856
2905
  export const isComponentValidLength = (componentKey) => {
2857
2906
  const serverType = getServerType();
2858
2907
  if (serverType === "launchpad") {