@pega/custom-dx-components 0.25.45 → 0.25.46

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.
Files changed (155) hide show
  1. package/package.json +33 -27
  2. package/src/tasks/build-jest-assets/index.js +4 -4
  3. package/src/tasks/bundle/builder/index.js +15 -15
  4. package/src/tasks/create/index.js +19 -33
  5. package/src/tasks/create/templates/Constellation/Field/Boolean/config.json.mustache +0 -1
  6. package/src/tasks/create/templates/Constellation/Field/Date/config.json.mustache +0 -1
  7. package/src/tasks/create/templates/Constellation/Field/DateTime/config.json.mustache +0 -1
  8. package/src/tasks/create/templates/Constellation/Field/Decimal/config.json.mustache +0 -1
  9. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/config.json.mustache +0 -1
  10. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/config.json.mustache +0 -1
  11. package/src/tasks/create/templates/Constellation/Field/Icon-Button-URL/config.json.mustache +0 -1
  12. package/src/tasks/create/templates/Constellation/Field/Integer/config.json.mustache +0 -1
  13. package/src/tasks/create/templates/Constellation/Field/Picklist/config.json.mustache +0 -1
  14. package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/config.json.mustache +0 -1
  15. package/src/tasks/create/templates/Constellation/Field/Picklist-RadioButtons/config.json.mustache +0 -1
  16. package/src/tasks/create/templates/Constellation/Field/Text/config.json.mustache +0 -1
  17. package/src/tasks/create/templates/Constellation/Field/Text-Email/config.json.mustache +0 -1
  18. package/src/tasks/create/templates/Constellation/Field/Text-Input/config.json.mustache +0 -1
  19. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/config.json.mustache +0 -1
  20. package/src/tasks/create/templates/Constellation/Field/Text-Phone/config.json.mustache +0 -1
  21. package/src/tasks/create/templates/Constellation/Field/Text-URL/config.json.mustache +0 -1
  22. package/src/tasks/create/templates/Constellation/Field/TimeofDay/config.json.mustache +0 -1
  23. package/src/tasks/create/templates/Constellation/Template/DETAILS/config.json.mustache +0 -1
  24. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/config.json.mustache +0 -1
  25. package/src/tasks/create/templates/Constellation/Template/FORM/config.json.mustache +0 -1
  26. package/src/tasks/create/templates/Constellation/Template/FORM-region/config.json.mustache +0 -1
  27. package/src/tasks/create/templates/Constellation/Template/PAGE/config.json.mustache +0 -1
  28. package/src/tasks/create/templates/Constellation/Template/PAGE/demo.stories.tsx.mustache +1 -0
  29. package/src/tasks/create/templates/Constellation/Widget/CASE/config.json.mustache +0 -1
  30. package/src/tasks/create/templates/Constellation/Widget/PAGE/config.json.mustache +0 -1
  31. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/config.json.mustache +0 -1
  32. package/src/tasks/create/templates/Launchpad/Field/Icon-Button-URL/config.json.mustache +0 -1
  33. package/src/tasks/create/templates/Launchpad/Widget/CASE/config.json.mustache +0 -1
  34. package/src/tasks/create/templates/Launchpad/Widget/PAGE/config.json.mustache +0 -1
  35. package/src/tasks/create/templates/Launchpad/Widget/PAGE-CASE/config.json.mustache +0 -1
  36. package/src/tasks/create-all/index.js +22 -35
  37. package/src/tasks/delete-pub/helper.js +5 -5
  38. package/src/tasks/delete-pub/index.js +21 -9
  39. package/src/tasks/init/index.js +62 -59
  40. package/src/tasks/init/template/package.json.mustache +2 -1
  41. package/src/tasks/list-pub/helper.js +6 -3
  42. package/src/tasks/list-pub/index.js +5 -4
  43. package/src/tasks/show-status/index.js +1 -1
  44. package/src/tasks/validator/index.js +0 -2
  45. package/src/util.js +487 -473
  46. package/tests/assets/library/components/create/Pega_DXIL_MyTestText/config.json +0 -1
  47. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyBoolean/config.json +0 -1
  48. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyCaseWidget/config.json +0 -1
  49. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyCurrency/config.json +0 -1
  50. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDate/config.json +0 -1
  51. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDateTime/config.json +0 -1
  52. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDecimal/config.json +0 -1
  53. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDetails/config.json +0 -1
  54. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyEmail/config.json +0 -1
  55. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyForm/config.json +0 -1
  56. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyIconButtonURL/config.json +0 -1
  57. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyInteger/config.json +0 -1
  58. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPage/config.json +0 -1
  59. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPage/demo.stories.tsx +1 -0
  60. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPageCaseWidget/config.json +0 -1
  61. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPageWidget/config.json +0 -1
  62. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyParagraph/config.json +0 -1
  63. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPercentage/config.json +0 -1
  64. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPhone/config.json +0 -1
  65. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPicklist/config.json +0 -1
  66. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyRadiobuttons/config.json +0 -1
  67. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MySearchbox/config.json +0 -1
  68. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyText/config.json +0 -1
  69. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyTextInput/config.json +0 -1
  70. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyTimeOfDay/config.json +0 -1
  71. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/config.json +0 -1
  72. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyTwoColumnForm/config.json +0 -1
  73. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyURL/config.json +0 -1
  74. package/tests/assets/original/components/create/Pega_DXIL_MyTestText/config.json +0 -1
  75. package/tests/assets/original/components/create/shared/PConnProps.d.ts +46 -0
  76. package/tests/assets/original/components/create/shared/create-nonce.ts +5 -0
  77. package/tests/assets/original/components/create/shared/suggestions-handler.ts +9 -0
  78. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyBoolean/config.json +0 -1
  79. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyCaseWidget/config.json +0 -1
  80. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyCurrency/config.json +0 -1
  81. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDate/config.json +0 -1
  82. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDateTime/config.json +0 -1
  83. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDecimal/config.json +0 -1
  84. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDetails/config.json +0 -1
  85. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyEmail/config.json +0 -1
  86. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyForm/config.json +0 -1
  87. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyIconButtonURL/config.json +0 -1
  88. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyInteger/config.json +0 -1
  89. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPage/config.json +0 -1
  90. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPage/demo.stories.tsx +1 -0
  91. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPageCaseWidget/config.json +0 -1
  92. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPageWidget/config.json +0 -1
  93. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyParagraph/config.json +0 -1
  94. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPercentage/config.json +0 -1
  95. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPhone/config.json +0 -1
  96. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPicklist/config.json +0 -1
  97. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyRadiobuttons/config.json +0 -1
  98. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MySearchbox/config.json +0 -1
  99. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyText/config.json +0 -1
  100. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyTextInput/config.json +0 -1
  101. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyTimeOfDay/config.json +0 -1
  102. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/config.json +0 -1
  103. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyTwoColumnForm/config.json +0 -1
  104. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyURL/config.json +0 -1
  105. package/tests/assets/original/components/createAll/Constellation/shared/PConnProps.d.ts +46 -0
  106. package/tests/assets/original/components/createAll/Constellation/shared/create-nonce.ts +5 -0
  107. package/tests/assets/original/components/createAll/Constellation/shared/suggestions-handler.ts +9 -0
  108. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyBoolean/config.json +0 -1
  109. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyCaseWidget/config.json +0 -1
  110. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyCurrency/config.json +0 -1
  111. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDate/config.json +0 -1
  112. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDateTime/config.json +0 -1
  113. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDecimal/config.json +0 -1
  114. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDetails/config.json +0 -1
  115. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyEmail/config.json +0 -1
  116. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyForm/config.json +0 -1
  117. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyIconButtonURL/config.json +0 -1
  118. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyInteger/config.json +0 -1
  119. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPage/config.json +0 -1
  120. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPage/demo.stories.tsx +1 -0
  121. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPageCaseWidget/config.json +0 -1
  122. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPageWidget/config.json +0 -1
  123. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyParagraph/config.json +0 -1
  124. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPercentage/config.json +0 -1
  125. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPhone/config.json +0 -1
  126. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPicklist/config.json +0 -1
  127. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyRadiobuttons/config.json +0 -1
  128. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MySearchbox/config.json +0 -1
  129. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyText/config.json +0 -1
  130. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyTextInput/config.json +0 -1
  131. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyTimeOfDay/config.json +0 -1
  132. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/config.json +0 -1
  133. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnForm/config.json +0 -1
  134. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyURL/config.json +0 -1
  135. package/tests/assets/original/components/createAll/Launchpad/shared/PConnProps.d.ts +46 -0
  136. package/tests/assets/original/components/createAll/Launchpad/shared/create-nonce.ts +5 -0
  137. package/tests/assets/original/components/createAll/Launchpad/shared/suggestions-handler.ts +9 -0
  138. package/tests/functional/localCreateAllListDeleteAll.test.js +1 -1
  139. package/tests/functional/localCreateBuildAllDeleteAll.test.js +3 -3
  140. package/tests/functional/localCreateBuildDelete.test.js +1 -1
  141. package/tests/functional/localCreateListDelete.test.js +1 -1
  142. package/tests/functional/localCreatePublishAllDeleteAll.test.js +3 -3
  143. package/tests/functional/localCreatePublishDelete.test.js +1 -1
  144. package/tests/functional/localCreateRenameDelete.test.js +1 -1
  145. package/tests/functional/localLibCreateLibBuildLibDeleteLib.test.js +3 -3
  146. package/tests/functional/localLibCreateLibBuildLibListPubDeleteLib.test.js +3 -3
  147. package/tests/functional/localLibCreateLibExportImportLib.test.js +1 -1
  148. package/tests/functional/localLibCreateLibExportLib.test.js +1 -1
  149. package/tests/functional/localLibCreateLibListDeleteLib.test.js +1 -1
  150. package/tests/functional/localLibCreateLibListMoveDeleteLib.test.js +1 -1
  151. package/tests/functional/localLibCreateLibListSwitchDeleteLib.test.js +1 -1
  152. package/tests/functional/localLibCreateLibStatusDeleteLib.test.js +1 -1
  153. package/tests/functional/localLibCreateLibStoreRestoreDeleteLib.test.js +1 -1
  154. package/tests/functional/localLibCreateLibValidateDeleteLib.test.js +3 -3
  155. package/tests/functional/localLibCreateLibVersionDeleteLib.test.js +1 -1
@@ -5,7 +5,6 @@
5
5
  "organization": "{{ORGANIZATION}}",
6
6
  "version": "{{VERSION}}",
7
7
  "library": "{{LIBRARY}}",
8
- "allowedApplications": {{{ALLOWEDAPPS}}},
9
8
  "componentKey": "{{COMPONENT_KEY}}",
10
9
  "type": "{{TYPE}}",
11
10
  "subtype": {{{SUB_TYPE}}},
@@ -25,7 +25,8 @@ import { checkPathAccess, showVersion ,
25
25
  checkLibraryAndArchives,
26
26
  getConfigDefaults,
27
27
  getSubTypeLabel,
28
- getMaxPrefixCount
28
+ getMaxPrefixCount,
29
+ getStandaloneMaxPrefixCount
29
30
  } from '../../util.js';
30
31
 
31
32
  import { COMPONENT_SCHEMA, COMPONENTS_DIRECTORY_PATH, TASKS_CONFIG_JSON_FILENAME, COMPONENTS_PATH, CATEGORY_CONSTELLATION, SHARED_FILE_NAMES } from '../../constants.js';
@@ -57,7 +58,7 @@ const copyComponentTemplate = async (options) => {
57
58
 
58
59
  export const compileMustacheTemplates = async (
59
60
  componentDirectory,
60
- { componentKey, componentName, componentLabel, library, version, type, subtype, description, organization, allowedApplications = '' }
61
+ { componentKey, componentName, componentLabel, library, version, type, subtype, description, organization }
61
62
  ) => {
62
63
  const files = fs.readdirSync(componentDirectory);
63
64
  const componentClassName = convertIntoPascalCase(componentKey);
@@ -101,17 +102,17 @@ export const compileMustacheTemplates = async (
101
102
 
102
103
  const isPicklist = subtype === 'Picklist';
103
104
 
104
- if (allowedApplications.trim() === '') {
105
- allowedApplications = [];
106
- } else {
107
- if (allowedApplications.indexOf(',') !== -1) {
108
- allowedApplications = allowedApplications.split(',');
109
- }
110
- allowedApplications = [].concat(allowedApplications);
111
- }
105
+ // if (allowedApplications.trim() === '') {
106
+ // allowedApplications = [];
107
+ // } else {
108
+ // if (allowedApplications.indexOf(',') !== -1) {
109
+ // allowedApplications = allowedApplications.split(',');
110
+ // }
111
+ // allowedApplications = [].concat(allowedApplications);
112
+ // }
112
113
 
113
114
 
114
- allowedApplications = allowedApplications.filter((el) => !!el.trim()).map((el) => el.trim());
115
+ // allowedApplications = allowedApplications.filter((el) => !!el.trim()).map((el) => el.trim());
115
116
  files.forEach((file) => {
116
117
  const filePath = path.join(componentDirectory, file);
117
118
 
@@ -125,7 +126,6 @@ export const compileMustacheTemplates = async (
125
126
  ORGANIZATION: organization,
126
127
  VERSION: version,
127
128
  LIBRARY: library,
128
- ALLOWEDAPPS: JSON.stringify(allowedApplications),
129
129
  TYPE: type,
130
130
  SUB_TYPE: JSON.stringify(mustacheSubType),
131
131
  SUB_TYPE_LABEL: subTypeLabel,
@@ -173,7 +173,7 @@ export const compileMustacheTemplates = async (
173
173
  };
174
174
 
175
175
  export const validateCompile = async (
176
- { library, organization, componentName, componentLabel, version, framework, type, subtype, description, allowedApplications },
176
+ { library, organization, componentName, componentLabel, version, framework, type, subtype, description },
177
177
  options
178
178
  ) => {
179
179
  let sSubType = subtype;
@@ -257,14 +257,13 @@ export const validateCompile = async (
257
257
  type,
258
258
  subtype,
259
259
  description,
260
- organization,
261
- allowedApplications
260
+ organization
262
261
  });
263
262
 
264
263
  console.log(chalk.green(`created ${componentKey} component in ${targetDirectory}`));
265
264
  };
266
265
 
267
- export const validateCompileAll = async ({ prefix, library, version, allowedApplications, organization }, options) => {
266
+ export const validateCompileAll = async ({ prefix, library, version, organization }, options) => {
268
267
  const defaultPegaServerConfig = await getPegaServerConfig();
269
268
 
270
269
  // eslint-disable-next-line no-restricted-syntax, guard-for-in
@@ -287,8 +286,7 @@ export const validateCompileAll = async ({ prefix, library, version, allowedAppl
287
286
  version,
288
287
  type,
289
288
  subtype,
290
- description,
291
- allowedApplications
289
+ description
292
290
  },
293
291
  options
294
292
  );
@@ -321,8 +319,7 @@ export const validateCompileAll = async ({ prefix, library, version, allowedAppl
321
319
  version,
322
320
  type,
323
321
  subtype,
324
- description,
325
- allowedApplications
322
+ description
326
323
  },
327
324
  options
328
325
  );
@@ -353,8 +350,7 @@ export const validateCompileAll = async ({ prefix, library, version, allowedAppl
353
350
  version,
354
351
  type,
355
352
  subtype,
356
- description,
357
- allowedApplications
353
+ description
358
354
  },
359
355
  options
360
356
  );
@@ -390,27 +386,25 @@ addDebugLog("createAll", "", "+");
390
386
  const componentDefaults = getConfigDefaults();
391
387
  componentDefaults.library = library;
392
388
 
393
- if (options.params.length >= 8) {
389
+ if (options.params.length >= 7) {
394
390
  const prefix = options.params[3];
395
391
  const version = options.params[4];
396
392
  library = options.params[5];
397
- const allowedApplications = options.params[6];
398
393
 
399
394
  // overwrite
400
- organization = options.params[7];
395
+ organization = options.params[6];
401
396
 
402
397
  await validateCompileAll(
403
398
  {
404
399
  prefix,
405
400
  library,
406
401
  version,
407
- allowedApplications,
408
402
  organization
409
403
  },
410
404
  options
411
405
  );
412
406
  } else {
413
- const maxPrefixCount = getMaxPrefixCount();
407
+ const maxPrefixCount = isLibraryBased ? getMaxPrefixCount() : getStandaloneMaxPrefixCount();
414
408
  const questions = [
415
409
  {
416
410
  name: 'prefix',
@@ -458,12 +452,6 @@ addDebugLog("createAll", "", "+");
458
452
  return 'Only alphanumeric values are allowed, starting with alphabets';
459
453
  },
460
454
  when: () => !isLibraryBased
461
- },
462
- {
463
- name: 'allowedApplications',
464
- message: 'Please enter the application names to be supported (comma-separated). ',
465
- suffix: 'Keep empty for all applications',
466
- when: () => !isLibraryBased
467
455
  }
468
456
  ];
469
457
 
@@ -476,7 +464,7 @@ addDebugLog("createAll", "", "+");
476
464
  library = orgLib.library;
477
465
  }
478
466
 
479
- const { version, allowedApplications } = answers;
467
+ const { version } = answers;
480
468
  let { prefix } = answers;
481
469
  prefix = prefix.replace(/[^a-zA-Z0-9 ]/g, '');
482
470
  await validateCompileAll(
@@ -484,7 +472,6 @@ addDebugLog("createAll", "", "+");
484
472
  prefix,
485
473
  library,
486
474
  version,
487
- allowedApplications,
488
475
  organization
489
476
  },
490
477
  options
@@ -122,7 +122,8 @@ addDebugLog("fetchComponenLibrariessFromInfinity", `apiUrl: ${apiUrl}`, "");
122
122
  });
123
123
  }
124
124
 
125
- export const getInfinityLibraries = async(rulesetName, rulesetVersion) => {
125
+ // const getInfinityLibraries = async(rulesetName, rulesetVersion) => {
126
+ export const getInfinityLibraries = async() => {
126
127
  addDebugLog("getInfinityLibraries", '', "");
127
128
 
128
129
  const { app_name, app_version } = await getApplicationAndVersionFromToken();
@@ -140,10 +141,9 @@ addDebugLog("getInfinityLibraries", '', "");
140
141
 
141
142
  // inquire
142
143
 
143
- let urlParams = `/app-name/${ApplicationName}/app-version/${ApplicationVersion}/rulesetname/${rulesetName}/rulesetversion/${rulesetVersion}`;
144
- //let urlParams = `&ApplicationName=${ApplicationName}&ApplicationVersion=${ApplicationVersion}&RulesetName=${rulesetName}&RulesetVersion=${rulesetVersion}`;
145
- //urlParams = encodeURIComponent(urlParams);
146
-
144
+ // want to get a list of all for application, so make ruleset/version blank
145
+ let urlParams = `/app-name/${ApplicationName}/app-version/${ApplicationVersion}/rulesetname/""/rulesetversion/""`;
146
+ // let urlParams = `/app-name/${ApplicationName}/app-version/${ApplicationVersion}/rulesetname/${rulesetName}/rulesetversion/${rulesetVersion}`;
147
147
 
148
148
  url = url.concat(urlParams);
149
149
 
@@ -3,7 +3,7 @@ import ora from 'ora';
3
3
 
4
4
  import chalk from 'chalk';
5
5
 
6
- import { showVersion, getC11NB2STokenAndStaticServer, getLocalLibraryVersions, getLibraryBased, deleteLocalLibrary, deleteLocalLibraryVersion, addDebugLog, getConfigDefaults, getLibraryBasedCL, getPegaServerConfig, deleteInfinityServerComponentLibrary, checkAccessTokenExpiration } from '../../util.js';
6
+ import { showVersion, getC11NB2STokenAndStaticServer, getLocalLibraryVersions, getLibraryBased, deleteLocalLibrary, deleteLocalLibraryVersion, addDebugLog, getConfigDefaults, getLibraryBasedCL, getPegaServerConfig, deleteInfinityServerComponentLibrary, checkAccessTokenExpiration, getApplicationAndVersionFromToken } from '../../util.js';
7
7
  import { deleteLib } from '@pega/constellation-dx-components-build-utils/index.js';
8
8
 
9
9
  import { getDeleteLibraryQuestions, getLibraryVersionQuestion, getRulesetAndVersionQuestion, SOURCE_OF_COMPONENT_TYPES, getInfinityLibraries } from './helper.js';
@@ -94,19 +94,27 @@ addDebugLog("deletePublished", "END", "-");
94
94
  if (isLibraryBasedCL) {
95
95
 
96
96
  const serverConfg = await getPegaServerConfig();
97
+ const { app_name, app_version } = await getApplicationAndVersionFromToken();
97
98
 
98
99
  console.log();
99
100
  console.log(`Current server: ${chalk.green.bold(`${serverConfg.server}`)}`);
101
+ console.log(`List of libraries for Application: ${chalk.green.bold(`${app_name} - ${app_version}`)}`);
102
+ console.log(chalk.bold.yellow(`>> Caution...`));
103
+ console.log(chalk.bold.yellow(`>> This list may contain built on libraries if your application is built on an application.`));
104
+ console.log(chalk.bold.yellow(`>> Deleting built on libraries may cause issues with built on application.`));
100
105
 
101
- const questions = await getRulesetAndVersionQuestion(serverConfg);
102
- const answers = await inquirer.prompt(questions);
103
- const { rulesetName, rulesetVersion } = answers;
104
106
 
105
- const arLibs = await getInfinityLibraries(rulesetName, rulesetVersion);
107
+ // want to get all in application, so ignore ruleset/version questions
108
+ // const questions = await getRulesetAndVersionQuestion(serverConfg);
109
+ // const answers = await inquirer.prompt(questions);
110
+ // const { rulesetName, rulesetVersion } = answers;
111
+
112
+ // const arLibs = await getInfinityLibraries(rulesetName, rulesetVersion);
113
+ const arLibs = await getInfinityLibraries();
106
114
 
107
115
  if (arLibs && arLibs.pxResults && arLibs.pxResults.length > 0) {
108
116
 
109
- const libs = arLibs.pxResults.map((oLib, index) => ({ name: oLib.pyLabel, value: oLib.pyRuleName}));
117
+ const libs = arLibs.pxResults.map((oLib, index) => ({ name: oLib.pyLabel + " (" + oLib.pyRuleSet + ":" + oLib.pyRuleSetVersion + ")", value: index}));
110
118
 
111
119
  const libAnswers = await inquirer.prompt([
112
120
  {
@@ -117,7 +125,9 @@ addDebugLog("deletePublished", "END", "-");
117
125
  }
118
126
  ]);
119
127
 
120
- const libraryName = libAnswers.library;
128
+ const libraryName = arLibs.pxResults[libAnswers.library].pyRuleName;
129
+ const rulesetName = arLibs.pxResults[libAnswers.library].pyRuleSet;
130
+ const rulesetVersion = arLibs.pxResults[libAnswers.library].pyRuleSetVersion;
121
131
  // let spinner;
122
132
 
123
133
 
@@ -138,8 +148,10 @@ addDebugLog("deletePublished", "END", "-");
138
148
  else {
139
149
  // No library with that name
140
150
  const serverConfig = await getPegaServerConfig();
141
- console.log(chalk.redBright(`No server component libraries exist in given ruleset ${chalk.bold(`${rulesetName}:${rulesetVersion}`)}`));
142
- addDebugLog("listPublished", "END", "-");
151
+ // console.log(chalk.redBright(`No server component libraries exist in given ruleset ${chalk.bold(`${rulesetName}:${rulesetVersion}`)}`));
152
+ console.log(chalk.redBright(`No server component libraries exist in given application`));
153
+
154
+ addDebugLog("listPublished", "END", "-");
143
155
  process.exit(1);
144
156
 
145
157
  }
@@ -1,25 +1,30 @@
1
-
2
1
  import path from 'path';
3
2
  import fs from 'fs';
4
3
  import { fileURLToPath } from 'url';
5
4
  import { promisify } from 'util';
5
+ import { exec } from 'child_process';
6
+
6
7
  import chalk from 'chalk';
7
8
  import { execa } from 'execa';
9
+ import ncp from 'ncp';
8
10
  import { Listr } from 'listr2';
9
11
  import gitignore from 'gitignore';
10
12
  import inquirer from 'inquirer';
11
- import { compileMustacheTemplate, isPascalCase, convertIntoPascalCase, sanitize } from '../../util.js';
12
- import { getInitProjectQuestions } from './helper.js';
13
13
 
14
- const writeGitignore = promisify(gitignore.writeFile);
14
+ import {
15
+ compileMustacheTemplate,
16
+ isPascalCase,
17
+ convertIntoPascalCase,
18
+ sanitize
19
+ } from '../../util.js';
15
20
 
21
+ import { getInitProjectQuestions } from './helper.js';
16
22
 
17
- const copyProjectDir = async (src, dest) => {
18
- if (typeof fs.cp === 'function') {
19
- await fs.promises.cp(src, dest, { recursive: true, errorOnExist: false, force: false });
20
- }
21
- };
23
+ const execPromise = promisify(exec);
22
24
 
25
+ const copy = promisify(ncp);
26
+ const writeGitignore = promisify(gitignore.writeFile);
27
+ const writeFile = promisify(fs.writeFile);
23
28
 
24
29
  const createGitignore = async options => {
25
30
  const file = fs.createWriteStream(path.join(options.targetDirectory, '.gitignore'), {
@@ -32,54 +37,51 @@ const createGitignore = async options => {
32
37
  };
33
38
 
34
39
  const createLicense = async options => {
35
- // Write LICENSE file directly
36
40
  const targetPath = path.join(options.targetDirectory, 'LICENSE');
37
41
  const licenseContent = 'Enter license text here';
38
- await fs.promises.writeFile(targetPath, licenseContent, 'utf8');
42
+ return writeFile(targetPath, licenseContent, 'utf8');
39
43
  };
40
44
 
41
-
42
45
  const copyProjectTemplate = async options => {
43
- // Use fast copy
44
- await copyProjectDir(options.templateDirectory, options.targetDirectory);
46
+ await copy(options.templateDirectory, options.targetDirectory, {
47
+ clobber: false
48
+ });
45
49
  const packageJsonPath = path.join(options.targetDirectory, 'package.json.mustache');
46
50
  const templateNPMRCPath = path.join(options.targetDirectory, 'templateNPMRC.txt');
47
51
 
48
52
  let { organization, projectName } = options;
53
+
49
54
  projectName = sanitize(projectName).toLowerCase();
55
+
50
56
  organization = sanitize(organization);
51
57
  if (!isPascalCase(organization)) {
52
58
  organization = convertIntoPascalCase(organization);
53
59
  }
54
- options = { ...options, organization, projectName };
55
60
 
56
- // Compile and write package.json in one go
61
+ options = {
62
+ ...options,
63
+ organization,
64
+ projectName
65
+ };
57
66
  const output = compileMustacheTemplate(packageJsonPath, options);
58
- await fs.promises.writeFile(packageJsonPath, output);
59
- await fs.promises.rename(packageJsonPath, packageJsonPath.replace('.mustache', ''));
60
-
61
- // Rename templateNPMRC.txt to .npmrc if exists
62
- try {
63
- await fs.promises.rename(templateNPMRCPath, templateNPMRCPath.replace('templateNPMRC.txt', '.npmrc'));
64
- } catch (e) {
65
- // ignore if not present
66
- }
67
+ fs.writeFileSync(packageJsonPath, output);
68
+ fs.renameSync(packageJsonPath, packageJsonPath.replace('.mustache', ''));
69
+
70
+ // rename template NPMRC to .npmrc, need to do this because npmjs won't publish an .npmrc file
71
+ fs.renameSync(templateNPMRCPath, templateNPMRCPath.replace('templateNPMRC.txt', '.npmrc'));
67
72
 
68
73
  await createLicense(options);
69
74
  };
70
75
 
71
-
72
76
  const initGit = async options => {
73
- // Use execa for async git init
74
77
  const result = await execa('git', ['init'], {
75
78
  cwd: options.targetDirectory
76
79
  });
77
80
  if (result.failed) {
78
- throw new Error('Failed to initialize git');
81
+ return Promise.reject(new Error('Failed to initialize git'));
79
82
  }
80
83
  };
81
84
 
82
-
83
85
  export default async options => {
84
86
  options.templateDirectory = path.resolve(
85
87
  path.dirname(fileURLToPath(import.meta.url)),
@@ -88,28 +90,32 @@ export default async options => {
88
90
  let projectName = 'test';
89
91
 
90
92
  const questions = getInitProjectQuestions();
91
- const answers = await inquirer.prompt(questions);
92
- projectName = sanitize(answers.projectName).toLowerCase();
93
- options = { ...options, ...answers };
94
-
95
- const projectDirectory = `./${projectName}`;
96
- if (!fs.existsSync(projectDirectory)) {
97
- fs.mkdirSync(projectDirectory);
98
- } else {
99
- console.log(chalk.bold.red(`A project with name ${projectName} already exists. Exiting...`));
100
- process.exit();
101
- }
102
93
 
103
- const targetDirectory = options.targetDirectory || process.cwd();
104
- options.targetDirectory = path.join(targetDirectory, projectName);
105
- options.componentDirectory = path.join(
106
- options.targetDirectory,
107
- 'node_modules/@pega/custom-dx-components'
108
- );
109
- options.componentLibraryUtilsDirectory = path.join(
110
- options.targetDirectory,
111
- 'node_modules/@pega/constellation-dx-components-build-utils'
112
- );
94
+ await inquirer.prompt(questions).then(async answers => {
95
+ projectName = answers.projectName;
96
+ projectName = sanitize(projectName).toLowerCase();
97
+ options = { ...options, ...answers };
98
+
99
+ const projectDirectory = `./${projectName}`;
100
+
101
+ if (!fs.existsSync(projectDirectory)) {
102
+ fs.mkdirSync(projectDirectory);
103
+ } else {
104
+ console.log(chalk.bold.red(`A project with name ${projectName} already exists. Exiting...`));
105
+ process.exit();
106
+ }
107
+
108
+ const targetDirectory = options.targetDirectory || process.cwd();
109
+ options.targetDirectory = path.join(targetDirectory, projectName);
110
+ options.componentDirectory = path.join(
111
+ options.targetDirectory,
112
+ 'node_modules/@pega/custom-dx-components'
113
+ );
114
+ options.componentLibraryUtilsDirectory = path.join(
115
+ options.targetDirectory,
116
+ 'node_modules/@pega/constellation-dx-components-build-utils'
117
+ );
118
+ });
113
119
 
114
120
  const installDependenciesText = `Installing dependencies. This will take a couple of minutes.`;
115
121
 
@@ -132,38 +138,35 @@ export default async options => {
132
138
  {
133
139
  title: installDependenciesText,
134
140
  task: () =>
135
- execa('npm', ['i', '--force', '--production=false'], { cwd: options.targetDirectory })
141
+ execPromise('npm i --force --production=false', { cwd: options.targetDirectory })
136
142
  },
137
143
  */
138
144
  {
139
145
  title: installDependenciesText,
140
146
  task: () =>
141
- execa('npm', ['ci', '--force', '--no-audit', '--no-fund', '--loglevel=error'], { cwd: options.targetDirectory })
147
+ execPromise('npm i --force --include=dev', { cwd: options.targetDirectory })
142
148
  },
143
149
  /*
144
150
  {
145
151
  title: 'Installing tasks dependencies',
146
152
  task: () =>
147
- execa('npm', ['i', '--force', '--production=false'], { cwd: options.componentDirectory })
153
+ execPromise('npm i --force --production=false', { cwd: options.componentDirectory })
148
154
  },
149
155
  {
150
156
  title: 'Installing tasks library dependencies',
151
157
  task: () =>
152
- execa('npm', ['i', '--force', '--production=false'], {
158
+ execPromise('npm i --force --production=false', {
153
159
  cwd: options.componentLibraryUtilsDirectory
154
160
  })
155
161
  },
156
162
  */
157
-
158
- /*
159
163
  {
160
164
  title: 'Updating',
161
- task: () => execa('npm', ['update', '--dev', '--no-audit', '--no-fund', '--loglevel=error'], { cwd: options.targetDirectory })
165
+ task: () => execPromise('npm update --dev', { cwd: options.targetDirectory })
162
166
  }
163
- */
164
167
  /* {
165
168
  title: 'Installing quick run',
166
- task: () => execa('npm', ['i', '-g', 'npm-quick-run'], { cwd: options.targetDirectory })
169
+ task: () => execPromise('npm i -g npm-quick-run', { cwd: options.targetDirectory })
167
170
  } */
168
171
  ],
169
172
  {
@@ -99,6 +99,7 @@
99
99
  "react-is": "^18.3.1",
100
100
  "react-redux": "^7.2.9",
101
101
  "serve": "^14.2.4",
102
+ "shelljs": "^0.8.5",
102
103
  "styled-components": "^5.3.11",
103
104
  "ts-loader": "^9.5.2"
104
105
  },
@@ -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": "~25.1.10",
111
+ "@pega/custom-dx-components": "~0.25.46",
111
112
  "@pega/pcore-pconnect-typedefs": "^4.1.0-alpha.1",
112
113
  "@storybook/addon-actions": "^8.6.14",
113
114
  "@storybook/addon-essentials": "^8.6.14",
@@ -136,10 +136,13 @@ addDebugLog("getInfinityLibraries", '', "");
136
136
 
137
137
  const ApplicationName = app_name;
138
138
  const ApplicationVersion = app_version;
139
- const rulesetName = defaultPegaServerConfig.rulesetName;
140
- const rulesetVersion = defaultPegaServerConfig.rulesetVersion;
139
+ // const rulesetName = defaultPegaServerConfig.rulesetName;
140
+ // const rulesetVersion = defaultPegaServerConfig.rulesetVersion;
141
+ // let urlParams = `/app-name/${ApplicationName}/app-version/${ApplicationVersion}/rulesetname/${rulesetName}/rulesetversion/${rulesetVersion}`;
142
+
143
+ // currently want to get all published libraries for an application, so make ruleset/version blank
144
+ let urlParams = `/app-name/${ApplicationName}/app-version/${ApplicationVersion}/rulesetname/""/rulesetversion/""`;
141
145
 
142
- let urlParams = `/app-name/${ApplicationName}/app-version/${ApplicationVersion}/rulesetname/${rulesetName}/rulesetversion/${rulesetVersion}`;
143
146
 
144
147
  url = url.concat(urlParams);
145
148
 
@@ -158,21 +158,22 @@ addDebugLog("listPublished", "END", "-");
158
158
 
159
159
  if (arLibs && arLibs.pxResults && arLibs.pxResults.length > 0) {
160
160
 
161
- const libs = arLibs.pxResults.map((oLib, index) => ({ name: oLib.pyLabel, value: index}));
161
+ // const libs = arLibs.pxResults.map((oLib, index) => ({ name: oLib.pyLabel, value: index}));
162
+ const libs = arLibs.pxResults.map((oLib, index) => ({ name: oLib.pyLabel + " (" + oLib.pyRuleSet + ":" + oLib.pyRuleSetVersion + ")", value: index}));
162
163
 
163
164
 
164
165
  const {app_name, app_version } = await getApplicationAndVersionFromToken();
165
166
  const serverConfig = await getPegaServerConfig();
166
167
  console.log(`\nServer ${chalk.green.bold(`${serverConfig.server}`)}.`);
167
- console.log(chalk.green(`List of libraries for Application: ${chalk.bold.green(`${app_name} - ${app_version}`)}`));
168
- console.log(`in ruleset: ${chalk.green.bold(`${serverConfig.rulesetName}:${serverConfig.rulesetVersion}`)}`);
168
+ console.log(`List of libraries (including built on) for Application: ${chalk.bold.green(`${app_name} - ${app_version}`)}`);
169
+ // console.log(`in ruleset: ${chalk.green.bold(`${serverConfig.rulesetName}:${serverConfig.rulesetVersion}`)}`);
169
170
 
170
171
 
171
172
  const libAnswers = await inquirer.prompt([
172
173
  {
173
174
  name: 'library',
174
175
  type: 'rawlist',
175
- message: 'Pick library',
176
+ message: 'Pick component library',
176
177
  choices: libs
177
178
  }
178
179
  ]);
@@ -16,7 +16,7 @@ export const showCurrentStatus = async () => {
16
16
  const componentList = await getComponents();
17
17
  const isLibraryBased = getLibraryBased();
18
18
  const isLibraryBasedCL = getLibraryBasedCL();
19
- const pegaServer = await getPegaServerConfig();
19
+ const pegaServer = await getPegaServerConfig(true);
20
20
 
21
21
  console.log("");
22
22
  console.log("\tCurrent status");
@@ -47,7 +47,6 @@ const schema = {
47
47
  organization: { type: 'string' },
48
48
  version: { type: 'string' },
49
49
  library: { type: 'string' },
50
- allowedApplications: { type: 'array' },
51
50
  type: { type: 'string', enum: COMPONENT_SCHEMA.type.map(({ value }) => value) },
52
51
  subtype: {
53
52
  anyOf: [{ type: 'string' }, { type: 'array' }],
@@ -184,7 +183,6 @@ const overrideSchema = {
184
183
  organization: { type: 'string' },
185
184
  version: { type: 'string' },
186
185
  library: { type: 'string' },
187
- allowedApplications: { type: 'array' },
188
186
  type: { type: 'string', enum: COMPONENT_SCHEMA.type.map(({ value }) => value) },
189
187
  subtype: {
190
188
  anyOf: [{ type: 'string' }, { type: 'array' }],