@pega/custom-dx-components 0.25.65 → 0.25.67
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 +2 -2
- package/package.json +1 -1
- package/src/tasks/create/index.js +39 -28
- package/src/tasks/create-all/index.js +45 -25
- package/src/tasks/import-comp/index.js +10 -5
- package/src/tasks/init/template/README.md +2 -2
- package/src/tasks/init/template/package.json.mustache +2 -2
- package/src/tasks/validator/index.js +52 -2
- package/src/util.js +61 -8
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 >=
|
|
40
|
+
- System node version >= 24.4.1
|
|
41
41
|
|
|
42
|
-
- System npm version
|
|
42
|
+
- System npm version 11.4.2
|
|
43
43
|
|
|
44
44
|
## Latest Documentation
|
|
45
45
|
|
package/package.json
CHANGED
|
@@ -26,7 +26,9 @@ import {
|
|
|
26
26
|
getConfigDefaults,
|
|
27
27
|
getSubTypeLabel,
|
|
28
28
|
getMaxComponentNameCount,
|
|
29
|
-
|
|
29
|
+
getStandaloneMaxLibraryCount,
|
|
30
|
+
getStandaloneMaxComponentNameCount,
|
|
31
|
+
getStandaloneMaxLibraryFromPrefixCount
|
|
30
32
|
} from '../../util.js';
|
|
31
33
|
import { COMPONENT_SCHEMA, SHARED_FILE_NAMES } from '../../constants.js';
|
|
32
34
|
|
|
@@ -38,6 +40,7 @@ const copyComponentTemplate = async options => {
|
|
|
38
40
|
});
|
|
39
41
|
};
|
|
40
42
|
|
|
43
|
+
|
|
41
44
|
const compileMustacheTemplates = async (
|
|
42
45
|
componentDirectory,
|
|
43
46
|
{
|
|
@@ -305,6 +308,7 @@ addDebugLog("create", "", "+");
|
|
|
305
308
|
options
|
|
306
309
|
);
|
|
307
310
|
} else {
|
|
311
|
+
const framework = "Constellation";
|
|
308
312
|
const componentDefaults = getConfigDefaults();
|
|
309
313
|
const serverType = getServerType();
|
|
310
314
|
const maxChars = isLibraryBased ? getMaxComponentNameCount() : getStandaloneMaxComponentNameCount();
|
|
@@ -400,10 +404,24 @@ addDebugLog("create", "", "+");
|
|
|
400
404
|
return 'Please provide semver compatible version e.g 0.0.1';
|
|
401
405
|
},
|
|
402
406
|
when: () => !isLibraryBased
|
|
403
|
-
}
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
];
|
|
410
|
+
|
|
411
|
+
const answers = await inquirer.prompt(questions);
|
|
412
|
+
const maxLibChars = await getStandaloneMaxLibraryCount(answers.componentName);
|
|
413
|
+
|
|
414
|
+
const libQuestions = [
|
|
404
415
|
{
|
|
405
416
|
name: 'library',
|
|
406
|
-
message:
|
|
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
|
+
},
|
|
407
425
|
default: componentDefaults.library,
|
|
408
426
|
validate: value => {
|
|
409
427
|
/* value should not be empty
|
|
@@ -412,6 +430,9 @@ addDebugLog("create", "", "+");
|
|
|
412
430
|
Only case-insensitive alphanumeric values are allowed
|
|
413
431
|
*/
|
|
414
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
|
+
}
|
|
415
436
|
return true;
|
|
416
437
|
}
|
|
417
438
|
return 'Only alphanumeric values are allowed, starting with alphabets';
|
|
@@ -426,32 +447,22 @@ addDebugLog("create", "", "+");
|
|
|
426
447
|
}
|
|
427
448
|
];
|
|
428
449
|
|
|
429
|
-
await inquirer.prompt(
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
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,
|
|
435
458
|
framework,
|
|
436
|
-
type,
|
|
437
|
-
subtype,
|
|
438
|
-
description
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
componentName,
|
|
444
|
-
componentLabel,
|
|
445
|
-
library,
|
|
446
|
-
version,
|
|
447
|
-
framework,
|
|
448
|
-
type,
|
|
449
|
-
subtype,
|
|
450
|
-
description
|
|
451
|
-
},
|
|
452
|
-
options
|
|
453
|
-
);
|
|
454
|
-
});
|
|
459
|
+
type : answers.type,
|
|
460
|
+
subtype : answers.subtype,
|
|
461
|
+
description : libAnswers.description
|
|
462
|
+
},
|
|
463
|
+
options
|
|
464
|
+
);
|
|
465
|
+
|
|
455
466
|
}
|
|
456
467
|
|
|
457
468
|
addDebugLog("create", "END", "-");
|
|
@@ -27,10 +27,13 @@ import { checkPathAccess, showVersion ,
|
|
|
27
27
|
getConfigDefaults,
|
|
28
28
|
getSubTypeLabel,
|
|
29
29
|
getMaxPrefixCount,
|
|
30
|
-
getStandaloneMaxPrefixCount
|
|
30
|
+
getStandaloneMaxPrefixCount,
|
|
31
|
+
getMaxComponentLibraryCount,
|
|
32
|
+
getStandaloneMaxLibraryFromPrefixCount
|
|
31
33
|
} from '../../util.js';
|
|
32
34
|
|
|
33
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';
|
|
34
37
|
|
|
35
38
|
export const DXCB_CONFIG_INTERNAL_JSON_FILENAME = 'src/dxcb.config.json';
|
|
36
39
|
|
|
@@ -418,7 +421,7 @@ addDebugLog("createAll", "", "+");
|
|
|
418
421
|
return `Enter prefix label (${maxPrefixCount} max chars)`;
|
|
419
422
|
}
|
|
420
423
|
},
|
|
421
|
-
|
|
424
|
+
validate: value => {
|
|
422
425
|
/* value should not be empty
|
|
423
426
|
It should not start with a number
|
|
424
427
|
Only case-insensitive alphanumeric values are allowed
|
|
@@ -444,10 +447,24 @@ addDebugLog("createAll", "", "+");
|
|
|
444
447
|
return 'Please provide semver compatible version e.g 0.0.1';
|
|
445
448
|
},
|
|
446
449
|
when: () => !isLibraryBased
|
|
447
|
-
}
|
|
448
|
-
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
];
|
|
453
|
+
|
|
454
|
+
const answers = await inquirer.prompt(questions);
|
|
455
|
+
const maxLibChars = await getStandaloneMaxLibraryFromPrefixCount(answers.prefix);
|
|
456
|
+
|
|
457
|
+
const libQuestions = [
|
|
458
|
+
{
|
|
449
459
|
name: 'library',
|
|
450
|
-
message:
|
|
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
|
+
},
|
|
451
468
|
default: componentDefaults.library,
|
|
452
469
|
validate: (value) => {
|
|
453
470
|
/* value should not be empty
|
|
@@ -456,6 +473,9 @@ addDebugLog("createAll", "", "+");
|
|
|
456
473
|
Only case-insensitive alphanumeric values are allowed
|
|
457
474
|
*/
|
|
458
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
|
+
}
|
|
459
479
|
return true;
|
|
460
480
|
}
|
|
461
481
|
return 'Only alphanumeric values are allowed, starting with alphabets';
|
|
@@ -464,28 +484,28 @@ addDebugLog("createAll", "", "+");
|
|
|
464
484
|
}
|
|
465
485
|
];
|
|
466
486
|
|
|
467
|
-
await inquirer.prompt(
|
|
468
|
-
|
|
487
|
+
const libAnswers = await inquirer.prompt(libQuestions);
|
|
488
|
+
library = libAnswers.library;
|
|
469
489
|
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
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
|
+
);
|
|
475
508
|
|
|
476
|
-
const { version } = answers;
|
|
477
|
-
let { prefix } = answers;
|
|
478
|
-
prefix = prefix.replace(/[^a-zA-Z0-9 ]/g, '');
|
|
479
|
-
await validateCompileAll(
|
|
480
|
-
{
|
|
481
|
-
prefix,
|
|
482
|
-
library,
|
|
483
|
-
version,
|
|
484
|
-
organization
|
|
485
|
-
},
|
|
486
|
-
options
|
|
487
|
-
);
|
|
488
|
-
});
|
|
489
509
|
}
|
|
490
510
|
|
|
491
511
|
addDebugLog("createAll", "END", "-");
|
|
@@ -49,6 +49,7 @@ export const updateConfig = async (
|
|
|
49
49
|
version,
|
|
50
50
|
targetDirectory,
|
|
51
51
|
newLabel = "",
|
|
52
|
+
organization
|
|
52
53
|
},
|
|
53
54
|
options,
|
|
54
55
|
onlyCompanion = false
|
|
@@ -63,6 +64,7 @@ addDebugLog("updateConfig", `oldComponentKey: ${oldComponentKey}, newComponentKe
|
|
|
63
64
|
if (configData.componentKey) configData.componentKey = newComponentKey;
|
|
64
65
|
configData.library = library;
|
|
65
66
|
configData.version = version;
|
|
67
|
+
configData.organization = organization;
|
|
66
68
|
|
|
67
69
|
if (newLabel != "") {
|
|
68
70
|
configData.label = newLabel;
|
|
@@ -97,17 +99,19 @@ addDebugLog("updateFile", `fileName: ${fileName}, oldComponentKeyPC: ${oldCompon
|
|
|
97
99
|
// rename the component
|
|
98
100
|
export const renameComponent = async (
|
|
99
101
|
componentKey,
|
|
100
|
-
|
|
102
|
+
orgLib,
|
|
101
103
|
version,
|
|
102
104
|
newName = "",
|
|
103
105
|
newLabel = "",
|
|
106
|
+
organization,
|
|
104
107
|
options
|
|
105
108
|
) => {
|
|
106
109
|
|
|
107
|
-
addDebugLog("renameComponent", `
|
|
110
|
+
addDebugLog("renameComponent", `orgLib: ${orgLib}, componentKey: ${componentKey}`, "");
|
|
108
111
|
|
|
109
112
|
const componentName = newName != "" ? newName : componentKey.split("_")[2];
|
|
110
|
-
const newComponentKey = `${
|
|
113
|
+
const newComponentKey = `${orgLib}_${componentName}`;
|
|
114
|
+
const library = orgLib.split("_")[1];
|
|
111
115
|
const oldComponentKey = componentKey;
|
|
112
116
|
const newComponentKeyPC = convertIntoPascalCase(newComponentKey);
|
|
113
117
|
const oldComponentKeyPC = convertIntoPascalCase(oldComponentKey);
|
|
@@ -136,7 +140,8 @@ addDebugLog("renameComponent", `library: ${library}, componentKey: ${componentKe
|
|
|
136
140
|
library,
|
|
137
141
|
version,
|
|
138
142
|
targetDirectory,
|
|
139
|
-
newLabel
|
|
143
|
+
newLabel,
|
|
144
|
+
organization
|
|
140
145
|
},
|
|
141
146
|
options
|
|
142
147
|
);
|
|
@@ -252,7 +257,7 @@ addDebugLog("importComp", `filePath: ${filePath}, fileName: ${fileName}`, "");
|
|
|
252
257
|
|
|
253
258
|
configData = configData && JSON.parse(configData);
|
|
254
259
|
|
|
255
|
-
const newCompKey = await renameComponent(configData.componentKey, configDef.currentOrgLib, configDef.buildVersion, newName, newLabel, null);
|
|
260
|
+
const newCompKey = await renameComponent(configData.componentKey, configDef.currentOrgLib, configDef.buildVersion, newName, newLabel, configDef.organization, null);
|
|
256
261
|
console.log(`\n${chalk.green(`${fileName}`)} has been imported as ${chalk.green(`${newCompKey}`)}\n`);
|
|
257
262
|
|
|
258
263
|
if (askValidate) {
|
|
@@ -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 >=
|
|
40
|
+
- System node version >= 24.4.1
|
|
41
41
|
|
|
42
|
-
- System npm version
|
|
42
|
+
- System npm version 11.4.2
|
|
43
43
|
|
|
44
44
|
## Latest Documentation
|
|
45
45
|
|
|
@@ -25,13 +25,13 @@
|
|
|
25
25
|
"delete": "custom-dx-components delete",
|
|
26
26
|
"deleteAll": "custom-dx-components deleteAll",
|
|
27
27
|
"importComponent": "custom-dx-components importComponent",
|
|
28
|
-
"exportRC" : "custom-dx-components exportRC",
|
|
29
28
|
"help": "custom-dx-components showHelp",
|
|
30
29
|
"publish": "custom-dx-components publish",
|
|
31
30
|
"_***Component_mode_only***": "Component only commands",
|
|
32
31
|
"publishAll": "custom-dx-components publishAll",
|
|
33
32
|
"promoteWebPack": "custom-dx-components promoteWebPack",
|
|
34
33
|
"revertWebPack": "custom-dx-components revertWebPack",
|
|
34
|
+
"exportRC" : "custom-dx-components exportRC",
|
|
35
35
|
"_***Library_mode_only***": "Library CL mode only commands",
|
|
36
36
|
"createLib": "custom-dx-components createLibrary",
|
|
37
37
|
"switchLib": "custom-dx-components switchLibrary",
|
|
@@ -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": "~
|
|
111
|
+
"@pega/custom-dx-components": "~25.1.22",
|
|
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,47 @@ 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
|
+
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
|
+
}
|
|
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.`)}`);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
}
|
|
441
|
+
|
|
396
442
|
console.log(`${chalk.bold.green(componentToValidate)} schema is valid`);
|
|
397
443
|
} else {
|
|
398
444
|
throw new Error(`Invalid: ${ajv.errorsText(validateSchema.errors)}`);
|
|
399
445
|
}
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
|
|
400
450
|
};
|
package/src/util.js
CHANGED
|
@@ -963,7 +963,7 @@ if (showDebug) { addDebugLog("getPegaConfig", "END", "-"); }
|
|
|
963
963
|
export const getPegaServerConfig = async (force = false) => {
|
|
964
964
|
if (showDebug) addDebugLog("getPegaServerConfig", "", "+");
|
|
965
965
|
if (!pegaConfig || force) {
|
|
966
|
-
pegaConfig = await getPegaConfig();
|
|
966
|
+
pegaConfig = await getPegaConfig(force);
|
|
967
967
|
|
|
968
968
|
if (getServerType() === "launchpad") {
|
|
969
969
|
|
|
@@ -1342,16 +1342,33 @@ export const showVersion = async () => {
|
|
|
1342
1342
|
process.exit();
|
|
1343
1343
|
}
|
|
1344
1344
|
|
|
1345
|
-
// do a check of node version, it should be
|
|
1345
|
+
// do a check of node version, it should be 24 or greater
|
|
1346
1346
|
const arNodeVersion = process.versions.node.split('.');
|
|
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 <
|
|
1352
|
+
if (nodeMajorVersion < 24) {
|
|
1352
1353
|
console.log(
|
|
1353
1354
|
chalk.redBright(
|
|
1354
|
-
`DX Component Builder - requires node
|
|
1355
|
+
`DX Component Builder - requires node v24.4.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.4.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.4.1 or greater, current version: ${process.version}`
|
|
1355
1372
|
)
|
|
1356
1373
|
);
|
|
1357
1374
|
process.exit(1);
|
|
@@ -1712,7 +1729,7 @@ if (showDebug) addDebugLog("getBootstrapConfig", `restServerUrl: ${restServerUrl
|
|
|
1712
1729
|
|
|
1713
1730
|
export const updateC11NB2SForInfinity = async () => {
|
|
1714
1731
|
if (showDebug) addDebugLog("updateC11NB2SForInfinity", "", "");
|
|
1715
|
-
const serverConfig = await getPegaServerConfig();
|
|
1732
|
+
const serverConfig = await getPegaServerConfig(true);
|
|
1716
1733
|
const { server } = serverConfig;
|
|
1717
1734
|
const OAuthData = fs.readFileSync(TOKEN_PATH, 'utf8');
|
|
1718
1735
|
|
|
@@ -2653,10 +2670,14 @@ if (showDebug) addDebugLog("deleteArchives", ``, "");
|
|
|
2653
2670
|
}
|
|
2654
2671
|
}
|
|
2655
2672
|
|
|
2656
|
-
export const checkLibraryAndArchives = async () => {
|
|
2673
|
+
export const checkLibraryAndArchives = async (checkArch = true) => {
|
|
2657
2674
|
if (showDebug) addDebugLog("checkLibraryAndArchives", ``, "");
|
|
2658
2675
|
const isLibraryBased = getLibraryBased();
|
|
2659
|
-
|
|
2676
|
+
let hasArch = true;
|
|
2677
|
+
if (checkArch) {
|
|
2678
|
+
hasArch = await hasArchives();
|
|
2679
|
+
|
|
2680
|
+
}
|
|
2660
2681
|
|
|
2661
2682
|
if (isLibraryBased && !hasArch) {
|
|
2662
2683
|
console.log(chalk.yellow('\nPlease create/import a library before proceeding.'));
|
|
@@ -2818,7 +2839,20 @@ export const getSubTypeLabel = (type, subtype) => {
|
|
|
2818
2839
|
export const getMaxComponentNameCount = () => {
|
|
2819
2840
|
let count = MAX_RFT_CHARS;
|
|
2820
2841
|
const configDef = getConfigDefaults();
|
|
2821
|
-
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
|
|
2822
2856
|
const versionCount = configDef.version.length - 2;
|
|
2823
2857
|
const prefixCount = versionCount + 4;
|
|
2824
2858
|
|
|
@@ -2839,16 +2873,35 @@ export const getStandaloneMaxComponentNameCount = () => {
|
|
|
2839
2873
|
|
|
2840
2874
|
}
|
|
2841
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
|
+
|
|
2842
2889
|
export const getMaxPrefixCount = () => {
|
|
2843
2890
|
// TwoColumnDetails is 16 chars
|
|
2844
2891
|
return (getMaxComponentNameCount() - 16);
|
|
2845
2892
|
}
|
|
2846
2893
|
|
|
2894
|
+
|
|
2895
|
+
|
|
2847
2896
|
export const getStandaloneMaxPrefixCount = () => {
|
|
2848
2897
|
// TwoColumnDetails is 16 chars
|
|
2849
2898
|
return (getStandaloneMaxComponentNameCount() - 16);
|
|
2850
2899
|
}
|
|
2851
2900
|
|
|
2901
|
+
export const getStandaloneMaxLibraryFromPrefixCount = async(componentName) => {
|
|
2902
|
+
return (await getStandaloneMaxLibraryCount(componentName) - 16);
|
|
2903
|
+
}
|
|
2904
|
+
|
|
2852
2905
|
export const isComponentValidLength = (componentKey) => {
|
|
2853
2906
|
const serverType = getServerType();
|
|
2854
2907
|
if (serverType === "launchpad") {
|