@pega/custom-dx-components 2.0.24 → 2.0.25

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 (122) hide show
  1. package/README.md +1 -1
  2. package/package.json +3 -5
  3. package/src/cli.js +0 -18
  4. package/src/constants.js +2 -32
  5. package/src/tasks/authenticate/helper.js +8 -91
  6. package/src/tasks/authenticate/index.js +56 -125
  7. package/src/tasks/create/index.js +63 -59
  8. package/src/tasks/create/templates/Constellation/Field/Boolean/boolean-format.js.mustache +1 -1
  9. package/src/tasks/create/templates/Constellation/Field/Boolean/demo.stories.jsx.mustache +16 -33
  10. package/src/tasks/create/templates/Constellation/Field/Boolean/index.jsx.mustache +2 -1
  11. package/src/tasks/create/templates/Constellation/Field/Date/date.js.mustache +67 -179
  12. package/src/tasks/create/templates/Constellation/Field/Date/demo.stories.jsx.mustache +17 -46
  13. package/src/tasks/create/templates/Constellation/Field/Date/index.jsx.mustache +1 -3
  14. package/src/tasks/create/templates/Constellation/Field/DateTime/date-time.js.mustache +1 -0
  15. package/src/tasks/create/templates/Constellation/Field/DateTime/{date-utils.js.mustache → date-utils.js} +0 -1
  16. package/src/tasks/create/templates/Constellation/Field/DateTime/date.js.mustache +0 -1
  17. package/src/tasks/create/templates/Constellation/Field/DateTime/demo.stories.jsx.mustache +17 -46
  18. package/src/tasks/create/templates/Constellation/Field/DateTime/index.jsx.mustache +0 -2
  19. package/src/tasks/create/templates/Constellation/Field/Decimal/demo.stories.jsx.mustache +17 -22
  20. package/src/tasks/create/templates/Constellation/Field/Decimal/index.jsx.mustache +1 -2
  21. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/demo.stories.jsx.mustache +17 -26
  22. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/index.jsx.mustache +4 -3
  23. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/demo.stories.jsx.mustache +17 -22
  24. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/index.jsx.mustache +2 -8
  25. package/src/tasks/create/templates/Constellation/Field/Integer/demo.stories.jsx.mustache +17 -22
  26. package/src/tasks/create/templates/Constellation/Field/Integer/index.jsx.mustache +1 -2
  27. package/src/tasks/create/templates/Constellation/Field/Picklist/demo.stories.jsx.mustache +16 -50
  28. package/src/tasks/create/templates/Constellation/Field/Picklist/index.jsx.mustache +1 -44
  29. package/src/tasks/create/templates/Constellation/Field/Picklist/picklist.js.mustache +43 -0
  30. package/src/tasks/create/templates/Constellation/Field/Text/demo.stories.jsx.mustache +16 -23
  31. package/src/tasks/create/templates/Constellation/Field/Text-Email/demo.stories.jsx.mustache +17 -21
  32. package/src/tasks/create/templates/Constellation/Field/Text-Email/index.jsx.mustache +2 -44
  33. package/src/tasks/create/templates/Constellation/Field/Text-Email/text-email.js.mustache +43 -0
  34. package/src/tasks/create/templates/Constellation/Field/Text-Input/{StatusWork.jsx → StatusWork.js} +1 -0
  35. package/src/tasks/create/templates/Constellation/Field/Text-Input/demo.stories.jsx.mustache +17 -21
  36. package/src/tasks/create/templates/Constellation/Field/Text-Input/index.jsx.mustache +3 -46
  37. package/src/tasks/create/templates/Constellation/Field/Text-Input/text-input.js.mustache +43 -0
  38. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/demo.stories.jsx.mustache +17 -21
  39. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/index.jsx.mustache +2 -44
  40. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/text-paragraph.js.mustache +43 -0
  41. package/src/tasks/create/templates/Constellation/Field/Text-Phone/demo.stories.jsx.mustache +17 -19
  42. package/src/tasks/create/templates/Constellation/Field/Text-Phone/index.jsx.mustache +3 -47
  43. package/src/tasks/create/templates/Constellation/Field/Text-Phone/text-phone.js.mustache +43 -0
  44. package/src/tasks/create/templates/Constellation/Field/Text-URL/demo.stories.jsx.mustache +17 -19
  45. package/src/tasks/create/templates/Constellation/Field/Text-URL/index.jsx.mustache +1 -1
  46. package/src/tasks/create/templates/Constellation/Field/Text-URL/{text-url.jsx.mustache → text-url.js.mustache} +1 -2
  47. package/src/tasks/create/templates/Constellation/Field/TimeofDay/demo.stories.jsx.mustache +17 -30
  48. package/src/tasks/create/templates/Constellation/Field/TimeofDay/time-of-day.js.mustache +0 -1
  49. package/src/tasks/create/templates/Constellation/Template/DETAILS/index.jsx.mustache +29 -14
  50. package/src/tasks/create/templates/Constellation/Template/DETAILS/utils.js.mustache +77 -3
  51. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/index.jsx.mustache +29 -14
  52. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/utils.js.mustache +74 -3
  53. package/src/tasks/create/templates/Constellation/Template/FORM/index.jsx.mustache +10 -6
  54. package/src/tasks/create/templates/Constellation/Template/FORM-region/index.jsx.mustache +8 -10
  55. package/src/tasks/create/templates/Constellation/Template/PAGE/{GetNextWork.jsx.mustache → GetNextWork.js.mustache} +0 -6
  56. package/src/tasks/create/templates/Constellation/Template/PAGE/index.jsx.mustache +7 -9
  57. package/src/tasks/create/templates/Constellation/Template/PAGE/utils.js.mustache +1 -4
  58. package/src/tasks/create/templates/Constellation/Widget/CASE/index.jsx.mustache +0 -1
  59. package/src/tasks/create/templates/Constellation/Widget/PAGE/index.jsx.mustache +8 -8
  60. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/{Avatar.jsx.mustache → Avatar.js.mustache} +0 -2
  61. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/{Operator.jsx.mustache → Operator.js.mustache} +1 -2
  62. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/index.jsx.mustache +9 -9
  63. package/src/tasks/delete/helper.js +0 -4
  64. package/src/tasks/delete/index.js +0 -4
  65. package/src/tasks/index.js +0 -3
  66. package/src/tasks/init/index.js +3 -3
  67. package/src/tasks/init/template/.eslintrc.json +5 -186
  68. package/src/tasks/init/template/README.md +59 -75
  69. package/src/tasks/init/template/package.json.mustache +6 -21
  70. package/src/tasks/init/template/tasks.config.json +4 -16
  71. package/src/tasks/list/index.js +0 -4
  72. package/src/tasks/{bundle → publish/bundle}/builder/webpack.config.js +2 -0
  73. package/src/tasks/{bundle → publish/bundle}/index.js +2 -2
  74. package/src/tasks/publish/index.js +1 -14
  75. package/src/util.js +6 -11
  76. package/src/auth.js +0 -573
  77. package/src/tasks/build/helper.js +0 -123
  78. package/src/tasks/build/index.js +0 -54
  79. package/src/tasks/create/templates/Constellation/Field/Boolean/mock.stories.js.mustache +0 -21
  80. package/src/tasks/create/templates/Constellation/Field/Date/DateFormatter.js.mustache +0 -61
  81. package/src/tasks/create/templates/Constellation/Field/Date/FormattedText.jsx.mustache +0 -41
  82. package/src/tasks/create/templates/Constellation/Field/Date/mock.stories.js.mustache +0 -23
  83. package/src/tasks/create/templates/Constellation/Field/DateTime/mock.stories.js.mustache +0 -23
  84. package/src/tasks/create/templates/Constellation/Field/Decimal/mock.stories.js.mustache +0 -21
  85. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/mock.stories.js.mustache +0 -23
  86. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/mock.stories.js.mustache +0 -21
  87. package/src/tasks/create/templates/Constellation/Field/Integer/mock.stories.js.mustache +0 -21
  88. package/src/tasks/create/templates/Constellation/Field/Picklist/mock.stories.js.mustache +0 -67
  89. package/src/tasks/create/templates/Constellation/Field/Text/mock.stories.js.mustache +0 -13
  90. package/src/tasks/create/templates/Constellation/Field/Text-Email/mock.stories.js.mustache +0 -22
  91. package/src/tasks/create/templates/Constellation/Field/Text-Input/mock.stories.js.mustache +0 -21
  92. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/mock.stories.js.mustache +0 -20
  93. package/src/tasks/create/templates/Constellation/Field/Text-Phone/mock.stories.js.mustache +0 -37
  94. package/src/tasks/create/templates/Constellation/Field/Text-URL/mock.stories.js.mustache +0 -22
  95. package/src/tasks/create/templates/Constellation/Field/TimeofDay/mock.stories.js.mustache +0 -20
  96. package/src/tasks/create/templates/Constellation/Template/DETAILS/StatusWork.jsx.mustache +0 -26
  97. package/src/tasks/create/templates/Constellation/Template/DETAILS/demo.stories.jsx.mustache +0 -118
  98. package/src/tasks/create/templates/Constellation/Template/DETAILS/mock.stories.js.mustache +0 -179
  99. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/StatusWork.jsx.mustache +0 -26
  100. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/demo.stories.jsx.mustache +0 -123
  101. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/mock.stories.js.mustache +0 -215
  102. package/src/tasks/create/templates/Constellation/Template/FORM/demo.stories.jsx.mustache +0 -93
  103. package/src/tasks/create/templates/Constellation/Template/FORM/mock.stories.js.mustache +0 -125
  104. package/src/tasks/create/templates/Constellation/Template/FORM-region/demo.stories.jsx.mustache +0 -100
  105. package/src/tasks/create/templates/Constellation/Template/FORM-region/mock.stories.js.mustache +0 -131
  106. package/src/tasks/create/templates/Constellation/Template/PAGE/demo.stories.jsx.mustache +0 -101
  107. package/src/tasks/create/templates/Constellation/Template/PAGE/mock.stories.js.mustache +0 -94
  108. package/src/tasks/create/templates/Constellation/Widget/CASE/demo.stories.jsx.mustache +0 -78
  109. package/src/tasks/create/templates/Constellation/Widget/CASE/mock.stories.js.mustache +0 -390
  110. package/src/tasks/create/templates/Constellation/Widget/PAGE/demo.stories.jsx.mustache +0 -30
  111. package/src/tasks/create/templates/Constellation/Widget/PAGE/mock.stories.js.mustache +0 -23
  112. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/demo.stories.jsx.mustache +0 -68
  113. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/mock.stories.js.mustache +0 -51
  114. package/src/tasks/delete-all/helper.js +0 -175
  115. package/src/tasks/delete-all/index.js +0 -49
  116. package/src/tasks/init/template/.eslintignore +0 -8
  117. package/src/tasks/linter/index.js +0 -46
  118. package/src/tasks/publish-all/helper.js +0 -139
  119. package/src/tasks/publish-all/index.js +0 -84
  120. /package/src/tasks/{bundle → publish/bundle}/builder/index.js +0 -0
  121. /package/src/tasks/{bundle → publish/bundle}/builder/modules.js +0 -0
  122. /package/src/tasks/{bundle → publish/bundle}/builder/paths.js +0 -0
@@ -1,31 +1,19 @@
1
1
  {
2
2
  "components-directory-path": "src/components",
3
3
  "server-config": {
4
+ "server": "https://localhost:38764/prweb",
5
+ "user": "user",
6
+ "password": "password",
4
7
  "rulesetName": "rulesetName",
5
8
  "rulesetVersion": "rulesetVersion",
6
9
  "sourceOfComponents": "Server",
7
10
  "devBuild": false,
8
- "serverType": "infinity",
9
- "server": "https://localhost:38764/prweb",
10
11
  "clientId": "",
11
- "clientSecret_comment": "Needed only when using 'passwordCreds' or 'clientCreds' grantType",
12
- "clientSecret": "",
13
- "grantType": "authCode",
14
- "redirectUri": "https://localhost:4010/",
15
- "cert_and_key_comment": "Path to SSL certificate file and SSL key file to use when starting local HTTPS server",
16
- "cert_and_key_comment2": "Needed only when using 'authCode' grantType and redirectUri begins with 'https://localhost'",
17
- "cert": "",
18
- "key": "",
19
- "user_and_password_comment": "useful primarily when grantType is set to 'passwordCreds'",
20
- "user": "",
21
- "password": "",
22
- "questions_askAlways": "",
23
- "questions_askNever": ""
12
+ "clientSecret": ""
24
13
  },
25
14
  "component": {
26
15
  "library": "",
27
16
  "type": "",
28
- "version": "",
29
17
  "subtype": "",
30
18
  "description": "",
31
19
  "icon": ""
@@ -10,8 +10,6 @@ import {
10
10
  getListComponentsQuestions
11
11
  } from './helper.js';
12
12
 
13
- import { showVersion } from '../../util.js';
14
-
15
13
  const getList = async (sourceOfComponents, answers) => {
16
14
  switch (sourceOfComponents) {
17
15
  case SOURCE_OF_COMPONENT_TYPES.LOCAL: {
@@ -34,8 +32,6 @@ const getList = async (sourceOfComponents, answers) => {
34
32
  };
35
33
 
36
34
  export default async options => {
37
- showVersion();
38
-
39
35
  let sourceOfComponentsOption = SOURCE_OF_COMPONENT_TYPES.LOCAL;
40
36
 
41
37
  if (options.params[3] === SOURCE_OF_COMPONENT_TYPES.LOCAL) {
@@ -306,12 +306,14 @@ export default (
306
306
  contextRegExp: /moment$/
307
307
  }),
308
308
  /* Ignore cosmos icons */
309
+
309
310
  new webpack.IgnorePlugin({
310
311
  resourceRegExp: /^\.\/icons$/,
311
312
  contextRegExp: /@pega\/cosmos-react-core\/lib\/components\/Icon$/
312
313
  }),
313
314
 
314
315
  /* Ignore cosmos icons - windows */
316
+
315
317
  new webpack.IgnorePlugin({
316
318
  resourceRegExp: /^\.\/icons$/,
317
319
  contextRegExp: /@pega\\cosmos-react-core\\lib\\components\\Icon$/
@@ -2,8 +2,8 @@ import path from 'path';
2
2
  import fs from 'fs';
3
3
  import { stat } from 'fs/promises';
4
4
 
5
- import { BUILD_CONFIG_JSON_FILENAME } from '../../constants.js';
6
- import { getComponentDirectoryPath } from '../../util.js';
5
+ import { BUILD_CONFIG_JSON_FILENAME } from '../../../constants.js';
6
+ import { getComponentDirectoryPath } from '../../../util.js';
7
7
 
8
8
  import buildComponent from './builder/index.js';
9
9
 
@@ -4,15 +4,10 @@ import chalk from 'chalk';
4
4
 
5
5
  import validate from '../validator/index.js';
6
6
 
7
- import bundleComponent from '../bundle/index.js';
8
- import { lintComponent } from '../linter/index.js';
9
-
10
- import { getComponentDirectoryPath, showVersion } from '../../util.js';
7
+ import bundleComponent from './bundle/index.js';
11
8
  import { getPublishComponentQuestions, publishComponentToServer, zipComponent } from './helper.js';
12
9
 
13
10
  export default async options => {
14
- showVersion();
15
-
16
11
  const questions = await getPublishComponentQuestions();
17
12
  const answers = await inquirer.prompt(questions);
18
13
  const { componentKey, sourceMap, devBuild } = answers;
@@ -29,14 +24,6 @@ export default async options => {
29
24
  await validate(componentKey);
30
25
  }
31
26
  },
32
- {
33
- title: 'Lint component',
34
- task: async () => {
35
- const targetDirectory = await getComponentDirectoryPath(componentKey);
36
- // console.log(`in buildComponent Lint component task: componentKey: ${componentKey} targetDirectory: ${targetDirectory}`);
37
- await lintComponent(targetDirectory);
38
- }
39
- },
40
27
  {
41
28
  title: 'Bundle Component',
42
29
  task: async () => await bundleComponent(componentKey, sourceMap, devBuild),
package/src/util.js CHANGED
@@ -7,8 +7,6 @@ import chalk from 'chalk';
7
7
  import mustache from 'mustache';
8
8
  import pascalCase from 'pascalcase';
9
9
  import fetch from 'node-fetch';
10
- import { createRequire } from 'module';
11
-
12
10
 
13
11
  import {
14
12
  COMPONENTS_DIRECTORY_PATH,
@@ -16,7 +14,8 @@ import {
16
14
  TOKEN_PATH,
17
15
  OOTB_COMPONENT_SERVICE_REST_ENDPOINT,
18
16
  DELETE_COMPONENT_SERVICE_REST_ENDPOINT,
19
- OOTB_COMPONENTS
17
+ OOTB_COMPONENTS,
18
+ TOKEN_URL_V1
20
19
  } from './constants.js';
21
20
 
22
21
  const access = promisify(fs.access);
@@ -219,14 +218,6 @@ export const validateRulesetVersion = str => {
219
218
  return regex.test(str);
220
219
  };
221
220
 
222
- export const showVersion = () => {
223
- // get package version, so can display at start
224
- const require = createRequire(import.meta.url);
225
- const pData = require("@pega/custom-dx-components/package.json");
226
-
227
- console.log(chalk.green("DX Component Builder v" + pData.version));
228
- };
229
-
230
221
  export const getOOTBComponents = async () => {
231
222
  return new Promise((resolve, reject) => {
232
223
  fs.readFile(OOTB_COMPONENTS, 'utf-8', async (err, data) => {
@@ -280,3 +271,7 @@ export const getOOTBComponents = async () => {
280
271
  });
281
272
  });
282
273
  };
274
+
275
+ export const getTokenUrl = async (server) => {
276
+ return server.endsWith('/') ? `${server}${TOKEN_URL_V1}` : `${server}/${TOKEN_URL_V1}`;
277
+ };