@pega/custom-dx-components 0.25.5 → 0.25.6

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 (28) hide show
  1. package/package.json +24 -23
  2. package/src/tasks/create/templates/Constellation/Field/Date/demo.stories.tsx.mustache +2 -2
  3. package/src/tasks/create/templates/Constellation/Field/DateTime/demo.stories.tsx.mustache +2 -2
  4. package/src/tasks/create/templates/Constellation/Field/Icon-Button-URL/demo.stories.tsx.mustache +2 -4
  5. package/src/tasks/create/templates/Constellation/Field/Text-Phone/demo.test.tsx.mustache +1 -1
  6. package/src/tasks/create/templates/Constellation/Field/TimeofDay/demo.test.tsx.mustache +1 -1
  7. package/src/tasks/create/templates/Constellation/Template/DETAILS/demo.stories.tsx.mustache +4 -6
  8. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/demo.stories.tsx.mustache +3 -6
  9. package/src/tasks/create/templates/Constellation/Template/PAGE/demo.stories.tsx.mustache +2 -4
  10. package/src/tasks/create/templates/Constellation/Widget/CASE/demo.stories.tsx.mustache +4 -8
  11. package/src/tasks/create/templates/Constellation/Widget/CASE/demo.test.tsx.mustache +1 -1
  12. package/src/tasks/create/templates/Constellation/Widget/PAGE/demo.stories.tsx.mustache +2 -4
  13. package/src/tasks/create/templates/Constellation/Widget/PAGE/demo.test.tsx.mustache +1 -1
  14. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/demo.stories.tsx.mustache +3 -6
  15. package/src/tasks/create/templates/Launchpad/Field/Icon-Button-URL/demo.stories.tsx.mustache +2 -4
  16. package/src/tasks/create/templates/Launchpad/Widget/CASE/demo.stories.tsx.mustache +4 -8
  17. package/src/tasks/create/templates/Launchpad/Widget/CASE/demo.test.tsx.mustache +1 -1
  18. package/src/tasks/create/templates/Launchpad/Widget/PAGE/demo.stories.tsx.mustache +2 -4
  19. package/src/tasks/create/templates/Launchpad/Widget/PAGE/demo.test.tsx.mustache +1 -1
  20. package/src/tasks/create/templates/Launchpad/Widget/PAGE-CASE/demo.stories.tsx.mustache +3 -6
  21. package/src/tasks/create/templates/Launchpad/Widget/PAGE-CASE/demo.test.tsx.mustache +1 -1
  22. package/src/tasks/export-archive/helper.js +26 -2
  23. package/src/tasks/export-archive/index.js +6 -0
  24. package/src/tasks/import-archive/helper.js +30 -1
  25. package/src/tasks/import-archive/index.js +59 -8
  26. package/src/tasks/import-comp/helper.js +26 -1
  27. package/src/tasks/import-comp/index.js +4 -0
  28. package/src/tasks/init/template/package.json.mustache +17 -16
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/custom-dx-components",
3
- "version": "0.25.5",
3
+ "version": "0.25.6",
4
4
  "description": "Utility for building custom UI components",
5
5
  "bin": "./bin/index.js",
6
6
  "scripts": {
@@ -15,17 +15,18 @@
15
15
  "type": "module",
16
16
  "sideEffects": false,
17
17
  "dependencies": {
18
- "@babel/core": "^7.23.7",
19
- "@babel/plugin-transform-class-properties": "^7.23.3",
20
- "@babel/preset-react": "^7.23.3",
21
- "@pega/auth": "^0.2.19",
18
+ "@babel/core": "^7.26.0",
19
+ "@babel/plugin-transform-class-properties": "^7.25.9",
20
+ "@babel/preset-react": "^7.26.3",
21
+ "@pega/auth": "^0.2.23",
22
22
  "@pega/constellation-dx-components-build-utils": "^1.0.1",
23
- "ajv": "^8.12.0",
23
+ "@pega/inquirer-fuzzy-path": "^3.0.0",
24
+ "ajv": "^8.17.1",
24
25
  "ajv-keywords": "^5.1.0",
25
26
  "archiver": "^7.0.1",
26
27
  "arg": "^5.0.2",
27
- "babel-loader": "^9.1.3",
28
- "chalk": "^5.3.0",
28
+ "babel-loader": "^9.2.1",
29
+ "chalk": "^5.4.1",
29
30
  "check-git": "^2.0.2",
30
31
  "compression-webpack-plugin": "^10.0.0",
31
32
  "css-loader": "6.8.1",
@@ -33,28 +34,28 @@
33
34
  "eslint": "^8.56.0",
34
35
  "execa": "^8.0.1",
35
36
  "file-loader": "6.2.0",
36
- "fs-extra": "^11.2.0",
37
+ "fs-extra": "^11.3.0",
37
38
  "gitignore": "^0.7.0",
38
- "inquirer": "^9.2.12",
39
+ "inquirer": "^9.3.7",
39
40
  "jwt-decode": "^4.0.0",
40
- "listr2": "^8.0.1",
41
+ "listr2": "^8.2.5",
41
42
  "mini-css-extract-plugin": "2.7.6",
42
43
  "mustache": "^4.2.0",
43
44
  "ncp": "^2.0.0",
44
45
  "node-fetch": "^3.3.2",
45
- "ora": "^8.0.1",
46
+ "ora": "^8.1.1",
46
47
  "pascalcase": "^2.0.0",
47
- "postcss": "^8.4.33",
48
+ "postcss": "^8.5.1",
48
49
  "postcss-loader": "7.3.4",
49
50
  "postcss-preset-env": "9.3.0",
50
51
  "prop-types": "^15.8.1",
51
52
  "react": "^18.2.0",
52
53
  "react-dev-utils": "^12.0.1",
53
- "resolve": "1.22.8",
54
+ "resolve": "1.22.10",
54
55
  "resolve-url-loader": "^5.0.0",
55
56
  "sass-loader": "^13.3.3",
56
- "terser-webpack-plugin": "5.3.10",
57
- "ts-loader": "^9.5.1",
57
+ "terser-webpack-plugin": "5.3.11",
58
+ "ts-loader": "^9.5.2",
58
59
  "typescript": "~5.3.3",
59
60
  "unarchive": "^1.1.3",
60
61
  "url-loader": "4.1.1",
@@ -68,16 +69,16 @@
68
69
  "custom-components"
69
70
  ],
70
71
  "devDependencies": {
71
- "@babel/preset-env": "^7.23.7",
72
- "@pega/configs": "^0.7.1",
73
- "@pega/prettier-config": "^0.7.1",
74
- "@types/jest": "^29.5.11",
72
+ "@babel/preset-env": "^7.26.0",
73
+ "@pega/configs": "^0.16.2",
74
+ "@pega/prettier-config": "^0.16.2",
75
+ "@types/jest": "^29.5.14",
75
76
  "babel-jest": "^29.7.0",
76
- "cspell": "^8.3.2",
77
+ "cspell": "^8.17.2",
77
78
  "jest": "^29.7.0",
78
79
  "jest-environment-jsdom": "^29.7.0",
79
80
  "jest-junit": "^16.0.0",
80
- "prettier": "3.1.1",
81
- "ts-jest": "^29.1.1"
81
+ "prettier": "3.3.3",
82
+ "ts-jest": "^29.2.5"
82
83
  }
83
84
  }
@@ -15,7 +15,7 @@ export default meta;
15
15
  type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
16
16
 
17
17
  if (!window.PCore) {
18
- window.PCore = {};
18
+ window.PCore = {} as any;
19
19
  }
20
20
 
21
21
  window.PCore.getEnvironmentInfo = () => {
@@ -26,7 +26,7 @@ window.PCore.getEnvironmentInfo = () => {
26
26
  getLocale: () => {
27
27
  return 'en-GB';
28
28
  }
29
- };
29
+ } as any;
30
30
  };
31
31
 
32
32
  export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
@@ -15,7 +15,7 @@ type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
15
15
 
16
16
 
17
17
  if (!window.PCore) {
18
- window.PCore = {};
18
+ window.PCore = {} as any;
19
19
  }
20
20
 
21
21
  window.PCore.getEnvironmentInfo = () => {
@@ -26,7 +26,7 @@ window.PCore.getEnvironmentInfo = () => {
26
26
  getLocale: () => {
27
27
  return 'en-GB';
28
28
  }
29
- };
29
+ } as any;
30
30
  };
31
31
 
32
32
  export const Base{{COMPONENT_CLASS_NAME}}: Story = (args: any) => {
@@ -15,8 +15,7 @@ export default meta;
15
15
  type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
16
16
 
17
17
  if (!window.PCore) {
18
- // @ts-ignore
19
- window.PCore = {};
18
+ window.PCore = {} as any;
20
19
  }
21
20
 
22
21
  const statelistData = {
@@ -38,7 +37,6 @@ const statelistData = {
38
37
 
39
38
  export const Base{{COMPONENT_CLASS_NAME}}: Story = (args: any) => {
40
39
 
41
- // @ts-ignore
42
40
  window.PCore.getDataPageUtils = () => {
43
41
  return {
44
42
  getData: () => {
@@ -51,7 +49,7 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = (args: any) => {
51
49
  resolve(statelistData);
52
50
  });
53
51
  }
54
- };
52
+ } as any;
55
53
  };
56
54
 
57
55
  const props = {
@@ -13,7 +13,7 @@ test('renders {{COMPONENT_CLASS_NAME}}', async () => {
13
13
  expect(await screen.findByText('Phone Helper Text')).toBeVisible();
14
14
 
15
15
 
16
- const phoneElement = (await screen.getByTestId('phone-12345678') as HTMLInputElement);
16
+ const phoneElement = (screen.getByTestId('phone-12345678') as HTMLInputElement);
17
17
  expect(phoneElement.value).toBe('');
18
18
 
19
19
  expect(phoneElement).toHaveAttribute('placeholder', 'Phone Placeholder');
@@ -1,5 +1,5 @@
1
1
  // import { expect, test } from '@jest/globals';
2
- import { render, screen, fireEvent } from '@testing-library/react';
2
+ import { render, screen } from '@testing-library/react';
3
3
  import { composeStories } from '@storybook/react';
4
4
  import '@testing-library/jest-dom';
5
5
 
@@ -21,20 +21,18 @@ export default meta;
21
21
  type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
22
22
 
23
23
  if (!window.PCore) {
24
- // @ts-ignore
25
- window.PCore = {};
24
+ window.PCore = {} as any;
26
25
  }
27
26
 
28
- // @ts-ignore
27
+
29
28
  window.PCore.getLocaleUtils = () => {
30
29
  return {
31
30
  getLocaleValue: (value: any) => {
32
31
  return value;
33
32
  }
34
- };
33
+ } as any;
35
34
  };
36
35
 
37
- // @ts-ignore
38
36
  window.PCore.getUserApi = () => {
39
37
  return {
40
38
  getOperatorDetails: () => {
@@ -42,7 +40,7 @@ window.PCore.getUserApi = () => {
42
40
  resolve(operatorDetails);
43
41
  });
44
42
  }
45
- };
43
+ } as any;
46
44
  };
47
45
 
48
46
  const Region = (props: any) => {
@@ -20,20 +20,17 @@ export default meta;
20
20
  type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
21
21
 
22
22
  if (!window.PCore) {
23
- // @ts-ignore
24
- window.PCore = {};
23
+ window.PCore = {} as any;
25
24
  }
26
25
 
27
- // @ts-ignore
28
26
  window.PCore.getLocaleUtils = () => {
29
27
  return {
30
28
  getLocaleValue: (value: any) => {
31
29
  return value;
32
30
  }
33
- };
31
+ } as any;
34
32
  };
35
33
 
36
- // @ts-ignore
37
34
  window.PCore.getUserApi = () => {
38
35
  return {
39
36
  getOperatorDetails: () => {
@@ -41,7 +38,7 @@ window.PCore.getUserApi = () => {
41
38
  resolve(operatorDetails);
42
39
  });
43
40
  }
44
- };
41
+ } as any;
45
42
  };
46
43
 
47
44
  const Region = (props: any) => {
@@ -20,17 +20,15 @@ type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
20
20
 
21
21
  export const Base{{COMPONENT_CLASS_NAME}}: Story = (args: any) => {
22
22
  if (!window.PCore) {
23
- // @ts-ignore
24
- window.PCore = {};
23
+ window.PCore = {} as any;
25
24
  }
26
25
 
27
- // @ts-ignore
28
26
  window.PCore.getLocaleUtils = () => {
29
27
  return {
30
28
  getLocaleValue: (val: any) => {
31
29
  return val;
32
30
  }
33
- };
31
+ } as any;
34
32
  };
35
33
 
36
34
  const configProps = pyHome1Resolved.children[0].children[0].config;
@@ -15,31 +15,27 @@ export default meta;
15
15
  type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
16
16
 
17
17
  if (!window.PCore) {
18
- // @ts-ignore
19
- window.PCore = {};
18
+ window.PCore = {} as any;
20
19
  }
21
20
 
22
21
  export const Base{{COMPONENT_CLASS_NAME}}: Story = (args: any) => {
23
22
 
24
- // @ts-ignore
25
23
  window.PCore.getConstants = () => {
26
24
  return {
27
25
  CASE_INFO: {
28
26
  CASE_INFO_ID: 'caseInfo.ID'
29
27
  }
30
- };
28
+ } as any;
31
29
  };
32
30
 
33
- // @ts-ignore
34
31
  window.PCore.getLocaleUtils = () => {
35
32
  return {
36
33
  getLocaleValue: (value: any) => {
37
34
  return value;
38
35
  }
39
- };
36
+ } as any;
40
37
  };
41
38
 
42
- // @ts-ignore
43
39
  window.PCore.getDataApiUtils = () => {
44
40
  return {
45
41
  getData: () => {
@@ -48,7 +44,7 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = (args: any) => {
48
44
  resolve(historyData);
49
45
  });
50
46
  }
51
- };
47
+ } as any;
52
48
  };
53
49
 
54
50
  const props = {
@@ -1,5 +1,5 @@
1
1
  // import { expect, test } from '@jest/globals';
2
- import { fireEvent, render, screen } from '@testing-library/react';
2
+ import { render, screen } from '@testing-library/react';
3
3
  import { composeStories } from '@storybook/react';
4
4
  import '@testing-library/jest-dom';
5
5
 
@@ -17,8 +17,7 @@ export default meta;
17
17
  type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
18
18
 
19
19
  if (!window.PCore) {
20
- // @ts-ignore
21
- window.PCore = {};
20
+ window.PCore = {} as any;
22
21
  }
23
22
 
24
23
  const worklistData = {
@@ -48,7 +47,6 @@ const worklistData = {
48
47
 
49
48
  export const Base{{COMPONENT_CLASS_NAME}}: Story = (args: any) => {
50
49
 
51
- // @ts-ignore
52
50
  window.PCore.getDataApiUtils = () => {
53
51
  return {
54
52
  getData: () => {
@@ -63,7 +61,7 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = (args: any) => {
63
61
  resolve(worklistData);
64
62
  });
65
63
  }
66
- };
64
+ } as any;
67
65
  };
68
66
 
69
67
  const props = {
@@ -1,5 +1,5 @@
1
1
  // import { expect, test } from '@jest/globals';
2
- import { fireEvent, render, screen } from '@testing-library/react';
2
+ import { render, screen } from '@testing-library/react';
3
3
  import { composeStories } from '@storybook/react';
4
4
  import '@testing-library/jest-dom';
5
5
 
@@ -15,20 +15,17 @@ export default meta;
15
15
  type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
16
16
 
17
17
  if (!window.PCore) {
18
- // @ts-ignore
19
- window.PCore = {};
18
+ window.PCore = {} as any;
20
19
  }
21
20
 
22
- // @ts-ignore
23
21
  window.PCore.getLocaleUtils = () => {
24
22
  return {
25
23
  getLocaleValue: (value: any) => {
26
24
  return value;
27
25
  }
28
- };
26
+ } as any;
29
27
  };
30
28
 
31
- // @ts-ignore
32
29
  window.PCore.getUserApi = () => {
33
30
  return {
34
31
  getOperatorDetails: () => {
@@ -37,7 +34,7 @@ window.PCore.getUserApi = () => {
37
34
  resolve(operatorDetails);
38
35
  });
39
36
  }
40
- };
37
+ } as any;
41
38
  };
42
39
 
43
40
  export const Base{{COMPONENT_CLASS_NAME}}: Story = (args: any) => {
@@ -16,8 +16,7 @@ type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
16
16
 
17
17
 
18
18
  if (!window.PCore) {
19
- // @ts-ignore
20
- window.PCore = {};
19
+ window.PCore = {} as any;
21
20
  }
22
21
 
23
22
  const countrylistData = {
@@ -37,7 +36,6 @@ const countrylistData = {
37
36
  ]
38
37
  };
39
38
 
40
- // @ts-ignore
41
39
  window.PCore.getDataPageUtils = () => {
42
40
  return {
43
41
  getData: () => {
@@ -50,7 +48,7 @@ window.PCore.getDataPageUtils = () => {
50
48
  resolve(countrylistData);
51
49
  });
52
50
  }
53
- };
51
+ } as any;
54
52
  };
55
53
 
56
54
  export const Base{{COMPONENT_CLASS_NAME}}: Story = (args: any) => {
@@ -15,29 +15,25 @@ export default meta;
15
15
  type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
16
16
 
17
17
  if (!window.PCore) {
18
- // @ts-ignore
19
- window.PCore = {};
18
+ window.PCore = {} as any;
20
19
  }
21
20
 
22
- // @ts-ignore
23
21
  window.PCore.getConstants = () => {
24
22
  return {
25
23
  CASE_INFO: {
26
24
  CASE_INFO_ID: 'caseInfo.ID'
27
25
  }
28
- };
26
+ } as any;
29
27
  };
30
28
 
31
- // @ts-ignore
32
29
  window.PCore.getLocaleUtils = () => {
33
30
  return {
34
31
  getLocaleValue: (value: any) => {
35
32
  return value;
36
33
  }
37
- };
34
+ } as any;
38
35
  };
39
36
 
40
- // @ts-ignore
41
37
  window.PCore.getDataApiUtils = () => {
42
38
  return {
43
39
  getData: () => {
@@ -46,7 +42,7 @@ window.PCore.getDataApiUtils = () => {
46
42
  resolve(historyData);
47
43
  });
48
44
  }
49
- };
45
+ } as any;
50
46
  };
51
47
 
52
48
  export const Base{{COMPONENT_CLASS_NAME}}: Story = (args: any) => {
@@ -1,5 +1,5 @@
1
1
  // import { expect, test } from '@jest/globals';
2
- import { fireEvent, render, screen } from '@testing-library/react';
2
+ import { render, screen } from '@testing-library/react';
3
3
  import { composeStories } from '@storybook/react';
4
4
  import '@testing-library/jest-dom';
5
5
 
@@ -16,8 +16,7 @@ export default meta;
16
16
  type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
17
17
 
18
18
  if (!window.PCore) {
19
- // @ts-ignore
20
- window.PCore = {};
19
+ window.PCore = {} as any;
21
20
  }
22
21
 
23
22
  const worklistData = {
@@ -46,7 +45,6 @@ const worklistData = {
46
45
 
47
46
  };
48
47
 
49
- // @ts-ignore
50
48
  window.PCore.getDataApiUtils = () => {
51
49
  return {
52
50
  getData: () => {
@@ -61,7 +59,7 @@ window.PCore.getDataApiUtils = () => {
61
59
  resolve(worklistData);
62
60
  });
63
61
  }
64
- };
62
+ } as any;
65
63
  };
66
64
 
67
65
 
@@ -1,5 +1,5 @@
1
1
  // import { expect, test } from '@jest/globals';
2
- import { fireEvent, render, screen } from '@testing-library/react';
2
+ import { render, screen } from '@testing-library/react';
3
3
  import { composeStories } from '@storybook/react';
4
4
  import '@testing-library/jest-dom';
5
5
 
@@ -15,20 +15,17 @@ export default meta;
15
15
  type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
16
16
 
17
17
  if (!window.PCore) {
18
- // @ts-ignore
19
- window.PCore = {};
18
+ window.PCore = {} as any;
20
19
  }
21
20
 
22
- // @ts-ignore
23
21
  window.PCore.getLocaleUtils = () => {
24
22
  return {
25
23
  getLocaleValue: (value: any) => {
26
24
  return value;
27
25
  }
28
- };
26
+ } as any;
29
27
  };
30
28
 
31
- // @ts-ignore
32
29
  window.PCore.getUserApi = () => {
33
30
  return {
34
31
  getOperatorDetails: () => {
@@ -37,7 +34,7 @@ window.PCore.getUserApi = () => {
37
34
  resolve(operatorDetails);
38
35
  });
39
36
  }
40
- };
37
+ } as any;
41
38
  };
42
39
 
43
40
  export const Base{{COMPONENT_CLASS_NAME}}: Story = (args: any) => {
@@ -1,5 +1,5 @@
1
1
  // import { expect, test } from '@jest/globals';
2
- import { fireEvent, render, screen } from '@testing-library/react';
2
+ import { render, screen } from '@testing-library/react';
3
3
  import { composeStories } from '@storybook/react';
4
4
  import '@testing-library/jest-dom';
5
5
 
@@ -25,16 +25,40 @@ addDebugLog("getFilePathQuestions", "", "");
25
25
  const currentDirectory = process.cwd();
26
26
  const arPathParts = currentDirectory.split(path.sep);
27
27
  let defaultPath = join(arPathParts[0], arPathParts[1], arPathParts[2], configDef.exportRelativePath);
28
+ let startDirectory = join(arPathParts[0], arPathParts[1], arPathParts[2]);
29
+
28
30
  if (path.sep === "/") {
29
31
  defaultPath = "/".concat(defaultPath);
32
+ startDirectory = "/".concat(startDirectory).concat("/");
30
33
  }
31
34
 
32
-
33
35
  return [
34
36
  {
35
37
  name: 'filePath',
38
+ type: 'fuzzypath',
36
39
  message: 'Enter full file path of directory to export zip file:',
37
- default: defaultPath
40
+ default: defaultPath,
41
+ excludePath: nodePath => nodePath.startsWith('node_modules'),
42
+ // excludePath :: (String) -> Bool
43
+ // excludePath to exclude some paths from the file-system scan
44
+ excludeFilter: nodePath => nodePath.indexOf('/.') >= 0,
45
+ // excludeFilter :: (String) -> Bool
46
+ // excludeFilter to exclude some paths from the final list, e.g. '.'
47
+ itemType: 'directory',
48
+ // itemType :: 'any' | 'directory' | 'file'
49
+ // specify the type of nodes to display
50
+ // default value: 'any'
51
+ // example: itemType: 'file' - hides directories from the item list
52
+ rootPath: startDirectory,
53
+ // rootPath :: String
54
+ // Root search directory
55
+ suggestOnly: false,
56
+ // suggestOnly :: Bool
57
+ // Restrict prompt answer to available choices or use them as suggestions
58
+ depthLimit: 2,
59
+ // depthLimit :: integer >= 0
60
+ // Limit the depth of sub-folders to scan
61
+ // Defaults to infinite depth if undefined
38
62
  }
39
63
  ];
40
64
  };
@@ -22,6 +22,8 @@ import { TASKS_CONFIG_JSON_FILENAME, ARCHIVES_PATH, BIN_ARCHIVES_PATH } from '..
22
22
  import { getFilePathQuestions, getLibraryQuestion, getLibraryVersionQuestion, updateSavedExportFilePath, getFullArchiveQuestions } from './helper.js';
23
23
  import { localBuildLibrary } from '../build-lib/index.js';
24
24
 
25
+ import inquirerFuzzyPath from '@pega/inquirer-fuzzy-path';
26
+
25
27
  export const DXCB_CONFIG_INTERNAL_JSON_FILENAME = 'src/dxcb.config.json';
26
28
  const currentDirectory = process.cwd();
27
29
  const pegaConfigJsonPath = join(currentDirectory, TASKS_CONFIG_JSON_FILENAME);
@@ -340,6 +342,9 @@ export default async options => {
340
342
  // if Binary, then we need to just build the current library, get the results and
341
343
  // and export an archive as zip
342
344
  if (fullArchive === "Binary") {
345
+
346
+ inquirer.registerPrompt('fuzzypath', inquirerFuzzyPath);
347
+
343
348
  filePathQuestions = await getFilePathQuestions();
344
349
  filePathAnswers = await inquirer.prompt(filePathQuestions);
345
350
  ({ filePath } = filePathAnswers);
@@ -365,6 +370,7 @@ export default async options => {
365
370
  ({ selectedVersion } = libraryVersionAnswer);
366
371
  }
367
372
 
373
+ inquirer.registerPrompt('fuzzypath', inquirerFuzzyPath);
368
374
 
369
375
  filePathQuestions = await getFilePathQuestions();
370
376
  filePathAnswers = await inquirer.prompt(filePathQuestions);
@@ -7,6 +7,7 @@ import { addDebugLog, getConfigDefaults, convertIntoPascalCase, getComponents, g
7
7
  import { TASKS_CONFIG_JSON_FILENAME, TEMP_PATH, PACKAGE_JSON_FILENAME } from '../../constants.js';
8
8
 
9
9
 
10
+
10
11
  export const SOURCE_OF_COMPONENT_TYPES = {
11
12
  SERVER: 'Server',
12
13
  LOCAL: 'Local'
@@ -240,21 +241,49 @@ addDebugLog("getFilePathQuestions", "", "");
240
241
  console.log("\tWindows:\tC:\\Users\\name\\...\n");
241
242
  }
242
243
 
244
+ // console.log(chalk.yellow("[Press arrows to search, press <tab> to select, press <enter> to return (after selecting via tab).]"));
245
+ console.log(chalk.yellow("[Manual typing, give search time to find paths]\n"));
246
+
243
247
  const configDef = getConfigDefaults();
244
248
 
245
249
  const currentDirectory = process.cwd();
246
250
  const arPathParts = currentDirectory.split(path.sep);
247
251
  let defaultPath = join(arPathParts[0], arPathParts[1], arPathParts[2], configDef.importRelativePath);
252
+ let startDirectory = join(arPathParts[0], arPathParts[1], arPathParts[2]);
253
+
248
254
  if (path.sep === "/") {
249
255
  defaultPath = "/".concat(defaultPath);
256
+ startDirectory = "/".concat(startDirectory).concat("/");
250
257
  }
251
258
 
252
259
 
253
260
  return [
254
261
  {
255
262
  name: 'filePath',
263
+ type: 'fuzzypath',
256
264
  message: 'Enter full file path of zip file location:',
257
- default: defaultPath
265
+ default: defaultPath,
266
+ excludePath: nodePath => nodePath.startsWith('node_modules'),
267
+ // excludePath :: (String) -> Bool
268
+ // excludePath to exclude some paths from the file-system scan
269
+ excludeFilter: nodePath => nodePath.indexOf('/.') >= 0,
270
+ // excludeFilter :: (String) -> Bool
271
+ // excludeFilter to exclude some paths from the final list, e.g. '.'
272
+ itemType: 'directory',
273
+ // itemType :: 'any' | 'directory' | 'file'
274
+ // specify the type of nodes to display
275
+ // default value: 'any'
276
+ // example: itemType: 'file' - hides directories from the item list
277
+ rootPath: startDirectory,
278
+ // rootPath :: String
279
+ // Root search directory
280
+ suggestOnly: false,
281
+ // suggestOnly :: Bool
282
+ // Restrict prompt answer to available choices or use them as suggestions
283
+ depthLimit: 2,
284
+ // depthLimit :: integer >= 0
285
+ // Limit the depth of sub-folders to scan
286
+ // Defaults to infinite depth if undefined
258
287
  }
259
288
  ];
260
289
  };
@@ -7,6 +7,10 @@ import ncp from 'ncp';
7
7
  import chalk from 'chalk';
8
8
  import { Listr } from 'listr2';
9
9
 
10
+ import StreamZip from 'node-stream-zip';
11
+
12
+ import inquirerFuzzyPath from '@pega/inquirer-fuzzy-path';
13
+
10
14
  import {
11
15
  sanitize,
12
16
  checkPathAccess,
@@ -226,21 +230,51 @@ addDebugLog("importArch", `filePath: ${filePath}, fileName: ${fileName}`, "");
226
230
  const tempDirectory = join(currentDirectory, TEMP_PATH);
227
231
  const zipFilePath = join(filePath, fileName);
228
232
 
229
- await unZipFromArchive(zipFilePath);
230
233
 
231
- // check to see if have a tasks.config.json file, if not, archive not good
234
+ // we are going to use node stream zip to list contents of archive first,
235
+ // before we un archive to a temp directory. If pass, then un archive
236
+ let passCount = 0;
237
+
238
+ // check to see if have a tasks.config.json and package,json file, if not, archive not good
232
239
  const tempTasksConfig = join(tempDirectory, "tasks.config.json");
233
240
  const tempPackage = join(tempDirectory, "package.json");
241
+ const tasksConfig = "tasks.config.json";
242
+ const packageJson = "package.json";
243
+ try {
244
+ const testZip = new StreamZip.async({ file: zipFilePath});
245
+ const entries = await testZip.entries();
234
246
 
235
- if (!fs.existsSync(tempTasksConfig) || !fs.existsSync(tempPackage)) {
247
+ for (const entry of Object.values(entries)) {
248
+ if ( entry.name.indexOf(packageJson) >= 0 || entry.name.indexOf(tasksConfig) >= 0) {
249
+ passCount++;
250
+ }
251
+ }
252
+
253
+ // Do not forget to close the file once you're done
254
+ await testZip.close();
255
+ }
256
+ catch (ex) {
257
+ passCount = 0;
258
+ }
259
+
260
+
261
+ if (passCount < 2) {
236
262
  console.log(chalk.red.bold(`Zip file: ${fileName} not a compatible DX Component archive.`));
237
- console.log(chalk.red.bold("Cleaning up..."));
238
- fs.rmSync(tempDirectory, { recursive: true, force: true, maxRetries: 5 });
239
- console.log(chalk.red.bold("Done."));
240
263
  process.exit(1);
241
264
 
242
265
  }
243
266
 
267
+ await unZipFromArchive(zipFilePath);
268
+
269
+ // if (!fs.existsSync(tempTasksConfig) || !fs.existsSync(tempPackage)) {
270
+ // console.log(chalk.red.bold(`Zip file: ${fileName} not a compatible DX Component archive.`));
271
+ // console.log(chalk.red.bold("Cleaning up..."));
272
+ // fs.rmSync(tempDirectory, { recursive: true, force: true, maxRetries: 5 });
273
+ // console.log(chalk.red.bold("Done."));
274
+ // process.exit(1);
275
+
276
+ // }
277
+
244
278
  // need to get info from tasks.config and package.json
245
279
  // we won't rely on name of file, as owner can change it
246
280
 
@@ -415,8 +449,25 @@ export default async options => {
415
449
  }
416
450
  else {
417
451
 
418
- const filePathQuestions = await getFilePathQuestions();
419
- const filePathAnswers = await inquirer.prompt(filePathQuestions);
452
+ inquirer.registerPrompt('fuzzypath', inquirerFuzzyPath);
453
+
454
+ let filePathQuestions;
455
+ try {
456
+ filePathQuestions = await getFilePathQuestions();
457
+ }
458
+ catch (ex) {
459
+ process.exit(1);
460
+ }
461
+
462
+
463
+ let filePathAnswers;
464
+ try {
465
+ filePathAnswers = await inquirer.prompt(filePathQuestions);
466
+ }
467
+ catch(ex) {
468
+ process.exit(1);
469
+ }
470
+
420
471
  const { filePath } = filePathAnswers;
421
472
  const zipFileList = await getZipFileList(filePath);
422
473
 
@@ -20,16 +20,41 @@ addDebugLog("getFilePathQuestions", "", "");
20
20
  const currentDirectory = process.cwd();
21
21
  const arPathParts = currentDirectory.split(path.sep);
22
22
  let defaultPath = join(arPathParts[0], arPathParts[1], arPathParts[2], configDef.importRelativePath);
23
+ let startDirectory = join(arPathParts[0], arPathParts[1], arPathParts[2]);
24
+
23
25
  if (path.sep === "/") {
24
26
  defaultPath = "/".concat(defaultPath);
27
+ startDirectory = "/".concat(startDirectory).concat("/");
25
28
  }
26
29
 
27
30
 
28
31
  return [
29
32
  {
30
33
  name: 'filePath',
34
+ type: 'fuzzypath',
31
35
  message: 'Enter full file path of zip file location:',
32
- default: defaultPath
36
+ default: defaultPath,
37
+ excludePath: nodePath => nodePath.startsWith('node_modules'),
38
+ // excludePath :: (String) -> Bool
39
+ // excludePath to exclude some paths from the file-system scan
40
+ excludeFilter: nodePath => nodePath.indexOf('/.') >= 0,
41
+ // excludeFilter :: (String) -> Bool
42
+ // excludeFilter to exclude some paths from the final list, e.g. '.'
43
+ itemType: 'directory',
44
+ // itemType :: 'any' | 'directory' | 'file'
45
+ // specify the type of nodes to display
46
+ // default value: 'any'
47
+ // example: itemType: 'file' - hides directories from the item list
48
+ rootPath: startDirectory,
49
+ // rootPath :: String
50
+ // Root search directory
51
+ suggestOnly: false,
52
+ // suggestOnly :: Bool
53
+ // Restrict prompt answer to available choices or use them as suggestions
54
+ depthLimit: 2,
55
+ // depthLimit :: integer >= 0
56
+ // Limit the depth of sub-folders to scan
57
+ // Defaults to infinite depth if undefined
33
58
  }
34
59
  ];
35
60
  };
@@ -21,6 +21,8 @@ import { getFilePathQuestions, getFileNameQuestions, updateSavedFilePath } from
21
21
 
22
22
  import buildComponent from '../build-comp/index.js';
23
23
 
24
+ import inquirerFuzzyPath from '@pega/inquirer-fuzzy-path';
25
+
24
26
  export const DXCB_CONFIG_INTERNAL_JSON_FILENAME = 'src/dxcb.config.json';
25
27
  const currentDirectory = process.cwd();
26
28
  const pegaConfigJsonPath = join(currentDirectory, TASKS_CONFIG_JSON_FILENAME);
@@ -340,6 +342,8 @@ addDebugLog("importComponent", "", "+");
340
342
  }
341
343
  else {
342
344
 
345
+ inquirer.registerPrompt('fuzzypath', inquirerFuzzyPath);
346
+
343
347
  const filePathQuestions = await getFilePathQuestions();
344
348
  const filePathAnswers = await inquirer.prompt(filePathQuestions);
345
349
  const { filePath } = filePathAnswers;
@@ -80,11 +80,11 @@
80
80
  "author": "",
81
81
  "license": "Enter License",
82
82
  "dependencies": {
83
- "@pega/cosmos-react-condition-builder": "^8.0.0-build.13.2",
84
- "@pega/cosmos-react-core": "^8.0.0-build.13.2",
85
- "@pega/cosmos-react-work": "^8.0.0-build.13.2",
86
- "@pega/eslint-config": "^0.10.2",
87
- "@pega/tsconfig": "^0.15.1",
83
+ "@pega/cosmos-react-condition-builder": "^8.0.0-build.23.1",
84
+ "@pega/cosmos-react-core": "^8.0.0-build.23.1",
85
+ "@pega/cosmos-react-work": "^8.0.0-build.23.1",
86
+ "@pega/eslint-config": "^0.16.2",
87
+ "@pega/tsconfig": "^0.16.2",
88
88
  "babel-loader": "^9.1.3",
89
89
  "dayjs": "^1.11.11",
90
90
  "fast-deep-equal": "3.1.3",
@@ -99,14 +99,14 @@
99
99
  "serve": "^14.2.3",
100
100
  "shelljs": "^0.8.5",
101
101
  "styled-components": "^5.3.11",
102
- "ts-loader": "^9.5.1"
102
+ "ts-loader": "^9.5.2"
103
103
  },
104
104
  "devDependencies": {
105
- "@babel/preset-env": "^7.25.8",
106
- "@babel/preset-react": "^7.25.7",
107
- "@babel/preset-typescript": "^7.25.7",
108
- "@pega/configs": "^0.15.1",
109
- "@pega/custom-dx-components": "~0.25.5",
105
+ "@babel/preset-env": "^7.26.0",
106
+ "@babel/preset-react": "^7.26.3",
107
+ "@babel/preset-typescript": "^7.26.0",
108
+ "@pega/configs": "^0.16.2",
109
+ "@pega/custom-dx-components": "~0.25.6",
110
110
  "@pega/pcore-pconnect-typedefs": "^4.1.0-alpha.1",
111
111
  "@storybook/addon-actions": "^7.6.19",
112
112
  "@storybook/addon-essentials": "^7.6.19",
@@ -118,18 +118,18 @@
118
118
  "@storybook/test-runner": "^0.16.0",
119
119
  "@storybook/theming": "^7.6.19",
120
120
  "@testing-library/dom": "^10.4.0",
121
- "@testing-library/jest-dom": "^6.4.5",
122
- "@testing-library/react": "^12.1.5",
121
+ "@testing-library/jest-dom": "^6.6.3",
122
+ "@testing-library/react": "^16.2.0",
123
123
  "@types/emoji-mart": "^3.0.14",
124
124
  "@types/jest": "^29.5.14",
125
125
  "@types/lodash.get": "^4.4.9",
126
126
  "@types/react": "^17.0.80",
127
- "@types/react-color": "^3.0.12",
127
+ "@types/react-color": "^3.0.13",
128
128
  "@types/react-dom": "^17.0.25",
129
129
  "@types/styled-components": "^5.1.34",
130
130
  "@typescript-eslint/eslint-plugin": "^5.62.0",
131
- "babel-loader": "^9.1.3",
132
- "core-js": "^3.25.5",
131
+ "babel-loader": "^9.2.1",
132
+ "core-js": "^3.40.0",
133
133
  "eslint": "^8.57.0",
134
134
  "eslint-plugin-import": "^2.31.0",
135
135
  "eslint-plugin-jest": "^28.8.3",
@@ -146,6 +146,7 @@
146
146
  "jest-environment-jsdom": "^29.7.0",
147
147
  "jest-junit": "^16.0.0",
148
148
  "jwt-decode": "^4.0.0",
149
+ "node-stream-zip": "^1.15.0",
149
150
  "npm-run-all": "^4.1.5",
150
151
  "prettier": "3.3.3",
151
152
  "storybook": "^7.6.19",