@pega/custom-dx-components 0.25.30 → 0.25.32

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 (87) hide show
  1. package/README.md +3 -5
  2. package/eslint.config.mjs +227 -0
  3. package/package.json +3 -3
  4. package/src/constants.js +1 -1
  5. package/src/tasks/create/index.js +8 -2
  6. package/src/tasks/create/templates/Constellation/Field/Picklist/index.tsx.mustache +0 -1
  7. package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/index.tsx.mustache +1 -1
  8. package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/repeat-utils.ts.mustache +2 -1
  9. package/src/tasks/create/templates/Constellation/Field/Picklist-RadioButtons/index.tsx.mustache +2 -3
  10. package/src/tasks/create/templates/Constellation/Field/Text-Input/{StatusWork.tsx → StatusWork.tsx.mustache} +0 -1
  11. package/src/tasks/create/templates/Constellation/Template/DETAILS/Avatar.tsx.mustache +0 -1
  12. package/src/tasks/create/templates/Constellation/Template/DETAILS/HighlightRender.tsx.mustache +0 -1
  13. package/src/tasks/create/templates/Constellation/Template/DETAILS/StatusWork.tsx.mustache +0 -1
  14. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/Avatar.tsx.mustache +0 -1
  15. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/HighlightRender.tsx.mustache +0 -1
  16. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/StatusWork.tsx.mustache +0 -1
  17. package/src/tasks/create/templates/Constellation/Template/PAGE/GetNextWork.tsx.mustache +0 -1
  18. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/Avatar.tsx.mustache +0 -1
  19. package/src/tasks/create-all/index.js +18 -2
  20. package/src/tasks/create-lib/helper.js +1 -2
  21. package/src/tasks/delete-pub/index.js +1 -1
  22. package/src/tasks/export-archive/helper.js +1 -1
  23. package/src/tasks/import-archive/index.js +22 -11
  24. package/src/tasks/init/template/.eslintignore +1 -0
  25. package/src/tasks/init/template/README.md +3 -5
  26. package/src/tasks/init/template/eslint.config.mjs +227 -0
  27. package/src/tasks/init/template/package.json.mustache +3 -2
  28. package/src/tasks/init/template/tasks.config.json +2 -2
  29. package/src/tasks/init/template/tsconfig.build.json +2 -1
  30. package/src/tasks/init/template/tsconfig.json +1 -0
  31. package/src/tasks/list-pub/index.js +4 -1
  32. package/src/tasks/promote-webpack/index.js +0 -3
  33. package/src/tasks/publish/index.js +2 -0
  34. package/src/tasks/publish-archive/index.js +2 -1
  35. package/src/tasks/show-help/index.js +9 -2
  36. package/src/tasks/show-status/index.js +7 -1
  37. package/src/tasks/validator/index.js +5 -0
  38. package/src/util.js +30 -2
  39. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDetails/Avatar.tsx +0 -1
  40. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDetails/HighlightRender.tsx +0 -1
  41. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDetails/StatusWork.tsx +0 -1
  42. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPage/GetNextWork.tsx +0 -1
  43. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPageCaseWidget/Avatar.tsx +0 -1
  44. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPicklist/index.tsx +0 -1
  45. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyRadiobuttons/index.tsx +2 -3
  46. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MySearchbox/index.tsx +1 -1
  47. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MySearchbox/repeat-utils.ts +2 -1
  48. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyTextInput/StatusWork.tsx +0 -1
  49. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/Avatar.tsx +0 -1
  50. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/HighlightRender.tsx +0 -1
  51. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/StatusWork.tsx +0 -1
  52. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDetails/Avatar.tsx +0 -1
  53. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDetails/HighlightRender.tsx +0 -1
  54. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDetails/StatusWork.tsx +0 -1
  55. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPage/GetNextWork.tsx +0 -1
  56. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPageCaseWidget/Avatar.tsx +0 -1
  57. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPicklist/index.tsx +0 -1
  58. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyRadiobuttons/index.tsx +2 -3
  59. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MySearchbox/index.tsx +1 -1
  60. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MySearchbox/repeat-utils.ts +2 -1
  61. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyTextInput/StatusWork.tsx +0 -1
  62. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/Avatar.tsx +0 -1
  63. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/HighlightRender.tsx +0 -1
  64. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/StatusWork.tsx +0 -1
  65. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDetails/Avatar.tsx +0 -1
  66. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDetails/HighlightRender.tsx +0 -1
  67. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDetails/StatusWork.tsx +0 -1
  68. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPage/GetNextWork.tsx +0 -1
  69. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPicklist/index.tsx +0 -1
  70. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyRadiobuttons/index.tsx +2 -3
  71. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MySearchbox/index.tsx +1 -1
  72. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MySearchbox/repeat-utils.ts +2 -1
  73. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyTextInput/StatusWork.tsx +0 -1
  74. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/Avatar.tsx +0 -1
  75. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/HighlightRender.tsx +0 -1
  76. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/StatusWork.tsx +0 -1
  77. package/tests/functional/localCreateAllListDeleteAll.test.js +4 -0
  78. package/tests/functional/localCreateBuildAllDeleteAll.test.js +4 -0
  79. package/tests/functional/localCreateBuildDelete.test.js +4 -0
  80. package/tests/functional/localCreateListDelete.test.js +11 -6
  81. package/tests/functional/localCreatePublishAllDeleteAll.test.js +4 -0
  82. package/tests/functional/localCreatePublishDelete.test.js +4 -0
  83. package/tests/functional/localCreateRenameDelete.test.js +4 -0
  84. package/tests/functional/localLibCreateLibValidateDeleteLib.test.js +3 -3
  85. package/tests/functional/localPromoteRevertWP.test.js +9 -8
  86. package/.eslintrc.json +0 -18
  87. package/src/tasks/init/template/.eslintrc.json +0 -240
@@ -0,0 +1,227 @@
1
+ import { defineConfig, globalIgnores } from 'eslint/config';
2
+ import path from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ import js from '@eslint/js';
5
+ import { FlatCompat } from '@eslint/eslintrc';
6
+ import tseslint from 'typescript-eslint';
7
+ import sonarjs from 'eslint-plugin-sonarjs';
8
+ import importPlugin from 'eslint-plugin-import';
9
+ import react from 'eslint-plugin-react';
10
+ import reactHooks from 'eslint-plugin-react-hooks';
11
+
12
+ const __filename = fileURLToPath(import.meta.url);
13
+ const __dirname = path.dirname(__filename);
14
+ const compat = new FlatCompat({
15
+ baseDirectory: __dirname,
16
+ recommendedConfig: js.configs.recommended,
17
+ sonarjs: sonarjs.configs.recommended,
18
+ importPlugin: importPlugin.configs.recommended,
19
+ react: react.configs.recommended,
20
+ reactHooks: reactHooks.configs.recommended,
21
+ allConfig: js.configs.all
22
+ });
23
+
24
+ export default tseslint.config(
25
+ tseslint.configs.recommended,
26
+ globalIgnores([
27
+ '**/node_modules',
28
+ 'packages/*/lib',
29
+ '!**/.storybook',
30
+ '.storybook/public',
31
+ '**/demo.stories.jsx',
32
+ '**/mock.stories.js',
33
+ '**/demo.stories.tsx',
34
+ '**/demo.test.tsx',
35
+ '**/mock.stories.ts',
36
+ '**/*.mdx',
37
+ '**/webpack.config.js',
38
+ 'src/helpers/config_access.js',
39
+ '**/*.html',
40
+ '**/*.css',
41
+ '**/*.json',
42
+ '**/*.md',
43
+ '**/*.svg',
44
+ '**/*.zip',
45
+ '**/*.d.ts',
46
+ '*.storybook/*',
47
+ '**/*.cjs',
48
+ '**/paths.js',
49
+ 'dist/*',
50
+ 'lib/*'
51
+ ]),
52
+ {
53
+ languageOptions: {
54
+ globals: {
55
+ PCore: 'readonly',
56
+ window: true,
57
+ console: true,
58
+ document: true,
59
+ fetch: true
60
+ },
61
+
62
+ ecmaVersion: 13,
63
+ sourceType: 'script',
64
+
65
+ parserOptions: {
66
+ project: 'tsconfig.json'
67
+ }
68
+ },
69
+
70
+ settings: {
71
+ 'import/resolver': {
72
+ typescript: {},
73
+
74
+ node: {
75
+ extensions: ['.js', '.jsx', '.ts', '.tsx']
76
+ }
77
+ },
78
+
79
+ react: {
80
+ version: 'detect'
81
+ }
82
+ },
83
+
84
+ plugins: { sonarjs, import: importPlugin, react, 'react-hooks': reactHooks },
85
+ rules: {
86
+ 'prettier/prettier': 'off',
87
+ 'sonarjs/cognitive-complexity': 'off',
88
+ 'sonarjs/no-identical-functions': 'off',
89
+ 'sonarjs/no-duplicate-string': 'off',
90
+ 'sonarjs/no-nested-template-literals': 'off',
91
+ '@typescript-eslint/array-type': 'off',
92
+ '@typescript-eslint/no-wrapper-object-types': 'off',
93
+ '@typescript-eslint/no-explicit-any': 'off',
94
+ '@typescript-eslint/no-empty-object-type': 'off',
95
+ '@typescript-eslint/ban-ts-comment': 'off',
96
+ '@typescript-eslint/no-unsafe-function-type': 'off',
97
+ '@typescript-eslint/no-inferrable-types': 'off',
98
+ 'import/extensions': ['off', 'never'],
99
+ 'import/named': 'off',
100
+ 'import/no-cycle': 'off',
101
+ 'import/no-duplicates': 'off',
102
+ 'import/no-extraneous-dependencies': 'off',
103
+ 'import/no-named-as-default': 'off',
104
+ 'import/no-named-as-default-member': 'off',
105
+ 'import/no-self-import': 'off',
106
+ 'import/no-unresolved': 'off',
107
+ 'import/no-useless-path-segments': 'off',
108
+ 'import/order': 'off',
109
+ 'no-else-return': 'off',
110
+ 'no-restricted-syntax': 'off',
111
+ 'no-underscore-dangle': 'off',
112
+ 'jsx-a11y/alt-text': 'off',
113
+ 'jsx-a11y/anchor-is-valid': 'off',
114
+ 'jsx-a11y/click-events-have-key-events': 'off',
115
+ 'jsx-a11y/label-has-associated-control': 'off',
116
+ 'jsx-a11y/no-static-element-interactions': 'off',
117
+ 'react/jsx-fragments': 'off',
118
+ 'react/jsx-no-bind': 'off',
119
+ 'react/self-closing-comp': 'off',
120
+ 'sonarjs/prefer-immediate-return': 'off',
121
+ '@typescript-eslint/dot-notation': 'off',
122
+ '@typescript-eslint/naming-convention': 'off',
123
+ '@typescript-eslint/ban-types': 'off',
124
+ eqeqeq: 'off',
125
+ 'no-alert': 'off',
126
+ 'no-console': 'error',
127
+ 'no-fallthrough': 'error',
128
+ 'no-undef': 'error',
129
+ 'no-unused-vars': 'off',
130
+ 'no-var': 'off',
131
+ yoda: 'error',
132
+ 'no-irregular-whitespace': 'off',
133
+ 'no-empty': 'off',
134
+ 'no-new-object': 'off',
135
+ 'import/no-relative-packages': 'off',
136
+ 'import/no-mutable-exports': 'error',
137
+ 'sonarjs/max-switch-cases': 'error',
138
+ 'sonarjs/no-collapsible-if': 'error',
139
+ 'sonarjs/no-all-duplicated-branches': 'error',
140
+ 'sonarjs/no-duplicated-branches': 'error',
141
+ 'sonarjs/no-gratuitous-expressions': 'off',
142
+ 'sonarjs/no-ignored-return': 'error',
143
+ 'sonarjs/no-small-switch': 'error',
144
+ 'sonarjs/prefer-object-literal': 'error',
145
+ 'sonarjs/prefer-single-boolean-return': 'error',
146
+ '@typescript-eslint/no-shadow': 'error',
147
+ 'react/default-props-match-prop-types': 'error',
148
+ 'react/no-unescaped-entities': 'error',
149
+ 'react/no-unused-prop-types': 'error',
150
+ 'react/static-property-placement': 'error',
151
+ 'array-callback-return': 'error',
152
+ camelcase: 'error',
153
+ 'func-names': 'error',
154
+ 'no-case-declarations': 'error',
155
+ 'no-lonely-if': 'error',
156
+ 'no-nested-ternary': 'error',
157
+ 'no-plusplus': 'error',
158
+ 'no-restricted-globals': 'error',
159
+ 'no-restricted-properties': 'error',
160
+ 'no-shadow': 'error',
161
+ radix: 'error',
162
+ 'spaced-comment': 'error',
163
+ 'import/newline-after-import': 'error',
164
+ 'sonarjs/no-nested-switch': 'error',
165
+ '@typescript-eslint/no-array-constructor': 'error',
166
+ '@typescript-eslint/no-unused-vars': 'error',
167
+ '@typescript-eslint/no-useless-constructor': 'error',
168
+ 'react/button-has-type': 'error',
169
+ 'react/jsx-curly-brace-presence': 'error',
170
+ 'react/jsx-boolean-value': 'error',
171
+ 'react/no-array-index-key': 'error',
172
+ 'class-methods-use-this': 'error',
173
+ 'guard-for-in': 'error',
174
+ 'no-unneeded-ternary': 'error',
175
+ 'no-unused-expressions': 'error',
176
+ 'operator-assignment': 'error',
177
+ 'prefer-template': 'error',
178
+ 'vars-on-top': 'error',
179
+ 'prefer-regex-literals': 'off',
180
+ 'no-use-before-define': 'off',
181
+ '@typescript-eslint/no-use-before-define': 'error'
182
+ }
183
+ },
184
+ {
185
+ files: ['**/*.@(ts|tsx)'],
186
+
187
+ rules: {
188
+ '@typescript-eslint/method-signature-style': ['error', 'property'],
189
+ quotes: 'off',
190
+ '@typescript-eslint/quotes': 'off'
191
+ }
192
+ },
193
+ {
194
+ files: ['**/*.@(jsx|tsx|mdx)'],
195
+
196
+ rules: {
197
+ 'react/react-in-jsx-scope': 'off',
198
+ 'react-hooks/rules-of-hooks': 'off',
199
+ 'react-hooks/exhaustive-deps': 'off'
200
+ }
201
+ },
202
+ {
203
+ files: ['**/*.@(ts|tsx)'],
204
+ rules: {
205
+ 'no-undef': 'error',
206
+ 'no-console': 'off',
207
+ 'import/prefer-default-export': 'off',
208
+ 'import/no-relative-packages': 'off',
209
+ 'react/jsx-fragments': 'off',
210
+ 'react/react-in-jsx-scope': 'off',
211
+ 'react-hooks/exhaustive-deps': 'off',
212
+ 'sonarjs/cognitive-complexity': ['warn', 45]
213
+ }
214
+ },
215
+ {
216
+ files: ['**/*.@(js|jsx|ts|tsx|mdx)'],
217
+ rules: {}
218
+ },
219
+
220
+ {
221
+ files: ['*/**/mocks/**.@(mocks|styles).@(tsx|ts)'],
222
+
223
+ rules: {
224
+ 'import/prefer-default-export': ['off']
225
+ }
226
+ }
227
+ );
@@ -107,7 +107,7 @@
107
107
  "@babel/preset-react": "^7.27.1",
108
108
  "@babel/preset-typescript": "^7.27.1",
109
109
  "@pega/configs": "^0.16.3",
110
- "@pega/custom-dx-components": "~0.25.30",
110
+ "@pega/custom-dx-components": "~0.25.32",
111
111
  "@pega/pcore-pconnect-typedefs": "^4.1.0-alpha.1",
112
112
  "@storybook/addon-actions": "^8.6.12",
113
113
  "@storybook/addon-essentials": "^8.6.12",
@@ -132,7 +132,7 @@
132
132
  "@types/styled-components": "^5.1.34",
133
133
  "@typescript-eslint/eslint-plugin": "^5.62.0",
134
134
  "core-js": "^3.42.0",
135
- "eslint": "^8.57.0",
135
+ "eslint": "^9.27.0",
136
136
  "eslint-plugin-import": "^2.31.0",
137
137
  "eslint-plugin-jest": "^28.11.0",
138
138
  "eslint-plugin-jsx-a11y": "^6.10.2",
@@ -155,6 +155,7 @@
155
155
  "stylelint": "^16.19.1",
156
156
  "ts-jest": "^29.3.2",
157
157
  "typescript": "~5.5.4",
158
+ "typescript-eslint": "^8.32.1",
158
159
  "vite": "^6.3.5"
159
160
  }
160
161
  }
@@ -30,9 +30,9 @@
30
30
  "questions_askedOnce": ""
31
31
  },
32
32
  "component": {
33
- "library": "Extensions",
33
+ "library": "YourLibrary",
34
34
  "type": "",
35
- "version": "1.0.0",
35
+ "version": "0.0.1",
36
36
  "subtype": "",
37
37
  "description": "",
38
38
  "icon": ""
@@ -7,7 +7,8 @@
7
7
  "./src/**/*.stories.js",
8
8
  "./src/**/*.stories.jsx",
9
9
  "./src/**/*.test.jsx",
10
- "./src/**/*.test.tsx"
10
+ "./src/**/*.test.tsx",
11
+ "*.config.mjs"
11
12
  ],
12
13
  "compilerOptions": {
13
14
  "noEmit": false,
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "extends": "@pega/tsconfig/index.json",
3
3
  "include": ["./**/*", ".storybook/**/*"],
4
+ "exclude": ["**/*.mjs"],
4
5
  "compilerOptions": {
5
6
  "noEmit": true,
6
7
  "allowJs": true,
@@ -162,7 +162,10 @@ addDebugLog("listPublished", "END", "-");
162
162
 
163
163
 
164
164
  const {app_name, app_version } = await getApplicationAndVersionFromToken();
165
- console.log(chalk.green(`\nList of libraries for Application: ${chalk.bold.green(`${app_name} - ${app_version}`)}\n`));
165
+ const serverConfig = await getPegaServerConfig();
166
+ 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}`)}`);
166
169
 
167
170
 
168
171
  const libAnswers = await inquirer.prompt([
@@ -84,9 +84,6 @@ addDebugLog("copyWebPack","", "");
84
84
  }
85
85
 
86
86
 
87
-
88
-
89
-
90
87
  }
91
88
 
92
89
 
@@ -119,6 +119,8 @@ addDebugLog("publish", "", "+");
119
119
  // };
120
120
  options.params.push(answers.rulesetName);
121
121
  options.params.push(answers.rulesetVersion);
122
+
123
+ updateServerConfigRuleSetAndVersion(answers.rulesetName, answers.rulesetVersion);
122
124
  }
123
125
  }
124
126
 
@@ -158,6 +158,7 @@ export default async (orgLibName, selectedVersion) => {
158
158
 
159
159
  const archiveFileName = `${orgLibName}_${selectedVersion}.arch.zip`;
160
160
  const archiveDirectory = join (mainDirectory, ARCHIVES_PATH, `${orgLibName}`, `${selectedVersion}`);
161
+ const defaultPegaConfig = await getPegaServerConfig();
161
162
  if (fs.existsSync(archiveDirectory)) {
162
163
  const archiveFile = join(archiveDirectory, archiveFileName);
163
164
 
@@ -170,7 +171,7 @@ export default async (orgLibName, selectedVersion) => {
170
171
  let spinner;
171
172
  try {
172
173
  console.log("");
173
- spinner = ora('Exporting to server...\n').start();
174
+ spinner = ora(`Exporting to server ${defaultPegaConfig.server}. \n`).start();
174
175
  publishComponentLibraryArchiveToServer(content, zipContent, true )
175
176
  .then( () => {
176
177
  spinner.stop();
@@ -51,6 +51,10 @@ export const showHelpV1 = () => {
51
51
  console.log(`${chalk.cyan('npm run publishAll ')}\tpublish ALL components to server`);
52
52
 
53
53
  console.log("");
54
+ console.log(`\n${chalk.underline(`Notes`)}`);
55
+ console.log(`Cannot publish a component with prefix (Org_Lib) that matches a Rule-UI-ComponentLibrary (libraryModeCL) in same ruleset.`);
56
+
57
+ console.log("");
54
58
 
55
59
  };
56
60
 
@@ -77,8 +81,8 @@ export const showHelpV2 = (isCL) => {
77
81
  console.log(`\n${chalk.underline(`Library Versions`)}`);
78
82
  console.log(`${chalk.cyan('npm run createLibVersion')}\tcreate a new version within the current library`);
79
83
  console.log(`${chalk.cyan('npm run switchLibVersion')}\tswitch to different version within the current library`);
80
- console.log(`${chalk.cyan('npm run deleteLibVersion')}\tdelete current version, move to another version`);
81
- console.log(`${chalk.cyan('npm run restoreLibVersion ')}\trestore current version from local storage (current changes will be LOST)`);
84
+ console.log(`${chalk.cyan('npm run deleteLibVersion')}\tdelete current version, move to another version, delete is permanent`);
85
+ console.log(`${chalk.cyan('npm run restoreLibVersion ')}\trestores to current version from local storage (current changes will be LOST)`);
82
86
  console.log(`${chalk.cyan('npm run storeLibVersion ')}\tstore current version to local storage (must SAVE components before)`);
83
87
  if (isCL) {
84
88
  console.log(`${chalk.cyan('npm run exportLibVersion')}\texport current version as a zip file to a given local path or a server (must SAVE components before)`);
@@ -107,7 +111,10 @@ export const showHelpV2 = (isCL) => {
107
111
  console.log(`${chalk.cyan('npm run list ')}\t\tget list of components`);
108
112
  console.log(`${chalk.cyan('npm run delete ')}\t\tdelete a component`);
109
113
  console.log(`${chalk.cyan('npm run deleteAll ')}\t\tdelete ALL components`);
114
+
115
+ console.log("");
110
116
  console.log(`${chalk.cyan('npm run startStorybook')}\t\tstorybook components for testing`);
117
+ console.log(`${chalk.cyan('npm run test')}\t\t\trun component unit tests`);
111
118
  console.log("");
112
119
 
113
120
  console.log(`\n${chalk.underline(`Notes`)}`);
@@ -13,6 +13,7 @@ export const showCurrentStatus = async () => {
13
13
 
14
14
  const configDefaults = getConfigDefaults();
15
15
  const componentList = await getComponents();
16
+ const isLibraryBased = getLibraryBased();
16
17
  const isLibraryBasedCL = getLibraryBasedCL();
17
18
  const pegaServer = await getPegaServerConfig();
18
19
 
@@ -35,8 +36,13 @@ export const showCurrentStatus = async () => {
35
36
 
36
37
  console.log("");
37
38
 
38
- if (isLibraryBasedCL) {
39
+ if (isLibraryBased && !isLibraryBasedCL ) {
40
+ // no publishing for just libraryBased, that goes to App Static
41
+ }
42
+ else {
39
43
 
44
+ console.log(`\tPublish to:\t ${chalk.bold.green(`${pegaServer.server}`)} `);
45
+ // console.log("\t---------------------");
40
46
  console.log(`\tRuleSet:\t ${chalk.bold.green(`${pegaServer.rulesetName}`)}`);
41
47
  console.log(`\tRuleSet Version: ${chalk.bold.green(`${pegaServer.rulesetVersion}`)}`);
42
48
  console.log("");
@@ -12,6 +12,7 @@ import {
12
12
  getComponentDirectoryPath,
13
13
  getComponents,
14
14
  getOOTBComponents,
15
+ isComponentValidLength,
15
16
  addDebugLog } from '../../util.js';
16
17
 
17
18
  const ajv = new Ajv({ allErrors: true });
@@ -340,6 +341,10 @@ export default async (option) => {
340
341
  throwTheError = true;
341
342
  }
342
343
 
344
+ if (!isComponentValidLength(componentToValidate)) {
345
+ throw new Error(`Invalid: componentName is too long.`);
346
+ }
347
+
343
348
  const componentDirectory = await getComponentDirectoryPath(componentToValidate);
344
349
  let configFileName = "config.json";
345
350
 
package/src/util.js CHANGED
@@ -44,7 +44,8 @@ import {
44
44
  TEMP_PATH,
45
45
  JEST_TESTS_FUNCTIONAL_PATH,
46
46
  IMPORT_RELATIVE_PATH,
47
- EXPORT_RELATIVE_PATH
47
+ EXPORT_RELATIVE_PATH,
48
+ MAX_RFT_CHARS
48
49
  } from './constants.js';
49
50
 
50
51
 
@@ -2500,7 +2501,7 @@ if (showDebug) addDebugLog("restoreFromArchive", `fileName: ${fileName}, orgLibN
2500
2501
 
2501
2502
 
2502
2503
  // remove temp (windows not working well with "sync", can be async, since as long as deleted, fine)
2503
- fs.rm(tempDirectory, { recursive: true, force: true, maxRetries: 5 }, () => {});
2504
+ fs.rmSync(tempDirectory, { recursive: true, force: true, maxRetries: 5 }, () => {});
2504
2505
 
2505
2506
  };
2506
2507
 
@@ -2712,6 +2713,33 @@ export const getSubTypeLabel = (type, subtype) => {
2712
2713
  return "";
2713
2714
  }
2714
2715
 
2716
+ export const getMaxComponentNameCount = () => {
2717
+ let count = MAX_RFT_CHARS - 1; // one less than max
2718
+ const configDef = getConfigDefaults();
2719
+ const orgLibCount = configDef.currentOrgLib.length + 1;
2720
+ const versionCount = configDef.version.length - 2;
2721
+ const prefixCount = versionCount + 4;
2722
+
2723
+ count = count - orgLibCount - prefixCount - 9; // 9 chars for trailing hash
2724
+
2725
+ return count;
2726
+
2727
+ }
2728
+
2729
+ export const getMaxPrefixCount = () => {
2730
+ // TwoColumnDetails is 16 chars
2731
+ return (getMaxComponentNameCount() - 16);
2732
+ }
2733
+
2734
+ export const isComponentValidLength = (componentKey) => {
2735
+ const configDef = getConfigDefaults();
2736
+ const componentName = componentKey.replace(configDef.currentOrgLib + "_", "");
2737
+ if (componentName.length <= getMaxComponentNameCount()) {
2738
+ return true;
2739
+ }
2740
+
2741
+ return false;
2742
+ }
2715
2743
 
2716
2744
  // init
2717
2745
  await forceDefaultsUpdate();
@@ -1,4 +1,3 @@
1
- /* eslint-disable react-hooks/rules-of-hooks */
2
1
  import React from 'react';
3
2
  import { useEffect, useState } from 'react';
4
3
  import { Avatar as CosmosAvatar, withConfiguration } from '@pega/cosmos-react-core';
@@ -1,4 +1,3 @@
1
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2
1
  import React from 'react';
3
2
  import { FieldValueList, Text } from '@pega/cosmos-react-core';
4
3
  import type { PConnProps } from '../shared/PConnProps';
@@ -1,4 +1,3 @@
1
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2
1
  import React from 'react';
3
2
  import { Status } from '@pega/cosmos-react-core';
4
3
 
@@ -1,4 +1,3 @@
1
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2
1
  import React from 'react';
3
2
  import { Button, useToaster } from '@pega/cosmos-react-core';
4
3
 
@@ -1,4 +1,3 @@
1
- /* eslint-disable react-hooks/rules-of-hooks */
2
1
  import React from 'react';
3
2
  import { useEffect, useState } from 'react';
4
3
  import { Avatar as CosmosAvatar, withConfiguration } from '@pega/cosmos-react-core';
@@ -1,4 +1,3 @@
1
- /* eslint-disable react-hooks/exhaustive-deps */
2
1
  import { useState, useEffect, useRef, type Key } from 'react';
3
2
  import { Select, Option, FieldValueList, Text, withConfiguration } from '@pega/cosmos-react-core';
4
3
 
@@ -77,7 +77,6 @@ function PegaDxilMyRadiobuttons(props: PegaDxilMyRadiobuttonsProps) {
77
77
  const propName: string = stateProps.value;
78
78
  const configProps = pConn.getConfigProps();
79
79
  const className = pConn.getCaseInfo().getClassName();
80
- const { getLocaleRuleNameFromKeys, getLocalizedValue } = pConn;
81
80
 
82
81
  // @ts-ignore
83
82
  let configProperty = pConn.getRawMetadata()?.config?.value || '';
@@ -139,10 +138,10 @@ function PegaDxilMyRadiobuttons(props: PegaDxilMyRadiobuttonsProps) {
139
138
  id={`${fullReference}.${item.key}`}
140
139
  value={item.key}
141
140
  key={`${fullReference}.${item.key}`}
142
- label={getLocalizedValue(
141
+ label={pConn.getLocalizedValue(
143
142
  isDatapage ? item.text : item.value,
144
143
  localePath,
145
- getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)
144
+ pConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)
146
145
  )}
147
146
  name={fullReference}
148
147
  />
@@ -1,4 +1,3 @@
1
- /* eslint-disable react-hooks/exhaustive-deps */
2
1
  /* eslint-disable sonarjs/cognitive-complexity */
3
2
  import { useEffect, useRef, useState, useMemo, type MutableRefObject, type SetStateAction } from 'react';
4
3
  import { ComboBox, menuHelpers, debounce, throttle, Button, Icon, withConfiguration, type MenuGroupProps, type MenuItemProps } from '@pega/cosmos-react-core';
@@ -414,6 +413,7 @@ function PegaDxilMySearchbox(props: PegaDxilMySearchboxProps) {
414
413
  const { isSearchableOnKey } = props;
415
414
 
416
415
  const [items, setItems] = useState(() => []);
416
+ // eslint-disable-next-line prefer-const
417
417
  let selectItem: ((id: string, ev?: any) => void) | ((arg0: never) => void);
418
418
 
419
419
  // convert associated to datapage listtype and transform props
@@ -1,4 +1,5 @@
1
1
  /* eslint-disable sonarjs/no-collapsible-if */
2
+ /* eslint-disable sonarjs/cognitive-complexity */
2
3
  /* eslint-disable func-names */
3
4
  // @ts-nocheck
4
5
  import { splitConditionTree } from '@pega/cosmos-react-condition-builder';
@@ -267,7 +268,7 @@ export function getDescriptorsFieldName(property, pageClass) {
267
268
  return property;
268
269
  }
269
270
 
270
- // eslint-disable-next-line @typescript-eslint/default-param-last, sonarjs/cognitive-complexity
271
+ // eslint-disable-next-line, sonarjs/cognitive-complexity
271
272
  export function preparePatchQueryFields(fields, isDataObject = false, classID = '', getPConnect) {
272
273
  const queryFields = [];
273
274
  // Descriptors can be configured only for single selectionMode properties
@@ -1,4 +1,3 @@
1
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2
1
  import React from 'react';
3
2
  import { Status } from '@pega/cosmos-react-core';
4
3
 
@@ -1,4 +1,3 @@
1
- /* eslint-disable react-hooks/rules-of-hooks */
2
1
  import React from 'react';
3
2
  import { useEffect, useState } from 'react';
4
3
  import { Avatar as CosmosAvatar, withConfiguration } from '@pega/cosmos-react-core';
@@ -1,4 +1,3 @@
1
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2
1
  import React from 'react';
3
2
  import { FieldValueList, Text } from '@pega/cosmos-react-core';
4
3
  import type { PConnProps } from '../shared/PConnProps';
@@ -1,4 +1,3 @@
1
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2
1
  import React from 'react';
3
2
  import { Status } from '@pega/cosmos-react-core';
4
3
 
@@ -1,4 +1,3 @@
1
- /* eslint-disable react-hooks/rules-of-hooks */
2
1
  import React from 'react';
3
2
  import { useEffect, useState } from 'react';
4
3
  import { Avatar as CosmosAvatar, withConfiguration } from '@pega/cosmos-react-core';
@@ -1,4 +1,3 @@
1
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2
1
  import React from 'react';
3
2
  import { FieldValueList, Text } from '@pega/cosmos-react-core';
4
3
  import type { PConnProps } from './PConnProps';
@@ -1,4 +1,3 @@
1
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2
1
  import React from 'react';
3
2
  import { Status } from '@pega/cosmos-react-core';
4
3
 
@@ -1,4 +1,3 @@
1
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2
1
  import React from 'react';
3
2
  import { Button, useToaster } from '@pega/cosmos-react-core';
4
3
 
@@ -1,4 +1,3 @@
1
- /* eslint-disable react-hooks/rules-of-hooks */
2
1
  import React from 'react';
3
2
  import { useEffect, useState } from 'react';
4
3
  import { Avatar as CosmosAvatar, withConfiguration } from '@pega/cosmos-react-core';
@@ -1,4 +1,3 @@
1
- /* eslint-disable react-hooks/exhaustive-deps */
2
1
  import { useState, useEffect, useRef, type Key } from 'react';
3
2
  import { Select, Option, FieldValueList, Text, withConfiguration } from '@pega/cosmos-react-core';
4
3
 
@@ -77,7 +77,6 @@ function PegaDxilMyRadiobuttons(props: PegaDxilMyRadiobuttonsProps) {
77
77
  const propName: string = stateProps.value;
78
78
  const configProps = pConn.getConfigProps();
79
79
  const className = pConn.getCaseInfo().getClassName();
80
- const { getLocaleRuleNameFromKeys, getLocalizedValue } = pConn;
81
80
 
82
81
  // @ts-ignore
83
82
  let configProperty = pConn.getRawMetadata()?.config?.value || '';
@@ -139,10 +138,10 @@ function PegaDxilMyRadiobuttons(props: PegaDxilMyRadiobuttonsProps) {
139
138
  id={`${fullReference}.${item.key}`}
140
139
  value={item.key}
141
140
  key={`${fullReference}.${item.key}`}
142
- label={getLocalizedValue(
141
+ label={pConn.getLocalizedValue(
143
142
  isDatapage ? item.text : item.value,
144
143
  localePath,
145
- getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)
144
+ pConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)
146
145
  )}
147
146
  name={fullReference}
148
147
  />
@@ -1,4 +1,3 @@
1
- /* eslint-disable react-hooks/exhaustive-deps */
2
1
  /* eslint-disable sonarjs/cognitive-complexity */
3
2
  import { useEffect, useRef, useState, useMemo, type MutableRefObject, type SetStateAction } from 'react';
4
3
  import { ComboBox, menuHelpers, debounce, throttle, Button, Icon, withConfiguration, type MenuGroupProps, type MenuItemProps } from '@pega/cosmos-react-core';
@@ -414,6 +413,7 @@ function PegaDxilMySearchbox(props: PegaDxilMySearchboxProps) {
414
413
  const { isSearchableOnKey } = props;
415
414
 
416
415
  const [items, setItems] = useState(() => []);
416
+ // eslint-disable-next-line prefer-const
417
417
  let selectItem: ((id: string, ev?: any) => void) | ((arg0: never) => void);
418
418
 
419
419
  // convert associated to datapage listtype and transform props