@pega/custom-dx-components 0.23.49 → 0.23.50

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 (177) hide show
  1. package/package.json +1 -1
  2. package/src/cli.js +9 -3
  3. package/src/constants.js +5 -0
  4. package/src/tasks/build-all/helper.js +1 -1
  5. package/src/tasks/build-comp/helper.js +4 -2
  6. package/src/tasks/build-comp/index.js +8 -2
  7. package/src/tasks/build-jest-assets/index.js +171 -0
  8. package/src/tasks/create/templates/Constellation/Field/Boolean/create-nonce.ts.mustache +6 -0
  9. package/src/tasks/create/templates/Constellation/Field/Boolean/index.tsx.mustache +3 -1
  10. package/src/tasks/create/templates/Constellation/Field/Date/create-nonce.ts.mustache +6 -0
  11. package/src/tasks/create/templates/Constellation/Field/Date/index.tsx.mustache +2 -1
  12. package/src/tasks/create/templates/Constellation/Field/DateTime/create-nonce.ts.mustache +6 -0
  13. package/src/tasks/create/templates/Constellation/Field/DateTime/index.tsx.mustache +2 -1
  14. package/src/tasks/create/templates/Constellation/Field/Decimal/create-nonce.ts.mustache +6 -0
  15. package/src/tasks/create/templates/Constellation/Field/Decimal/index.tsx.mustache +2 -1
  16. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/create-nonce.ts.mustache +6 -0
  17. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/index.tsx.mustache +2 -1
  18. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/create-nonce.ts.mustache +6 -0
  19. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/index.tsx.mustache +2 -1
  20. package/src/tasks/create/templates/Constellation/Field/Integer/create-nonce.ts.mustache +6 -0
  21. package/src/tasks/create/templates/Constellation/Field/Integer/index.tsx.mustache +2 -1
  22. package/src/tasks/create/templates/Constellation/Field/Picklist/create-nonce.ts.mustache +6 -0
  23. package/src/tasks/create/templates/Constellation/Field/Picklist/index.tsx.mustache +2 -1
  24. package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/create-nonce.ts.mustache +6 -0
  25. package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/index.tsx.mustache +1 -0
  26. package/src/tasks/create/templates/Constellation/Field/Picklist-RadioButtons/create-nonce.ts.mustache +6 -0
  27. package/src/tasks/create/templates/Constellation/Field/Picklist-RadioButtons/index.tsx.mustache +1 -0
  28. package/src/tasks/create/templates/Constellation/Field/Text/create-nonce.ts.mustache +6 -0
  29. package/src/tasks/create/templates/Constellation/Field/Text/index.tsx.mustache +1 -0
  30. package/src/tasks/create/templates/Constellation/Field/Text-Email/create-nonce.ts.mustache +6 -0
  31. package/src/tasks/create/templates/Constellation/Field/Text-Email/index.tsx.mustache +2 -1
  32. package/src/tasks/create/templates/Constellation/Field/Text-Input/create-nonce.ts.mustache +6 -0
  33. package/src/tasks/create/templates/Constellation/Field/Text-Input/index.tsx.mustache +2 -1
  34. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/create-nonce.ts.mustache +6 -0
  35. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/index.tsx.mustache +2 -1
  36. package/src/tasks/create/templates/Constellation/Field/Text-Phone/create-nonce.ts.mustache +6 -0
  37. package/src/tasks/create/templates/Constellation/Field/Text-Phone/index.tsx.mustache +2 -1
  38. package/src/tasks/create/templates/Constellation/Field/Text-URL/create-nonce.ts.mustache +6 -0
  39. package/src/tasks/create/templates/Constellation/Field/Text-URL/index.tsx.mustache +1 -0
  40. package/src/tasks/create/templates/Constellation/Field/TimeofDay/create-nonce.ts.mustache +6 -0
  41. package/src/tasks/create/templates/Constellation/Field/TimeofDay/index.tsx.mustache +2 -1
  42. package/src/tasks/create/templates/Constellation/Template/DETAILS/create-nonce.ts.mustache +6 -0
  43. package/src/tasks/create/templates/Constellation/Template/DETAILS/index.tsx.mustache +1 -0
  44. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/create-nonce.ts.mustache +6 -0
  45. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/index.tsx.mustache +1 -0
  46. package/src/tasks/create/templates/Constellation/Template/FORM/create-nonce.ts.mustache +6 -0
  47. package/src/tasks/create/templates/Constellation/Template/FORM/index.tsx.mustache +1 -1
  48. package/src/tasks/create/templates/Constellation/Template/FORM-region/create-nonce.ts.mustache +6 -0
  49. package/src/tasks/create/templates/Constellation/Template/FORM-region/index.tsx.mustache +1 -0
  50. package/src/tasks/create/templates/Constellation/Template/PAGE/create-nonce.ts.mustache +6 -0
  51. package/src/tasks/create/templates/Constellation/Template/PAGE/index.tsx.mustache +1 -1
  52. package/src/tasks/create/templates/Constellation/Widget/CASE/create-nonce.ts.mustache +6 -0
  53. package/src/tasks/create/templates/Constellation/Widget/CASE/index.tsx.mustache +1 -0
  54. package/src/tasks/create/templates/Constellation/Widget/PAGE/create-nonce.ts.mustache +6 -0
  55. package/src/tasks/create/templates/Constellation/Widget/PAGE/index.tsx.mustache +1 -0
  56. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/create-nonce.ts.mustache +6 -0
  57. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/index.tsx.mustache +1 -0
  58. package/src/tasks/create/templates/Launchpad/Widget/CASE/create-nonce.ts.mustache +6 -0
  59. package/src/tasks/create/templates/Launchpad/Widget/CASE/index.tsx.mustache +1 -0
  60. package/src/tasks/create/templates/Launchpad/Widget/PAGE-CASE/create-nonce.ts.mustache +6 -0
  61. package/src/tasks/create/templates/Launchpad/Widget/PAGE-CASE/index.tsx.mustache +1 -0
  62. package/src/tasks/delete/helper.js +75 -50
  63. package/src/tasks/index.js +1 -0
  64. package/src/tasks/init/helper.js +5 -5
  65. package/src/tasks/init/template/package.json.mustache +5 -4
  66. package/src/tasks/list/helper.js +5 -2
  67. package/src/tasks/publish/helper.js +53 -45
  68. package/src/tasks/publish/index.js +8 -2
  69. package/src/tasks/publish-all/helper.js +6 -0
  70. package/src/tasks/rename/index.js +9 -2
  71. package/src/tasks/revert-webpack/index.js +8 -26
  72. package/src/util.js +51 -72
  73. package/tests/assets/components/create/Pega_DXIL_MyTestText/create-nonce.ts +6 -0
  74. package/tests/assets/components/create/Pega_DXIL_MyTestText/index.tsx +1 -0
  75. package/tests/assets/components/create/_components.md +1 -0
  76. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyBoolean/create-nonce.ts +6 -0
  77. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyBoolean/index.tsx +3 -1
  78. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyCaseWidget/create-nonce.ts +6 -0
  79. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyCaseWidget/index.tsx +1 -0
  80. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyCurrency/create-nonce.ts +6 -0
  81. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyCurrency/index.tsx +2 -1
  82. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDate/create-nonce.ts +6 -0
  83. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDate/index.tsx +2 -1
  84. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDateTime/create-nonce.ts +6 -0
  85. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDateTime/index.tsx +2 -1
  86. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDecimal/create-nonce.ts +6 -0
  87. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDecimal/index.tsx +2 -1
  88. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails/create-nonce.ts +6 -0
  89. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails/index.tsx +1 -0
  90. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyEmail/create-nonce.ts +6 -0
  91. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyEmail/index.tsx +2 -1
  92. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyForm/create-nonce.ts +6 -0
  93. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyForm/index.tsx +1 -1
  94. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyInteger/create-nonce.ts +6 -0
  95. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyInteger/index.tsx +2 -1
  96. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPage/create-nonce.ts +6 -0
  97. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPage/index.tsx +1 -1
  98. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPageCaseWidget/create-nonce.ts +6 -0
  99. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPageCaseWidget/index.tsx +1 -0
  100. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPageWidget/create-nonce.ts +6 -0
  101. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPageWidget/index.tsx +1 -0
  102. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyParagraph/create-nonce.ts +6 -0
  103. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyParagraph/index.tsx +2 -1
  104. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPercentage/create-nonce.ts +6 -0
  105. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPercentage/index.tsx +2 -1
  106. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPhone/create-nonce.ts +6 -0
  107. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPhone/index.tsx +2 -1
  108. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPicklist/create-nonce.ts +6 -0
  109. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPicklist/index.tsx +2 -1
  110. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyRadioButtons/create-nonce.ts +6 -0
  111. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyRadioButtons/index.tsx +1 -0
  112. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MySearchbox/create-nonce.ts +6 -0
  113. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MySearchbox/index.tsx +1 -0
  114. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyText/create-nonce.ts +6 -0
  115. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyText/index.tsx +1 -0
  116. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTextInput/create-nonce.ts +6 -0
  117. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTextInput/index.tsx +2 -1
  118. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTimeOfDay/create-nonce.ts +6 -0
  119. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTimeOfDay/index.tsx +2 -1
  120. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/create-nonce.ts +6 -0
  121. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/index.tsx +1 -0
  122. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnForm/create-nonce.ts +6 -0
  123. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnForm/index.tsx +1 -0
  124. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyURL/create-nonce.ts +6 -0
  125. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyURL/index.tsx +1 -0
  126. package/tests/assets/components/createAll/Constellation/_components.md +1 -0
  127. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyBoolean/create-nonce.ts +6 -0
  128. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyBoolean/index.tsx +3 -1
  129. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyCaseWidget/create-nonce.ts +6 -0
  130. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyCaseWidget/index.tsx +1 -0
  131. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyCurrency/create-nonce.ts +6 -0
  132. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyCurrency/index.tsx +2 -1
  133. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDate/create-nonce.ts +6 -0
  134. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDate/index.tsx +2 -1
  135. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDateTime/create-nonce.ts +6 -0
  136. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDateTime/index.tsx +2 -1
  137. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDecimal/create-nonce.ts +6 -0
  138. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDecimal/index.tsx +2 -1
  139. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails/create-nonce.ts +6 -0
  140. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails/index.tsx +1 -0
  141. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyEmail/create-nonce.ts +6 -0
  142. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyEmail/index.tsx +2 -1
  143. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyForm/create-nonce.ts +6 -0
  144. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyForm/index.tsx +1 -1
  145. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyInteger/create-nonce.ts +6 -0
  146. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyInteger/index.tsx +2 -1
  147. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPage/create-nonce.ts +6 -0
  148. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPage/index.tsx +1 -1
  149. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPageCaseWidget/create-nonce.ts +6 -0
  150. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPageCaseWidget/index.tsx +1 -0
  151. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPageWidget/create-nonce.ts +6 -0
  152. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPageWidget/index.tsx +1 -0
  153. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyParagraph/create-nonce.ts +6 -0
  154. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyParagraph/index.tsx +2 -1
  155. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPercentage/create-nonce.ts +6 -0
  156. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPercentage/index.tsx +2 -1
  157. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPhone/create-nonce.ts +6 -0
  158. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPhone/index.tsx +2 -1
  159. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPicklist/create-nonce.ts +6 -0
  160. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPicklist/index.tsx +2 -1
  161. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyRadioButtons/create-nonce.ts +6 -0
  162. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyRadioButtons/index.tsx +1 -0
  163. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MySearchbox/create-nonce.ts +6 -0
  164. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MySearchbox/index.tsx +1 -0
  165. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyText/create-nonce.ts +6 -0
  166. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyText/index.tsx +1 -0
  167. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTextInput/create-nonce.ts +6 -0
  168. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTextInput/index.tsx +2 -1
  169. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTimeOfDay/create-nonce.ts +6 -0
  170. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTimeOfDay/index.tsx +2 -1
  171. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/create-nonce.ts +6 -0
  172. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/index.tsx +1 -0
  173. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnForm/create-nonce.ts +6 -0
  174. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnForm/index.tsx +1 -0
  175. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyURL/create-nonce.ts +6 -0
  176. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyURL/index.tsx +1 -0
  177. package/tests/assets/components/createAll/Launchpad/_components.md +1 -0
@@ -31,9 +31,15 @@ export default async options => {
31
31
 
32
32
  content = { componentKey, rulesetName, rulesetVersion, devBuild };
33
33
  } else {
34
- const questions = await getPublishComponentQuestions();
34
+ // VS Code pluggin would send in the component
35
+ let paramComponentKey;
36
+ if (options.params.length == 4) {
37
+ paramComponentKey = options.params[3];
38
+ }
39
+
40
+ const questions = await getPublishComponentQuestions(paramComponentKey);
35
41
  const answers = await inquirer.prompt(questions);
36
- ({ componentKey, sourceMap, devBuild } = answers);
42
+ ({ componentKey = paramComponentKey, sourceMap, devBuild } = answers);
37
43
 
38
44
  content = {
39
45
  ...answers
@@ -70,11 +70,17 @@ export const zipComponent = async componentKey => {
70
70
  const srcDirectory = await getComponentDirectoryPath(componentKey);
71
71
  const buildDirectory = await path.join(path.resolve(), 'dist/components', componentKey);
72
72
  const configJson = `${srcDirectory}/config.json`;
73
+ const localizationJson = `${srcDirectory}/localizations.json`;
73
74
 
74
75
  const zip = new AdmZip();
75
76
 
76
77
  zip.addLocalFolder(srcDirectory, 'src/');
77
78
  zip.addLocalFile(configJson);
79
+
80
+ if (fs.existsSync(localizationJson)) {
81
+ zip.addLocalFile(localizationJson);
82
+ }
83
+
78
84
  zip.addLocalFolder(buildDirectory);
79
85
  const zipContent = zip.toBuffer().toString('base64');
80
86
 
@@ -225,13 +225,20 @@ export default async options => {
225
225
 
226
226
  }
227
227
  else {
228
+ // VS Code pluggin would send in the component
229
+ let paramComponentKey;
230
+ if (options.params.length == 4) {
231
+ paramComponentKey = options.params[3];
232
+ }
233
+
228
234
  const questions = [
229
235
  {
230
236
  name: 'componentKey',
231
237
  type: 'rawlist',
232
238
  pageSize: 15,
233
239
  message: 'Select component to rename',
234
- choices: localComponents
240
+ choices: localComponents,
241
+ when: () => !paramComponentKey
235
242
  },
236
243
  {
237
244
  name: 'componentName',
@@ -312,7 +319,7 @@ export default async options => {
312
319
 
313
320
  await inquirer.prompt(questions).then(async answers => {
314
321
  const {
315
- componentKey,
322
+ componentKey = paramComponentKey,
316
323
  componentName,
317
324
  componentLabel,
318
325
  organization,
@@ -1,50 +1,32 @@
1
-
2
1
  import fs from 'fs';
3
- import path, { join } from 'path';
4
- import { URL, fileURLToPath } from 'url';
2
+ import path from 'path';
5
3
 
6
4
  import chalk from 'chalk';
7
- import { up } from 'inquirer/lib/utils/readline.js';
8
-
9
- import {
10
- convertIntoPascalCase,
11
- showVersion,
12
- updateUseWebPackPromotion
13
- } from '../../util.js';
14
- import {
15
- WEBPACK_CONFIG_JS_FILENAME,
16
- BUILDER_INDEX_FILE_PATH
17
- } from '../../constants.js';
18
-
19
5
 
6
+ import { showVersion, updateUseWebPackPromotion } from '../../util.js';
7
+ import { WEBPACK_CONFIG_JS_FILENAME } from '../../constants.js';
20
8
 
21
9
  export const renamePromotedWebPack = async () => {
22
-
23
10
  // call this function from top level
24
11
  // fs.copyFileSync("./webpack.config.js", "webpack.config.js")
25
12
 
26
13
  const promoteWebPackDir = path.resolve(WEBPACK_CONFIG_JS_FILENAME);
27
- const renamedPromoteWebPackDir = path.resolve(`${WEBPACK_CONFIG_JS_FILENAME }.notused`);
14
+ const renamedPromoteWebPackDir = path.resolve(`${WEBPACK_CONFIG_JS_FILENAME}.notused`);
28
15
 
29
16
  try {
30
17
  fs.renameSync(promoteWebPackDir, renamedPromoteWebPackDir);
31
- }
32
- catch (ex) {
18
+ } catch (ex) {
33
19
  console.log(chalk.bold.red(`File ${promoteWebPackDir} not found.`));
34
20
  process.exit();
35
21
  }
36
22
 
37
- console.log(chalk.bold.green("Bundler reverted to using internal webpack.config.js."));
23
+ console.log(chalk.bold.green('Bundler reverted to using internal webpack.config.js.'));
38
24
  console.log(chalk.bold.green(`File ${promoteWebPackDir} marked as not used.`));
25
+ };
39
26
 
40
- }
41
-
42
-
43
-
44
- export default async options => {
27
+ export default async () => {
45
28
  showVersion();
46
29
 
47
30
  await renamePromotedWebPack();
48
31
  await updateUseWebPackPromotion(false);
49
-
50
32
  };
package/src/util.js CHANGED
@@ -9,7 +9,7 @@ import chalk from 'chalk';
9
9
  import mustache from 'mustache';
10
10
  import pascalCase from 'pascalcase';
11
11
  import fetch from 'node-fetch';
12
- import checkGit from 'check-git';
12
+ // import checkGit from 'check-git';
13
13
 
14
14
  import * as currentPath from './currentPath.cjs';
15
15
  import {
@@ -33,14 +33,12 @@ export const checkPathAccess = async (path, options = {}, throwError = false) =>
33
33
  } catch (err) {
34
34
  if (throwError) {
35
35
  throw new Error(err);
36
- }
37
- else {
36
+ } else {
38
37
  const message =
39
38
  errorMessage || `${chalk.red.bold('ERROR')} Could not able to access path - ${path}`;
40
39
  console.error(message);
41
40
  process.exit(1);
42
41
  }
43
-
44
42
  }
45
43
  };
46
44
 
@@ -51,8 +49,7 @@ export const getUseWebPackPromotion = async () => {
51
49
  try {
52
50
  // force to throw error and not console log
53
51
  await checkPathAccess(pegaConfigJsonPath, {}, true);
54
- }
55
- catch (ex) {
52
+ } catch (ex) {
56
53
  // when can't find it, always be false, assume no webpack override.
57
54
  // This is IMPORTANT for init (npx install)
58
55
  return false;
@@ -75,10 +72,9 @@ export const getUseWebPackPromotion = async () => {
75
72
  }
76
73
 
77
74
  return data[USE_PROMOTED_WEB_PACK];
75
+ };
78
76
 
79
- }
80
-
81
- export const updateUseWebPackPromotion = async ( useValue = false ) => {
77
+ export const updateUseWebPackPromotion = async (useValue = false) => {
82
78
  const currentDirectory = process.cwd();
83
79
  const pegaConfigJsonPath = join(currentDirectory, TASKS_CONFIG_JSON_FILENAME);
84
80
 
@@ -94,11 +90,10 @@ export const updateUseWebPackPromotion = async ( useValue = false ) => {
94
90
  process.exit(1);
95
91
  }
96
92
 
97
- data["usePromotedWebPack"] = useValue;
93
+ data.usePromotedWebPack = useValue;
98
94
 
99
95
  fs.writeFileSync(pegaConfigJsonPath, JSON.stringify(data, null, 4), { encoding: 'utf8' });
100
-
101
- }
96
+ };
102
97
 
103
98
  export const deleteLocalComponent = async componentKey => {
104
99
  const currentDirectory = process.cwd();
@@ -262,6 +257,23 @@ export const getComponentDefaults = async () => {
262
257
  return config.component;
263
258
  };
264
259
 
260
+ export const getServerType = async () => {
261
+ const defaultPegaServerConfig = await getPegaServerConfig();
262
+ return defaultPegaServerConfig.serverType;
263
+ };
264
+
265
+ export const setServerType = async serverType => {
266
+ const currentDirectory = process.cwd();
267
+ const pegaConfigJsonPath = join(currentDirectory, TASKS_CONFIG_JSON_FILENAME);
268
+ const configData = await getPegaConfig();
269
+ const serverConfig = configData['server-config'];
270
+ serverConfig.serverType = serverType;
271
+
272
+ // update file
273
+ // stringify "4", makes the json string look like JSON in the file, formated instead of a single line
274
+ fs.writeFileSync(pegaConfigJsonPath, JSON.stringify(configData, null, 4), { encoding: 'utf8' });
275
+ };
276
+
265
277
  export const getComponentDirectoryPath = async componentKey => {
266
278
  const currentDirectory = process.cwd();
267
279
  const pegaConfigJsonPath = join(currentDirectory, TASKS_CONFIG_JSON_FILENAME);
@@ -350,12 +362,12 @@ export const showVersion = () => {
350
362
  process.exit(1);
351
363
  }
352
364
 
353
- const hasGit = checkGit(process.cwd());
365
+ // const hasGit = checkGit(process.cwd());
354
366
 
355
- if (!hasGit) {
356
- console.log(chalk.redBright('DX Component Builder - Git needs to be installed.'));
357
- process.exit(1);
358
- }
367
+ // if (!hasGit) {
368
+ // console.log(chalk.redBright('DX Component Builder - Git needs to be installed.'));
369
+ // process.exit(1);
370
+ // }
359
371
  };
360
372
 
361
373
  export const getOOTBComponents = async () => {
@@ -435,55 +447,37 @@ export const deleteInfinityServerComponent = async componentKey => {
435
447
  status = response.status;
436
448
  if (!response.ok) {
437
449
  if (status === 401) {
438
- throw new Error(
439
- 'Error occurred in authentication. Please regenerate using authenticate'
440
- );
450
+ throw new Error('Error occurred in authentication. Please regenerate using authenticate');
441
451
  // console.log(accessTokenUri, refreshToken);
442
452
  /* TODO - Handle refresh_token */
443
- }
444
- else if (status === 404){
453
+ } else if (status === 404) {
445
454
  throw new Error('404: Server resource not found');
446
- }
447
- else if (status === 405){
455
+ } else if (status === 405) {
448
456
  throw new Error('405: Server method not allowed');
449
- }
450
- else if (status === 408){
457
+ } else if (status === 408) {
451
458
  throw new Error('408: Server timed out');
459
+ } else if (response.status === 403) {
460
+ throw new Error('Error forbidden: User does not have privileges to Publish.');
452
461
  }
453
- else if (response.status === 403) {
454
- throw new Error(
455
- 'Error forbidden: User does not have privileges to Publish.'
456
- );
457
- }
458
-
459
-
460
462
  }
461
463
 
462
464
  try {
463
465
  const respData = await response.json();
464
- console.log(
465
- chalk.bold.green(`Success : ${respData.message}`)
466
- );
466
+ console.log(chalk.bold.green(`Success : ${respData.message}`));
467
467
 
468
468
  if (status === 500) {
469
469
  status = 999;
470
470
  throw new Error(respData.message);
471
471
  }
472
- }
473
- catch (err) {
472
+ } catch (err) {
474
473
  if (status === 500) {
475
- throw new Error(
476
- `Error occurred in authentication. Please regenerate using authenticate`
477
- );
478
- }
479
- else if (status === 999) {
480
- throw new Error (err);
474
+ throw new Error(`Error occurred in authentication. Please regenerate using authenticate`);
475
+ } else if (status === 999) {
476
+ throw new Error(err);
481
477
  }
482
478
  }
483
-
484
479
  }
485
480
  } catch (error) {
486
-
487
481
  throw new Error(error);
488
482
  }
489
483
  };
@@ -515,7 +509,6 @@ export const deleteLaunchpadServerComponent = async componentKey => {
515
509
  componentName
516
510
  };
517
511
 
518
-
519
512
  const response = await fetch(deleteUrl, {
520
513
  method: 'DELETE',
521
514
  agent: new https.Agent({ rejectUnauthorized: false }),
@@ -526,47 +519,33 @@ export const deleteLaunchpadServerComponent = async componentKey => {
526
519
  status = response.status;
527
520
  if (!response.ok) {
528
521
  if (status === 401) {
529
- throw new Error(
530
- 'Error occurred in authentication. Please regenerate using authenticate'
531
- );
522
+ throw new Error('Error occurred in authentication. Please regenerate using authenticate');
532
523
  // console.log(accessTokenUri, refreshToken);
533
524
  /* TODO - Handle refresh_token */
534
- }
535
- else if (status === 404){
525
+ } else if (status === 404) {
536
526
  throw new Error('404: Server resource not found');
537
- }
538
- else if (status === 405){
527
+ } else if (status === 405) {
539
528
  throw new Error('405: Server method not allowed');
540
- }
541
- else if (status === 408){
529
+ } else if (status === 408) {
542
530
  throw new Error('408: Server timed out');
543
- }
544
- else if (response.status === 403) {
545
- throw new Error(
546
- 'Error forbidden: User does not have privileges to Publish.'
547
- );
531
+ } else if (response.status === 403) {
532
+ throw new Error('Error forbidden: User does not have privileges to Publish.');
548
533
  }
549
534
  }
550
535
 
551
536
  try {
552
537
  const respData = await response.text();
553
- console.log(
554
- chalk.bold.green(`Success : ${respData}`)
555
- );
538
+ console.log(chalk.bold.green(`Success : ${respData}`));
556
539
 
557
540
  if (status === 500) {
558
541
  status = 999;
559
542
  throw new Error(respData.message);
560
543
  }
561
- }
562
- catch (err) {
544
+ } catch (err) {
563
545
  if (status === 500) {
564
- throw new Error(
565
- `Error occurred in authentication. Please regenerate using authenticate`
566
- );
567
- }
568
- else if (status === 999) {
569
- throw new Error (err);
546
+ throw new Error(`Error occurred in authentication. Please regenerate using authenticate`);
547
+ } else if (status === 999) {
548
+ throw new Error(err);
570
549
  }
571
550
  }
572
551
  }
@@ -0,0 +1,6 @@
1
+ /* eslint-disable camelcase */
2
+ // @ts-ignore
3
+ if (window?.__webpack_nonce__) {
4
+ // @ts-ignore
5
+ __webpack_nonce__ = window.__webpack_nonce__;
6
+ }
@@ -1,6 +1,7 @@
1
1
  import { Input, withConfiguration } from '@pega/cosmos-react-core';
2
2
 
3
3
  import type { PConnFieldProps } from './PConnProps';
4
+ import './create-nonce';
4
5
 
5
6
  import StyledPegaDxilMyTestTextWrapper from './styles';
6
7
 
@@ -0,0 +1 @@
1
+ # directory for components #
@@ -0,0 +1,6 @@
1
+ /* eslint-disable camelcase */
2
+ // @ts-ignore
3
+ if (window?.__webpack_nonce__) {
4
+ // @ts-ignore
5
+ __webpack_nonce__ = window.__webpack_nonce__;
6
+ }
@@ -7,6 +7,8 @@ import {
7
7
  } from "@pega/cosmos-react-core";
8
8
 
9
9
  import type { PConnFieldProps } from './PConnProps';
10
+ import './create-nonce';
11
+
10
12
 
11
13
  // includes in bundle
12
14
  import handleEvent from "./event-utils";
@@ -104,7 +106,7 @@ function PegaDxilMyBoolean(props: PegaDxilMyBooleanProps) {
104
106
  }
105
107
 
106
108
  if (displayMode === 'DISPLAY_ONLY') {
107
- return ( <StyledPegaDxilMyBooleanWrapper> displayComponent </StyledPegaDxilMyBooleanWrapper>);
109
+ return ( <StyledPegaDxilMyBooleanWrapper> {displayComponent} </StyledPegaDxilMyBooleanWrapper>);
108
110
  }
109
111
 
110
112
  if (displayMode === "LABELS_LEFT") {
@@ -0,0 +1,6 @@
1
+ /* eslint-disable camelcase */
2
+ // @ts-ignore
3
+ if (window?.__webpack_nonce__) {
4
+ // @ts-ignore
5
+ __webpack_nonce__ = window.__webpack_nonce__;
6
+ }
@@ -1,6 +1,7 @@
1
1
  import { useState, useEffect } from 'react';
2
2
  import { Table, Text, withConfiguration } from '@pega/cosmos-react-core';
3
3
  import type { PConnFieldProps } from './PConnProps';
4
+ import './create-nonce';
4
5
 
5
6
  import StyledPegaDxilMyCaseWidgetWrapper from './styles';
6
7
 
@@ -0,0 +1,6 @@
1
+ /* eslint-disable camelcase */
2
+ // @ts-ignore
3
+ if (window?.__webpack_nonce__) {
4
+ // @ts-ignore
5
+ __webpack_nonce__ = window.__webpack_nonce__;
6
+ }
@@ -12,6 +12,7 @@ import {
12
12
 
13
13
 
14
14
  import type { PConnFieldProps } from './PConnProps';
15
+ import './create-nonce';
15
16
 
16
17
  // includes in bundle
17
18
  import handleEvent from './event-utils';
@@ -189,7 +190,7 @@ function PegaDxilMyCurrency(props: PegaDxilMyCurrencyProps) {
189
190
 
190
191
  switch (displayMode) {
191
192
  case 'DISPLAY_ONLY': {
192
- return (<StyledPegaDxilMyCurrencyWrapper> displayComp </StyledPegaDxilMyCurrencyWrapper>) ;
193
+ return (<StyledPegaDxilMyCurrencyWrapper> {displayComp} </StyledPegaDxilMyCurrencyWrapper>) ;
193
194
  }
194
195
  case 'LABELS_LEFT': {
195
196
  return (
@@ -0,0 +1,6 @@
1
+ /* eslint-disable camelcase */
2
+ // @ts-ignore
3
+ if (window?.__webpack_nonce__) {
4
+ // @ts-ignore
5
+ __webpack_nonce__ = window.__webpack_nonce__;
6
+ }
@@ -3,6 +3,7 @@ import { DateInput, FieldValueList, DateTimeDisplay, Text, withConfiguration } f
3
3
  import FormattedText from "./FormattedText";
4
4
 
5
5
  import type { PConnFieldProps } from './PConnProps';
6
+ import './create-nonce';
6
7
 
7
8
  import StyledPegaDxilMyDateWrapper from './styles';
8
9
 
@@ -175,7 +176,7 @@ function PegaDxilMyDate (props: PegaDxilMyDateProps) {
175
176
  );
176
177
  switch(displayMode){
177
178
  case 'DISPLAY_ONLY': {
178
- return ( <StyledPegaDxilMyDateWrapper> displayComp </StyledPegaDxilMyDateWrapper>);
179
+ return ( <StyledPegaDxilMyDateWrapper> {displayComp} </StyledPegaDxilMyDateWrapper>);
179
180
  }
180
181
  case "LABELS_LEFT" : {
181
182
  return (
@@ -0,0 +1,6 @@
1
+ /* eslint-disable camelcase */
2
+ // @ts-ignore
3
+ if (window?.__webpack_nonce__) {
4
+ // @ts-ignore
5
+ __webpack_nonce__ = window.__webpack_nonce__;
6
+ }
@@ -1,6 +1,7 @@
1
1
  import { useEffect, useState } from 'react';
2
2
  import { DateTimeInput, FieldValueList, DateTimeDisplay, Text, withConfiguration } from "@pega/cosmos-react-core";
3
3
  import type { PConnFieldProps } from './PConnProps';
4
+ import './create-nonce';
4
5
 
5
6
  // includes in bundle
6
7
  import DateTimeFormatter from "./date-time";
@@ -181,7 +182,7 @@ function PegaDxilMyDateTime (props: PegaDxilMyDateTimeProps) {
181
182
  );
182
183
  switch (displayMode) {
183
184
  case 'DISPLAY_ONLY': {
184
- return ( <StyledPegaDxilMyDateTimeWrapper> displayComp </StyledPegaDxilMyDateTimeWrapper>);
185
+ return ( <StyledPegaDxilMyDateTimeWrapper> {displayComp} </StyledPegaDxilMyDateTimeWrapper>);
185
186
  }
186
187
  case 'LABELS_LEFT': {
187
188
  return (
@@ -0,0 +1,6 @@
1
+ /* eslint-disable camelcase */
2
+ // @ts-ignore
3
+ if (window?.__webpack_nonce__) {
4
+ // @ts-ignore
5
+ __webpack_nonce__ = window.__webpack_nonce__;
6
+ }
@@ -2,6 +2,7 @@ import { useState, useEffect, useRef } from 'react';
2
2
  import { NumberInput, NumberDisplay, CurrencyDisplay, FieldValueList, Text, withConfiguration } from '@pega/cosmos-react-core';
3
3
 
4
4
  import type { PConnFieldProps } from './PConnProps';
5
+ import './create-nonce';
5
6
 
6
7
  // includes in bundle
7
8
  import StyledPegaDxilMyDecimalWrapper from './styles';
@@ -158,7 +159,7 @@ function PegaDxilMyDecimal(props: PegaDxilMyDecimalProps) {
158
159
 
159
160
  switch (displayMode) {
160
161
  case 'DISPLAY_ONLY': {
161
- return (<StyledPegaDxilMyDecimalWrapper> displayComp </StyledPegaDxilMyDecimalWrapper>);
162
+ return (<StyledPegaDxilMyDecimalWrapper> {displayComp} </StyledPegaDxilMyDecimalWrapper>);
162
163
  }
163
164
  case 'LABELS_LEFT': {
164
165
  return (
@@ -0,0 +1,6 @@
1
+ /* eslint-disable camelcase */
2
+ // @ts-ignore
3
+ if (window?.__webpack_nonce__) {
4
+ // @ts-ignore
5
+ __webpack_nonce__ = window.__webpack_nonce__;
6
+ }
@@ -1,6 +1,7 @@
1
1
  import { Fragment } from 'react';
2
2
  import { Grid, Flex, FieldGroup, withConfiguration } from '@pega/cosmos-react-core';
3
3
  import type { PConnFieldProps } from './PConnProps';
4
+ import './create-nonce';
4
5
 
5
6
  import StyledPegaDxilMyDetailsWrapper from './styles';
6
7
 
@@ -0,0 +1,6 @@
1
+ /* eslint-disable camelcase */
2
+ // @ts-ignore
3
+ if (window?.__webpack_nonce__) {
4
+ // @ts-ignore
5
+ __webpack_nonce__ = window.__webpack_nonce__;
6
+ }
@@ -1,6 +1,7 @@
1
1
  import { useState, useEffect, useRef } from 'react';
2
2
  import { Input, EmailDisplay, FieldValueList, Text, URLDisplay, PhoneDisplay, withConfiguration } from '@pega/cosmos-react-core';
3
3
  import type { PConnFieldProps } from './PConnProps';
4
+ import './create-nonce';
4
5
 
5
6
  // includes in bundle
6
7
  import { suggestionsHandler } from './suggestions-handler';
@@ -128,7 +129,7 @@ function PegaDxilMyEmail(props: PegaDxilMyEmailProps) {
128
129
  }
129
130
  return displayMode === 'DISPLAY_ONLY' ? (
130
131
  <StyledPegaDxilMyEmailWrapper>
131
- displayComp
132
+ {displayComp}
132
133
  </StyledPegaDxilMyEmailWrapper>
133
134
  ) : (
134
135
  <StyledPegaDxilMyEmailWrapper>
@@ -0,0 +1,6 @@
1
+ /* eslint-disable camelcase */
2
+ // @ts-ignore
3
+ if (window?.__webpack_nonce__) {
4
+ // @ts-ignore
5
+ __webpack_nonce__ = window.__webpack_nonce__;
6
+ }
@@ -1,7 +1,7 @@
1
1
  import { Grid, FieldGroup, withConfiguration } from '@pega/cosmos-react-core';
2
2
 
3
-
4
3
  import type { PConnFieldProps } from './PConnProps';
4
+ import './create-nonce';
5
5
 
6
6
  import StyledPegaDxilMyFormWrapper from './styles';
7
7
 
@@ -0,0 +1,6 @@
1
+ /* eslint-disable camelcase */
2
+ // @ts-ignore
3
+ if (window?.__webpack_nonce__) {
4
+ // @ts-ignore
5
+ __webpack_nonce__ = window.__webpack_nonce__;
6
+ }
@@ -3,6 +3,7 @@ import { NumberInput, NumberDisplay, Slider, FieldValueList, CurrencyDisplay, Te
3
3
 
4
4
 
5
5
  import type { PConnFieldProps } from './PConnProps';
6
+ import './create-nonce';
6
7
 
7
8
  // includes in bundle
8
9
  import handleEvent from "./event-utils";
@@ -184,7 +185,7 @@ function PegaDxilMyInteger(props: PegaDxilMyIntegerProps) {
184
185
 
185
186
  switch (displayMode) {
186
187
  case 'DISPLAY_ONLY': {
187
- return (<StyledPegaDxilMyIntegerWrapper> displayComp </StyledPegaDxilMyIntegerWrapper>);
188
+ return (<StyledPegaDxilMyIntegerWrapper> {displayComp} </StyledPegaDxilMyIntegerWrapper>);
188
189
  }
189
190
  case 'LABELS_LEFT': {
190
191
  return (
@@ -0,0 +1,6 @@
1
+ /* eslint-disable camelcase */
2
+ // @ts-ignore
3
+ if (window?.__webpack_nonce__) {
4
+ // @ts-ignore
5
+ __webpack_nonce__ = window.__webpack_nonce__;
6
+ }
@@ -3,7 +3,7 @@ import { OneColumnPage as OneColumn, withConfiguration } from '@pega/cosmos-reac
3
3
  import { ConfigurableLayout } from '@pega/cosmos-react-work'
4
4
  // import { registerIcon } from '@pega/cosmos-react-core';
5
5
  import type { PConnFieldProps } from './PConnProps';
6
-
6
+ import './create-nonce';
7
7
 
8
8
 
9
9
  // temp
@@ -0,0 +1,6 @@
1
+ /* eslint-disable camelcase */
2
+ // @ts-ignore
3
+ if (window?.__webpack_nonce__) {
4
+ // @ts-ignore
5
+ __webpack_nonce__ = window.__webpack_nonce__;
6
+ }
@@ -4,6 +4,7 @@ import { Fragment } from 'react';
4
4
  import { DateTimeDisplay, Card, CardHeader, CardContent, Flex, withConfiguration } from '@pega/cosmos-react-core';
5
5
 
6
6
  import type { PConnFieldProps } from './PConnProps';
7
+ import './create-nonce';
7
8
 
8
9
  // includes in bundle
9
10
  import Operator from './Operator';
@@ -0,0 +1,6 @@
1
+ /* eslint-disable camelcase */
2
+ // @ts-ignore
3
+ if (window?.__webpack_nonce__) {
4
+ // @ts-ignore
5
+ __webpack_nonce__ = window.__webpack_nonce__;
6
+ }