@pega/dx-component-builder-sdk 0.1.16 → 0.1.17

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 (55) hide show
  1. package/package.json +1 -1
  2. package/src/cli.js +6 -0
  3. package/src/constants.js +13 -17
  4. package/src/tasks/build-all/helper.js +76 -0
  5. package/src/tasks/build-all/index.js +121 -0
  6. package/src/tasks/create/index.js +52 -60
  7. package/src/tasks/create/templates/Constellation/Field/Boolean/demo.stories.jsx.mustache +1 -0
  8. package/src/tasks/create/templates/Constellation/Field/Date/demo.stories.jsx.mustache +11 -6
  9. package/src/tasks/create/templates/Constellation/Field/DateTime/demo.stories.jsx.mustache +11 -7
  10. package/src/tasks/create/templates/Constellation/Field/Decimal/demo.stories.jsx.mustache +7 -7
  11. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/demo.stories.jsx.mustache +9 -8
  12. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/demo.stories.jsx.mustache +7 -7
  13. package/src/tasks/create/templates/Constellation/Field/Integer/demo.stories.jsx.mustache +7 -7
  14. package/src/tasks/create/templates/Constellation/Field/Picklist/demo.stories.jsx.mustache +16 -10
  15. package/src/tasks/create/templates/Constellation/Field/Text/demo.stories.jsx.mustache +9 -7
  16. package/src/tasks/create/templates/Constellation/Field/Text-Email/demo.stories.jsx.mustache +8 -8
  17. package/src/tasks/create/templates/Constellation/Field/Text-Input/demo.stories.jsx.mustache +7 -7
  18. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/demo.stories.jsx.mustache +7 -7
  19. package/src/tasks/create/templates/Constellation/Field/Text-Phone/demo.stories.jsx.mustache +6 -6
  20. package/src/tasks/create/templates/Constellation/Field/Text-Phone/index.jsx.mustache +1 -1
  21. package/src/tasks/create/templates/Constellation/Field/Text-URL/demo.stories.jsx.mustache +6 -6
  22. package/src/tasks/create/templates/Constellation/Field/Text-URL/index.jsx.mustache +1 -1
  23. package/src/tasks/create/templates/Constellation/Field/Text-URL/{text-url.js.mustache → text-url.jsx.mustache} +2 -1
  24. package/src/tasks/create/templates/Constellation/Field/TimeofDay/demo.stories.jsx.mustache +10 -5
  25. package/src/tasks/create/templates/Constellation/Template/DETAILS/demo.stories.jsx.mustache +59 -51
  26. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/demo.stories.jsx.mustache +64 -59
  27. package/src/tasks/create/templates/Constellation/Template/FORM/demo.stories.jsx.mustache +43 -39
  28. package/src/tasks/create/templates/Constellation/Template/FORM-region/demo.stories.jsx.mustache +46 -46
  29. package/src/tasks/create/templates/Constellation/Template/PAGE/demo.stories.jsx.mustache +24 -25
  30. package/src/tasks/create/templates/Constellation/Widget/CASE/demo.stories.jsx.mustache +7 -7
  31. package/src/tasks/create/templates/Constellation/Widget/CASE/mock.stories.js.mustache +2 -1
  32. package/src/tasks/create/templates/Constellation/Widget/PAGE/demo.stories.jsx.mustache +1 -1
  33. package/src/tasks/create/templates/Constellation/Widget/PAGE/mock.stories.js.mustache +2 -1
  34. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/demo.stories.jsx.mustache +6 -6
  35. package/src/tasks/create/templates/SDK-React/Field/Date/index.tsx.mustache +2 -2
  36. package/src/tasks/create/templates/SDK-React/Field/DateTime/index.tsx.mustache +2 -2
  37. package/src/tasks/create/templates/SDK-React/Field/Decimal/index.tsx.mustache +2 -2
  38. package/src/tasks/create/templates/SDK-React/Field/Decimal-Currency/index.tsx.mustache +1 -1
  39. package/src/tasks/create/templates/SDK-React/Field/Decimal-Percentage/index.tsx.mustache +2 -2
  40. package/src/tasks/create/templates/SDK-React/Field/Integer/index.tsx.mustache +2 -2
  41. package/src/tasks/create/templates/SDK-React/Field/Text/index.tsx.mustache +1 -1
  42. package/src/tasks/create/templates/SDK-React/Field/Text-Email/index.tsx.mustache +2 -2
  43. package/src/tasks/create/templates/SDK-React/Field/Text-Input/index.tsx.mustache +1 -1
  44. package/src/tasks/create/templates/SDK-React/Field/Text-Paragraph/index.tsx.mustache +1 -1
  45. package/src/tasks/create/templates/SDK-React/Field/Text-Phone/index.tsx.mustache +1 -1
  46. package/src/tasks/create/templates/SDK-React/Field/Text-URL/index.tsx.mustache +2 -2
  47. package/src/tasks/create/templates/SDK-React/Field/TimeofDay/index.tsx.mustache +2 -2
  48. package/src/tasks/create/templates/SDK-React/Template/DETAILS/index.tsx.mustache +1 -1
  49. package/src/tasks/create/templates/SDK-React/Template/DETAILS-region/index.tsx.mustache +1 -1
  50. package/src/tasks/delete/helper.js +1 -0
  51. package/src/tasks/index.js +1 -0
  52. package/src/tasks/map/map.js +5 -4
  53. package/src/tasks/override/index.js +31 -21
  54. package/src/tasks/validator/index.js +10 -1
  55. package/src/util.js +18 -32
package/src/util.js CHANGED
@@ -22,22 +22,17 @@ import {
22
22
  FIELD_PATH,
23
23
  WIDGET_PATH,
24
24
  TEMPLATE_PATH,
25
- FORMS_PATH,
26
- TEMPLATES_PATH,
27
- WIDGETS_PATH,
28
25
  DSE_PATH,
29
26
  INFRA_PATH,
30
27
  COMPONENT_PREFIX_FIELD_PATH,
31
28
  COMPONENT_PREFIX_TEMPLATE_PATH,
32
29
  COMPONENT_PREFIX_WIDGET_PATH,
33
- COMPONENT_PREFIX_FORMS_PATH,
34
- COMPONENT_PREFIX_TEMPLATES_PATH,
35
- COMPONENT_PREFIX_WIDGETS_PATH,
36
30
  COMPONENT_PREFIX_DSE_PATH,
37
31
  COMPONENT_PREFIX_INFRA_PATH,
38
32
  CATEGORY_CUSTOM,
39
33
  CATEGORY_OVERRIDE,
40
- CATEGORY_CONSTELLATION
34
+ CATEGORY_CONSTELLATION,
35
+ COMPONENT_DIRECTORY_PREFIX_CUSTOM
41
36
  } from './constants.js';
42
37
 
43
38
 
@@ -60,7 +55,7 @@ export const checkPathAccess = async (path, options = {}) => {
60
55
  export const deleteLocalComponent = async (componentKey, category = CATEGORY_CUSTOM) => {
61
56
  const currentDirectory = process.cwd();
62
57
  const pegaConfigJsonPath = join(currentDirectory, DXCB_CONFIG_JSON_FILENAME);
63
- const categoryDirectory = join("/", category.toLowerCase());
58
+ const categoryDirectory = (category === CATEGORY_CONSTELLATION) ? join("/", COMPONENT_DIRECTORY_PREFIX_CUSTOM + category.toLowerCase()) : join("/", category.toLowerCase());
64
59
 
65
60
  await checkPathAccess(pegaConfigJsonPath);
66
61
 
@@ -172,7 +167,7 @@ export const getOptionsSource = (options) => {
172
167
  export const getComponents = async (showSeparator = false, category = CATEGORY_CUSTOM) => {
173
168
  const currentDirectory = process.cwd();
174
169
  const pegaConfigJsonPath = join(currentDirectory, DXCB_CONFIG_JSON_FILENAME);
175
- const categoryDirectory = join("/", category.toLowerCase());
170
+ const categoryDirectory = (category === CATEGORY_CONSTELLATION) ? join("/", COMPONENT_DIRECTORY_PREFIX_CUSTOM + category.toLowerCase()) : join("/", category.toLowerCase());
176
171
 
177
172
  await checkPathAccess(pegaConfigJsonPath);
178
173
 
@@ -215,14 +210,14 @@ export const getComponents = async (showSeparator = false, category = CATEGORY_C
215
210
  }
216
211
  break;
217
212
  case CATEGORY_OVERRIDE:
218
- const formsComps = await getSubComponents(directory, FORMS_PATH);
219
- const templatesComps = await getSubComponents(directory, TEMPLATES_PATH);
220
- const widgetsComps = await getSubComponents(directory, WIDGETS_PATH);
213
+ const formsComps = await getSubComponents(directory, FIELD_PATH);
214
+ const templatesComps = await getSubComponents(directory, TEMPLATE_PATH);
215
+ const widgetsComps = await getSubComponents(directory, WIDGET_PATH);
221
216
  const dseComps = await getSubComponents(directory, DSE_PATH);
222
217
  const infraComps = await getSubComponents(directory, INFRA_PATH);
223
218
 
224
219
  if (formsComps.length > 0) {
225
- if (showSeparator) compList.push(new inquirer.Separator("---- forms (fields) ----"));
220
+ if (showSeparator) compList.push(new inquirer.Separator("---- fields ----"));
226
221
  compList.push(...formsComps);
227
222
  }
228
223
 
@@ -291,7 +286,7 @@ export const createBlankConfigExt = async (directory, name) => {
291
286
  export const getComponentsObj = async (showSeparator = false, category = CATEGORY_CUSTOM) => {
292
287
  const currentDirectory = process.cwd();
293
288
  const pegaConfigJsonPath = join(currentDirectory, DXCB_CONFIG_JSON_FILENAME);
294
- const categoryDirectory = join("/", category.toLowerCase());
289
+ const categoryDirectory = (category === CATEGORY_CONSTELLATION) ? join("/", COMPONENT_DIRECTORY_PREFIX_CUSTOM + category.toLowerCase()) : join("/", category.toLowerCase());
295
290
 
296
291
  await checkPathAccess(pegaConfigJsonPath);
297
292
 
@@ -355,20 +350,20 @@ export const getComponentsObj = async (showSeparator = false, category = CATEGOR
355
350
  }
356
351
  break;
357
352
  case CATEGORY_OVERRIDE:
358
- const formsComps = await getSubComponents(directory, FORMS_PATH);
359
- const templatesComps = await getSubComponents(directory, TEMPLATES_PATH);
360
- const widgetsComps = await getSubComponents(directory, WIDGETS_PATH);
353
+ const formsComps = await getSubComponents(directory, FIELD_PATH);
354
+ const templatesComps = await getSubComponents(directory, TEMPLATE_PATH);
355
+ const widgetsComps = await getSubComponents(directory, WIDGET_PATH);
361
356
  const dseComps = await getSubComponents(directory, DSE_PATH);
362
357
  const infraComps = await getSubComponents(directory, INFRA_PATH);
363
358
 
364
359
  if (formsComps.length > 0) {
365
- if (showSeparator) compList.push(new inquirer.Separator("---- forms (fields) ----"));
360
+ if (showSeparator) compList.push(new inquirer.Separator("---- fields ----"));
366
361
 
367
362
  compList.push(...formsComps.map(
368
363
  name => {
369
364
  const container = {};
370
365
  container.name = name;
371
- container.value = COMPONENT_PREFIX_FORMS_PATH + name;
366
+ container.value = COMPONENT_PREFIX_FIELD_PATH + name;
372
367
 
373
368
  return container;
374
369
  }
@@ -381,7 +376,7 @@ export const getComponentsObj = async (showSeparator = false, category = CATEGOR
381
376
  name => {
382
377
  const container = {};
383
378
  container.name = name;
384
- container.value = COMPONENT_PREFIX_TEMPLATES_PATH + name;
379
+ container.value = COMPONENT_PREFIX_TEMPLATE_PATH + name;
385
380
 
386
381
  return container;
387
382
  }
@@ -394,7 +389,7 @@ export const getComponentsObj = async (showSeparator = false, category = CATEGOR
394
389
  name => {
395
390
  const container = {};
396
391
  container.name = name;
397
- container.value = COMPONENT_PREFIX_WIDGETS_PATH + name;
392
+ container.value = COMPONENT_PREFIX_WIDGET_PATH + name;
398
393
 
399
394
  return container;
400
395
  }
@@ -451,7 +446,7 @@ export const getSubComponentsAndDir = async (directory, type) => {
451
446
  export const getComponentsAndSubDirectory = async (category = CATEGORY_CUSTOM) => {
452
447
  const currentDirectory = process.cwd();
453
448
  const pegaConfigJsonPath = join(currentDirectory, DXCB_CONFIG_JSON_FILENAME);
454
- const categoryDirectory = join("/", category.toLowerCase());
449
+ const categoryDirectory = (category === CATEGORY_CONSTELLATION) ? join("/", COMPONENT_DIRECTORY_PREFIX_CUSTOM + category.toLowerCase()) : join("/", category.toLowerCase());
455
450
 
456
451
  await checkPathAccess(pegaConfigJsonPath);
457
452
 
@@ -490,15 +485,6 @@ export const removeComponentPrefix = (componentName) => {
490
485
  else if (componentName.indexOf(COMPONENT_PREFIX_WIDGET_PATH) == 0) {
491
486
  componentName = componentName.substring(COMPONENT_PREFIX_WIDGET_PATH.length);
492
487
  }
493
- else if (componentName.indexOf(COMPONENT_PREFIX_FORMS_PATH) == 0) {
494
- componentName = componentName.substring(COMPONENT_PREFIX_FORMS_PATH.length);
495
- }
496
- else if (componentName.indexOf(COMPONENT_PREFIX_TEMPLATES_PATH) == 0) {
497
- componentName = componentName.substring(COMPONENT_PREFIX_TEMPLATES_PATH.length);
498
- }
499
- else if (componentName.indexOf(COMPONENT_PREFIX_WIDGETS_PATH) == 0) {
500
- componentName = componentName.substring(COMPONENT_PREFIX_WIDGETS_PATH.length);
501
- }
502
488
  else if (componentName.indexOf(COMPONENT_PREFIX_DSE_PATH) == 0) {
503
489
  componentName = componentName.substring(COMPONENT_PREFIX_DSE_PATH.length);
504
490
  }
@@ -535,7 +521,7 @@ export const getComponentDefaults = async () => {
535
521
  export const getComponentDirectoryPath = async (componentKey, category = CATEGORY_CUSTOM) => {
536
522
  const currentDirectory = process.cwd();
537
523
  const pegaConfigJsonPath = join(currentDirectory, DXCB_CONFIG_JSON_FILENAME);
538
- const categoryDirectory = join("/", category.toLowerCase());
524
+ const categoryDirectory = (category === CATEGORY_CONSTELLATION) ? join("/", COMPONENT_DIRECTORY_PREFIX_CUSTOM + category.toLowerCase()) : join("/", category.toLowerCase());
539
525
 
540
526
  await checkPathAccess(pegaConfigJsonPath);
541
527