@pega/custom-dx-components 0.242.35 → 0.242.36

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 (50) hide show
  1. package/package.json +1 -1
  2. package/src/cli.js +6 -0
  3. package/src/constants.js +1 -0
  4. package/src/tasks/build-lib/helper.js +0 -1
  5. package/src/tasks/create-lib/index.js +5 -3
  6. package/src/tasks/create-version/index.js +3 -1
  7. package/src/tasks/delete-lib/index.js +4 -1
  8. package/src/tasks/delete-version/index.js +3 -1
  9. package/src/tasks/export-archive/index.js +58 -41
  10. package/src/tasks/import-archive/index.js +5 -1
  11. package/src/tasks/import-comp/helper.js +2 -4
  12. package/src/tasks/import-comp/index.js +1 -2
  13. package/src/tasks/index.js +1 -0
  14. package/src/tasks/init/template/package.json.mustache +3 -2
  15. package/src/tasks/list-lib/index.js +3 -1
  16. package/src/tasks/list-pub/index.js +18 -14
  17. package/src/tasks/move/helper.js +6 -3
  18. package/src/tasks/move/index.js +86 -17
  19. package/src/tasks/publish/helper.js +8 -5
  20. package/src/tasks/publish/index.js +4 -4
  21. package/src/tasks/publish-all/helper.js +16 -10
  22. package/src/tasks/quarantine/index.js +84 -0
  23. package/src/tasks/rename-lib/index.js +0 -1
  24. package/src/tasks/revert-webpack/index.js +0 -2
  25. package/src/tasks/set-perm/index.js +18 -2
  26. package/src/tasks/store/index.js +4 -1
  27. package/src/tasks/switch-lib/index.js +3 -1
  28. package/src/tasks/switch-version/index.js +3 -1
  29. package/src/util.js +50 -6
  30. package/tests/functional/localCreateAllListDeleteAll.test.js +56 -10
  31. package/tests/functional/localCreateBuildAllDeleteAll.test.js +56 -48
  32. package/tests/functional/localCreateBuildDelete.test.js +57 -10
  33. package/tests/functional/localCreateListDelete.test.js +55 -102
  34. package/tests/functional/localCreatePublishAllDeleteAll.test.js +68 -61
  35. package/tests/functional/localCreatePublishDelete.test.js +62 -21
  36. package/tests/functional/localCreateRenameDelete.test.js +55 -140
  37. package/tests/functional/localLibCreateLibAlreadyDeleteLib.test.js +118 -0
  38. package/tests/functional/localLibCreateLibBuildLibDeleteLib.test.js +241 -0
  39. package/tests/functional/localLibCreateLibBuildLibListPubDeleteLib.test.js +246 -0
  40. package/tests/functional/localLibCreateLibDeleteLib.test.js +109 -0
  41. package/tests/functional/localLibCreateLibExportImportLib.test.js +242 -0
  42. package/tests/functional/localLibCreateLibExportLib.test.js +219 -0
  43. package/tests/functional/localLibCreateLibImportCompDeleteLib.test.js +131 -0
  44. package/tests/functional/localLibCreateLibListDeleteLib.test.js +261 -0
  45. package/tests/functional/localLibCreateLibListMoveDeleteLib.test.js +236 -0
  46. package/tests/functional/localLibCreateLibListSwitchDeleteLib.test.js +237 -0
  47. package/tests/functional/localLibCreateLibPermDeleteLib.test.js +144 -0
  48. package/tests/functional/localLibCreateLibStatusDeleteLib.test.js +194 -0
  49. package/tests/functional/localLibCreateLibVersionDeleteLib.test.js +453 -0
  50. package/tests/functional/localPromoteRevertWP.test.js +83 -38
@@ -6,13 +6,67 @@ const exec = util.promisify(require('node:child_process').exec);
6
6
 
7
7
  const tasksConfigDir = path.resolve('../../..', 'tasks.config.json');
8
8
  const tasksConfigData = fs.readFileSync(tasksConfigDir, { encoding: 'utf8' });
9
- const tasksConfigJSON = JSON.parse(tasksConfigData);
10
- const isLibraryBased = tasksConfigJSON['libraryBased'];
9
+ let tasksConfigJSON = JSON.parse(tasksConfigData);
10
+
11
+ const packageJSONDir = path.resolve('../../..', 'package.json');
12
+ const packageJSONData = fs.readFileSync(packageJSONDir, { encoding: 'utf8'});
13
+ let packageJSON = JSON.parse(packageJSONData);
14
+
15
+ let isLibraryBased = tasksConfigJSON['libraryMode'];
16
+ const savedLibraryBased = isLibraryBased;
17
+ const savedOrganization = packageJSON.organization;
18
+
11
19
  const serverType = tasksConfigJSON['server-config'].serverType;
12
20
  const serverDir = serverType === 'launchpad' ? 'Launchpad' : 'Constellation';
13
- const compType = isLibraryBased ? "library" : "original";
21
+ let compType = isLibraryBased ? "library" : "original";
22
+
23
+ describe(`promote revert webpack: ${serverDir} - ${compType}`, () => {
24
+
25
+ beforeAll( async() => {
26
+
27
+ // make non libraryBased
28
+ isLibraryBased = false;
29
+ tasksConfigJSON['libraryMode'] = isLibraryBased;
30
+ compType = isLibraryBased ? "library" : "original";
31
+ fs.writeFileSync(tasksConfigDir, JSON.stringify(tasksConfigJSON, null, 4), { encoding: 'utf8' });
32
+
33
+ // make organzation Pega
34
+ packageJSON.organization = "Pega";
35
+ fs.writeFileSync(packageJSONDir, JSON.stringify(packageJSON, null, 4), { encoding: 'utf8' });
36
+
37
+
38
+ const componentsDir = path.join(path.resolve('../../..'), 'src/components');
39
+ if (fs.existsSync(componentsDir)) {
40
+ fs.rmSync(componentsDir, { recursive: true, force: true, maxRetries: 2 });
41
+ fs.mkdirSync(componentsDir, { recursive: true });
42
+ }
43
+
44
+ await new Promise((r) => setTimeout(r, 2000));
45
+
46
+ });
47
+
48
+ afterAll( async() => {
49
+
50
+ //restore
51
+ isLibraryBased = savedLibraryBased
52
+ tasksConfigJSON['libraryMode'] = isLibraryBased;
53
+
54
+ fs.writeFileSync(tasksConfigDir, JSON.stringify(tasksConfigJSON, null, 4), { encoding: 'utf8' });
55
+
56
+ // return organzation
57
+ packageJSON.organization = savedOrganization;
58
+ fs.writeFileSync(packageJSONDir, JSON.stringify(packageJSON, null, 4), { encoding: 'utf8' });
59
+
60
+ const componentsDir = path.join(path.resolve('../../..'), 'src/components');
61
+ if (fs.existsSync(componentsDir)) {
62
+ fs.rmSync(componentsDir, { recursive: true, force: true, maxRetries: 2 });
63
+ fs.mkdirSync(componentsDir, { recursive: true });
64
+ }
65
+
66
+ await new Promise((r) => setTimeout(r, 2000));
67
+
68
+ });
14
69
 
15
- describe(`promote and revert webpack: ${serverDir} - ${compType}`, () => {
16
70
  it('npm run promoteWebPack', async () => {
17
71
  const script = `npm run promoteWebPack --prefix ../../..`;
18
72
 
@@ -21,28 +75,23 @@ describe(`promote and revert webpack: ${serverDir} - ${compType}`, () => {
21
75
  expect(stdout).not.toBeNull();
22
76
  expect(stderr).not.toBeNull();
23
77
 
24
- if (isLibraryBased) {
25
- expect(stdout).toContain('Command only supported for non library based components.');
26
- }
27
- else {
78
+ // want message to contain component name
79
+ expect(stdout).toContain('Bundler now using');
80
+ expect(stdout).toContain('webpack.config.js');
28
81
 
29
- // want message to contain component name
30
- expect(stdout).toContain('Bundler now using');
31
- expect(stdout).toContain('webpack.config.js');
82
+ // utilize
83
+ expect(stdout).toContain('Utilize this file for webpack modifications.');
32
84
 
33
- // utilize
34
- expect(stdout).toContain('Utilize this file for webpack modifications.');
85
+ // verify new file exists
86
+ const webPackFile = path.resolve('../../..', 'webpack.config.js');
35
87
 
36
- // verify new file exists
37
- const webPackFile = path.resolve('../../..', 'webpack.config.js');
88
+ expect(fs.existsSync(webPackFile)).toBeTruthy();
38
89
 
39
- expect(fs.existsSync(webPackFile)).toBeTruthy();
90
+ // if (doesExist) {
91
+ // // remove it
92
+ // fs.rmdirSync(fileDir, { recursive: true });
93
+ // }
40
94
 
41
- // if (doesExist) {
42
- // // remove it
43
- // fs.rmdirSync(fileDir, { recursive: true });
44
- // }
45
- }
46
95
  }, 10000);
47
96
 
48
97
  it('npm run revertWebPack', async () => {
@@ -53,27 +102,23 @@ describe(`promote and revert webpack: ${serverDir} - ${compType}`, () => {
53
102
  expect(stdout).not.toBeNull();
54
103
  expect(stderr).not.toBeNull();
55
104
 
56
- if (isLibraryBased) {
57
- expect(stdout).toContain('Command only supported for non library based components.');
58
- }
59
- else {
60
105
 
61
- // want message to contain component name
62
- expect(stdout).toContain('marked as not used.');
63
- expect(stdout).toContain('webpack.config.js');
106
+ // want message to contain component name
107
+ expect(stdout).toContain('marked as not used.');
108
+ expect(stdout).toContain('webpack.config.js');
64
109
 
65
- // message with bundler
66
- expect(stdout).toContain('Bundler reverted to using internal webpack.config.js.');
110
+ // message with bundler
111
+ expect(stdout).toContain('Bundler reverted to using internal webpack.config.js.');
67
112
 
68
- // verify file marked as not used
69
- const webPackFile = path.resolve('../../..', 'webpack.config.js.notused');
113
+ // verify file marked as not used
114
+ const webPackFile = path.resolve('../../..', 'webpack.config.js.notused');
70
115
 
71
- expect(fs.existsSync(webPackFile)).toBeTruthy();
116
+ expect(fs.existsSync(webPackFile)).toBeTruthy();
117
+
118
+ // if (doesExist) {
119
+ // // remove it
120
+ // fs.rmdirSync(fileDir, { recursive: true });
121
+ // }
72
122
 
73
- // if (doesExist) {
74
- // // remove it
75
- // fs.rmdirSync(fileDir, { recursive: true });
76
- // }
77
- }
78
123
  }, 10000);
79
124
  });