@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.
- package/package.json +1 -1
- package/src/cli.js +6 -0
- package/src/constants.js +1 -0
- package/src/tasks/build-lib/helper.js +0 -1
- package/src/tasks/create-lib/index.js +5 -3
- package/src/tasks/create-version/index.js +3 -1
- package/src/tasks/delete-lib/index.js +4 -1
- package/src/tasks/delete-version/index.js +3 -1
- package/src/tasks/export-archive/index.js +58 -41
- package/src/tasks/import-archive/index.js +5 -1
- package/src/tasks/import-comp/helper.js +2 -4
- package/src/tasks/import-comp/index.js +1 -2
- package/src/tasks/index.js +1 -0
- package/src/tasks/init/template/package.json.mustache +3 -2
- package/src/tasks/list-lib/index.js +3 -1
- package/src/tasks/list-pub/index.js +18 -14
- package/src/tasks/move/helper.js +6 -3
- package/src/tasks/move/index.js +86 -17
- package/src/tasks/publish/helper.js +8 -5
- package/src/tasks/publish/index.js +4 -4
- package/src/tasks/publish-all/helper.js +16 -10
- package/src/tasks/quarantine/index.js +84 -0
- package/src/tasks/rename-lib/index.js +0 -1
- package/src/tasks/revert-webpack/index.js +0 -2
- package/src/tasks/set-perm/index.js +18 -2
- package/src/tasks/store/index.js +4 -1
- package/src/tasks/switch-lib/index.js +3 -1
- package/src/tasks/switch-version/index.js +3 -1
- package/src/util.js +50 -6
- package/tests/functional/localCreateAllListDeleteAll.test.js +56 -10
- package/tests/functional/localCreateBuildAllDeleteAll.test.js +56 -48
- package/tests/functional/localCreateBuildDelete.test.js +57 -10
- package/tests/functional/localCreateListDelete.test.js +55 -102
- package/tests/functional/localCreatePublishAllDeleteAll.test.js +68 -61
- package/tests/functional/localCreatePublishDelete.test.js +62 -21
- package/tests/functional/localCreateRenameDelete.test.js +55 -140
- package/tests/functional/localLibCreateLibAlreadyDeleteLib.test.js +118 -0
- package/tests/functional/localLibCreateLibBuildLibDeleteLib.test.js +241 -0
- package/tests/functional/localLibCreateLibBuildLibListPubDeleteLib.test.js +246 -0
- package/tests/functional/localLibCreateLibDeleteLib.test.js +109 -0
- package/tests/functional/localLibCreateLibExportImportLib.test.js +242 -0
- package/tests/functional/localLibCreateLibExportLib.test.js +219 -0
- package/tests/functional/localLibCreateLibImportCompDeleteLib.test.js +131 -0
- package/tests/functional/localLibCreateLibListDeleteLib.test.js +261 -0
- package/tests/functional/localLibCreateLibListMoveDeleteLib.test.js +236 -0
- package/tests/functional/localLibCreateLibListSwitchDeleteLib.test.js +237 -0
- package/tests/functional/localLibCreateLibPermDeleteLib.test.js +144 -0
- package/tests/functional/localLibCreateLibStatusDeleteLib.test.js +194 -0
- package/tests/functional/localLibCreateLibVersionDeleteLib.test.js +453 -0
- package/tests/functional/localPromoteRevertWP.test.js +83 -38
|
@@ -6,23 +6,69 @@ 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
|
-
|
|
10
|
-
|
|
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
|
-
|
|
21
|
+
let compType = isLibraryBased ? "library" : "original";
|
|
14
22
|
|
|
15
23
|
|
|
16
|
-
describe(`createAll list
|
|
17
|
-
|
|
18
|
-
|
|
24
|
+
describe(`createAll list deleteAll local: ${serverDir} - ${compType}` , () => {
|
|
25
|
+
|
|
26
|
+
beforeAll( async() => {
|
|
27
|
+
|
|
28
|
+
// make non libraryBased
|
|
29
|
+
isLibraryBased = false;
|
|
30
|
+
tasksConfigJSON['libraryMode'] = isLibraryBased;
|
|
31
|
+
compType = isLibraryBased ? "library" : "original";
|
|
32
|
+
fs.writeFileSync(tasksConfigDir, JSON.stringify(tasksConfigJSON, null, 4), { encoding: 'utf8' });
|
|
33
|
+
|
|
34
|
+
// make organzation Pega
|
|
35
|
+
packageJSON.organization = "Pega";
|
|
36
|
+
fs.writeFileSync(packageJSONDir, JSON.stringify(packageJSON, null, 4), { encoding: 'utf8' });
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
const componentsDir = path.join(path.resolve('../../..'), 'src/components');
|
|
40
|
+
if (fs.existsSync(componentsDir)) {
|
|
41
|
+
fs.rmSync(componentsDir, { recursive: true, force: true, maxRetries: 2 });
|
|
42
|
+
fs.mkdirSync(componentsDir, { recursive: true });
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
await new Promise((r) => setTimeout(r, 2000));
|
|
19
46
|
|
|
20
|
-
const { stdout, stderr } = await exec(script);
|
|
21
|
-
// console.log(stdout);
|
|
22
|
-
expect(stdout).not.toBeNull();
|
|
23
|
-
expect(stderr).not.toBeNull();
|
|
24
47
|
});
|
|
25
48
|
|
|
49
|
+
afterAll( async() => {
|
|
50
|
+
|
|
51
|
+
//restore
|
|
52
|
+
isLibraryBased = savedLibraryBased
|
|
53
|
+
tasksConfigJSON['libraryMode'] = isLibraryBased;
|
|
54
|
+
|
|
55
|
+
fs.writeFileSync(tasksConfigDir, JSON.stringify(tasksConfigJSON, null, 4), { encoding: 'utf8' });
|
|
56
|
+
|
|
57
|
+
// return organzation
|
|
58
|
+
packageJSON.organization = savedOrganization;
|
|
59
|
+
fs.writeFileSync(packageJSONDir, JSON.stringify(packageJSON, null, 4), { encoding: 'utf8' });
|
|
60
|
+
|
|
61
|
+
const componentsDir = path.join(path.resolve('../../..'), 'src/components');
|
|
62
|
+
if (fs.existsSync(componentsDir)) {
|
|
63
|
+
fs.rmSync(componentsDir, { recursive: true, force: true, maxRetries: 2 });
|
|
64
|
+
fs.mkdirSync(componentsDir, { recursive: true });
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
await new Promise((r) => setTimeout(r, 2000));
|
|
68
|
+
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
|
|
26
72
|
it('npm run createAll Local', async () => {
|
|
27
73
|
const script = `npm run createAll "My" 0.0.1 DXIL "" Pega Jest --prefix ../../..`;
|
|
28
74
|
|
|
@@ -6,22 +6,68 @@ 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
|
-
|
|
10
|
-
|
|
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
|
-
|
|
21
|
+
let compType = isLibraryBased ? "library" : "original";
|
|
14
22
|
|
|
15
|
-
describe(`create buildAll
|
|
16
|
-
|
|
17
|
-
|
|
23
|
+
describe(`create buildAll deleteAll local: ${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));
|
|
18
45
|
|
|
19
|
-
const { stdout, stderr } = await exec(script);
|
|
20
|
-
// console.log(stdout);
|
|
21
|
-
expect(stdout).not.toBeNull();
|
|
22
|
-
expect(stderr).not.toBeNull();
|
|
23
46
|
});
|
|
24
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
|
+
});
|
|
69
|
+
|
|
70
|
+
|
|
25
71
|
it('npm run create Local text', async () => {
|
|
26
72
|
const fileName = 'MyTestText';
|
|
27
73
|
const newFileName = `Pega_DXIL_${fileName}`;
|
|
@@ -136,33 +182,6 @@ describe(`create buildAll and deleteAll local: ${serverDir} - ${compType}`, () =
|
|
|
136
182
|
// done();
|
|
137
183
|
}, 70000);
|
|
138
184
|
|
|
139
|
-
it(`npm run buildLibrary - ${isLibraryBased}`, async() => {
|
|
140
|
-
|
|
141
|
-
const script = `npm run buildLibrary 0.0.1 Y --prefix ../../..`;
|
|
142
|
-
const { stdout, stderr } = await exec(script);
|
|
143
|
-
|
|
144
|
-
if (isLibraryBased) {
|
|
145
|
-
expect(stdout).not.toBeNull();
|
|
146
|
-
expect(stderr).not.toBeNull();
|
|
147
|
-
|
|
148
|
-
expect(stdout).not.toContain('error');
|
|
149
|
-
expect(stdout).not.toContain('Error');
|
|
150
|
-
|
|
151
|
-
expect(stdout).toContain('Building Pega_DXIL_MyTestText');
|
|
152
|
-
expect(stdout).toContain('Building Pega_DXIL_MyTestPage');
|
|
153
|
-
expect(stdout).toContain('Building Pega_DXIL_MyTestDetails');
|
|
154
|
-
|
|
155
|
-
expect(stdout).toContain('Library Build - Starting');
|
|
156
|
-
expect(stdout).toContain('Webpack - Starting');
|
|
157
|
-
expect(stdout).toContain('successfully');
|
|
158
|
-
|
|
159
|
-
expect(stdout).toContain('== Creating manifest for the library version - completed ==');
|
|
160
|
-
}
|
|
161
|
-
else {
|
|
162
|
-
expect(stdout).toContain('Command only supported for library based components.');
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
}, 100000);
|
|
166
185
|
|
|
167
186
|
it('npm run deleteAll Local', async () => {
|
|
168
187
|
const script = `npm run deleteAll Local Y --prefix ../../..`;
|
|
@@ -191,17 +210,6 @@ describe(`create buildAll and deleteAll local: ${serverDir} - ${compType}`, () =
|
|
|
191
210
|
// expect(doesExist).not.toBeTruthy();
|
|
192
211
|
}, 20000);
|
|
193
212
|
|
|
194
|
-
it(`npm run deleteLibrary - ${isLibraryBased}`, async() => {
|
|
195
213
|
|
|
196
|
-
const script = `npm run deleteLibrary Local ALL --prefix ../../..`;
|
|
197
|
-
const { stdout, stderr } = await exec(script);
|
|
198
|
-
|
|
199
|
-
if (isLibraryBased) {
|
|
200
|
-
expect(stdout).toContain('Library: Pega_DXIL is deleted from Local');
|
|
201
|
-
}
|
|
202
|
-
else {
|
|
203
|
-
expect(stdout).toContain('Command only supported for library based components.');
|
|
204
|
-
}
|
|
205
|
-
}, 30000);
|
|
206
214
|
|
|
207
215
|
});
|
|
@@ -2,24 +2,71 @@
|
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const fs = require('fs');
|
|
4
4
|
const util = require('node:util');
|
|
5
|
+
const { transpileModule } = require('typescript');
|
|
5
6
|
const exec = util.promisify(require('node:child_process').exec);
|
|
6
7
|
|
|
7
8
|
const tasksConfigDir = path.resolve('../../..', 'tasks.config.json');
|
|
8
9
|
const tasksConfigData = fs.readFileSync(tasksConfigDir, { encoding: 'utf8' });
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
let tasksConfigJSON = JSON.parse(tasksConfigData);
|
|
11
|
+
|
|
12
|
+
const packageJSONDir = path.resolve('../../..', 'package.json');
|
|
13
|
+
const packageJSONData = fs.readFileSync(packageJSONDir, { encoding: 'utf8'});
|
|
14
|
+
let packageJSON = JSON.parse(packageJSONData);
|
|
15
|
+
|
|
16
|
+
let isLibraryBased = tasksConfigJSON['libraryMode'];
|
|
17
|
+
const savedLibraryBased = isLibraryBased;
|
|
18
|
+
const savedOrganization = packageJSON.organization;
|
|
19
|
+
|
|
11
20
|
const serverType = tasksConfigJSON['server-config'].serverType;
|
|
12
21
|
const serverDir = serverType === 'launchpad' ? 'Launchpad' : 'Constellation';
|
|
13
|
-
|
|
22
|
+
let compType = isLibraryBased ? "library" : "original";
|
|
14
23
|
|
|
15
|
-
describe(`create build and delete local: ${serverDir} - ${compType}`, () => {
|
|
16
|
-
it('initial delete/cleanup', async () => {
|
|
17
|
-
const script = `npm run deleteAll Local Y --prefix ../../..`;
|
|
18
24
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
25
|
+
describe(`create library delete Library: ${serverDir} - ${compType}`, () => {
|
|
26
|
+
|
|
27
|
+
beforeAll( async() => {
|
|
28
|
+
|
|
29
|
+
// make non libraryBased
|
|
30
|
+
isLibraryBased = false;
|
|
31
|
+
tasksConfigJSON['libraryMode'] = isLibraryBased;
|
|
32
|
+
compType = isLibraryBased ? "library" : "original";
|
|
33
|
+
fs.writeFileSync(tasksConfigDir, JSON.stringify(tasksConfigJSON, null, 4), { encoding: 'utf8' });
|
|
34
|
+
|
|
35
|
+
// make organzation Pega
|
|
36
|
+
packageJSON.organization = "Pega";
|
|
37
|
+
fs.writeFileSync(packageJSONDir, JSON.stringify(packageJSON, null, 4), { encoding: 'utf8' });
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
const componentsDir = path.join(path.resolve('../../..'), 'src/components');
|
|
41
|
+
if (fs.existsSync(componentsDir)) {
|
|
42
|
+
fs.rmSync(componentsDir, { recursive: true, force: true, maxRetries: 2 });
|
|
43
|
+
fs.mkdirSync(componentsDir, { recursive: true });
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
await new Promise((r) => setTimeout(r, 2000));
|
|
47
|
+
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
afterAll( async() => {
|
|
51
|
+
|
|
52
|
+
//restore
|
|
53
|
+
isLibraryBased = savedLibraryBased
|
|
54
|
+
tasksConfigJSON['libraryMode'] = isLibraryBased;
|
|
55
|
+
|
|
56
|
+
fs.writeFileSync(tasksConfigDir, JSON.stringify(tasksConfigJSON, null, 4), { encoding: 'utf8' });
|
|
57
|
+
|
|
58
|
+
// return organzation
|
|
59
|
+
packageJSON.organization = savedOrganization;
|
|
60
|
+
fs.writeFileSync(packageJSONDir, JSON.stringify(packageJSON, null, 4), { encoding: 'utf8' });
|
|
61
|
+
|
|
62
|
+
const componentsDir = path.join(path.resolve('../../..'), 'src/components');
|
|
63
|
+
if (fs.existsSync(componentsDir)) {
|
|
64
|
+
fs.rmSync(componentsDir, { recursive: true, force: true, maxRetries: 2 });
|
|
65
|
+
fs.mkdirSync(componentsDir, { recursive: true });
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
await new Promise((r) => setTimeout(r, 2000));
|
|
69
|
+
|
|
23
70
|
});
|
|
24
71
|
|
|
25
72
|
it('npm run create Local', async () => {
|
|
@@ -6,20 +6,65 @@ 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
|
-
|
|
10
|
-
|
|
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
|
-
|
|
21
|
+
let compType = isLibraryBased ? "library" : "original";
|
|
14
22
|
|
|
15
|
-
describe(`
|
|
16
|
-
|
|
17
|
-
|
|
23
|
+
describe(`createLib createAll list deleteLib: ${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));
|
|
18
67
|
|
|
19
|
-
const { stdout, stderr } = await exec(script);
|
|
20
|
-
// console.log(stdout);
|
|
21
|
-
expect(stdout).not.toBeNull();
|
|
22
|
-
expect(stderr).not.toBeNull();
|
|
23
68
|
});
|
|
24
69
|
|
|
25
70
|
it('npm run create Local', async () => {
|
|
@@ -114,99 +159,7 @@ describe(`create list and delete local: ${serverDir} - ${compType}`, () => {
|
|
|
114
159
|
expect(doesExist).not.toBeTruthy();
|
|
115
160
|
}, 10000);
|
|
116
161
|
|
|
117
|
-
// test list library need to createAll, buildLibrary, listLibrary
|
|
118
|
-
it('npm run createAll Local', async () => {
|
|
119
|
-
const script = `npm run createAll "My" 0.0.1 DXIL "" Pega Jest --prefix ../../..`;
|
|
120
|
-
|
|
121
|
-
const { stdout, stderr } = await exec(script);
|
|
122
|
-
// console.log(stdout);
|
|
123
|
-
expect(stdout).not.toBeNull();
|
|
124
|
-
expect(stderr).not.toBeNull();
|
|
125
|
-
|
|
126
|
-
// want message to contain component name
|
|
127
|
-
expect(stdout).toContain('created Pega_DXIL_My');
|
|
128
|
-
|
|
129
|
-
// don't want message with already exists
|
|
130
|
-
expect(stdout).not.toContain('already exists');
|
|
131
|
-
|
|
132
|
-
// check to see file exists
|
|
133
162
|
|
|
134
|
-
// pick one
|
|
135
|
-
const newFileName = 'Pega_DXIL_MyBoolean';
|
|
136
163
|
|
|
137
|
-
// const fileDir = path.resolve(`src/components/${newFileName}`);
|
|
138
|
-
const createFile = path.resolve(
|
|
139
|
-
'../../..',
|
|
140
|
-
path.join(`src/components/${newFileName}`, 'index.tsx')
|
|
141
|
-
);
|
|
142
|
-
const doesExist = fs.existsSync(createFile);
|
|
143
|
-
expect(doesExist).toBeTruthy();
|
|
144
|
-
|
|
145
|
-
// if (doesExist) {
|
|
146
|
-
// // remove it
|
|
147
|
-
// fs.rmdirSync(fileDir, { recursive: true });
|
|
148
|
-
// }
|
|
149
|
-
}, 10000);
|
|
150
|
-
|
|
151
|
-
it(`npm run buildLibrary - ${isLibraryBased}`, async() => {
|
|
152
|
-
|
|
153
|
-
const script = `npm run buildLibrary 0.0.1 Y --prefix ../../..`;
|
|
154
|
-
const { stdout, stderr } = await exec(script);
|
|
155
|
-
|
|
156
|
-
if (isLibraryBased) {
|
|
157
|
-
expect(stdout).not.toBeNull();
|
|
158
|
-
expect(stderr).not.toBeNull();
|
|
159
|
-
|
|
160
|
-
expect(stdout).not.toContain('error');
|
|
161
|
-
expect(stdout).not.toContain('Error');
|
|
162
|
-
|
|
163
|
-
expect(stdout).toContain('Building Pega_DXIL_MyBoolean');
|
|
164
|
-
expect(stdout).toContain('Building Pega_DXIL_MyPage');
|
|
165
|
-
expect(stdout).toContain('Building Pega_DXIL_MyPageWidget');
|
|
166
|
-
|
|
167
|
-
expect(stdout).toContain('Library Build - Starting');
|
|
168
|
-
expect(stdout).toContain('Webpack - Starting');
|
|
169
|
-
expect(stdout).toContain('successfully');
|
|
170
|
-
|
|
171
|
-
expect(stdout).toContain('== Creating manifest for the library version - completed ==');
|
|
172
|
-
}
|
|
173
|
-
else {
|
|
174
|
-
expect(stdout).toContain('Command only supported for library based components.');
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
}, 100000);
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
it(`npm run listLibrary - ${isLibraryBased}`, async() => {
|
|
181
|
-
|
|
182
|
-
const script = `npm run listLibrary Local 0.0.1-dev --prefix ../../..`;
|
|
183
|
-
const { stdout, stderr } = await exec(script);
|
|
184
|
-
|
|
185
|
-
if (isLibraryBased) {
|
|
186
|
-
expect(stdout).not.toBeNull();
|
|
187
|
-
expect(stderr).not.toBeNull();
|
|
188
|
-
|
|
189
|
-
expect(stdout).toContain('Pega_DXIL_MyURL');
|
|
190
|
-
expect(stdout).toContain('Field');
|
|
191
|
-
expect(stdout).toContain('Text-URL');
|
|
192
|
-
expect(stdout).toContain('0.0.1-dev');
|
|
193
|
-
}
|
|
194
|
-
else {
|
|
195
|
-
expect(stdout).toContain('Command only supported for library based components.');
|
|
196
|
-
}
|
|
197
|
-
}, 30000);
|
|
198
|
-
|
|
199
|
-
it(`npm run deleteLibrary - ${isLibraryBased}`, async() => {
|
|
200
|
-
|
|
201
|
-
const script = `npm run deleteLibrary Local ALL --prefix ../../..`;
|
|
202
|
-
const { stdout, stderr } = await exec(script);
|
|
203
|
-
|
|
204
|
-
if (isLibraryBased) {
|
|
205
|
-
expect(stdout).toContain('Library: Pega_DXIL is deleted from Local');
|
|
206
|
-
}
|
|
207
|
-
else {
|
|
208
|
-
expect(stdout).toContain('Command only supported for library based components.');
|
|
209
|
-
}
|
|
210
|
-
}, 30000);
|
|
211
164
|
|
|
212
165
|
});
|
|
@@ -6,20 +6,65 @@ 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
|
-
|
|
10
|
-
|
|
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
|
-
|
|
21
|
+
let compType = isLibraryBased ? "library" : "original";
|
|
14
22
|
|
|
15
|
-
describe(`create publish
|
|
16
|
-
|
|
17
|
-
|
|
23
|
+
describe(`create publish deleteAll local: ${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));
|
|
18
67
|
|
|
19
|
-
const { stdout, stderr } = await exec(script);
|
|
20
|
-
// console.log(stdout);
|
|
21
|
-
expect(stdout).not.toBeNull();
|
|
22
|
-
expect(stderr).not.toBeNull();
|
|
23
68
|
});
|
|
24
69
|
|
|
25
70
|
it('npm run create Local text', async () => {
|
|
@@ -84,7 +129,7 @@ describe(`create publish and deleteAll local: ${serverDir} - ${compType}`, () =>
|
|
|
84
129
|
// // remove it
|
|
85
130
|
// fs.rmdirSync(fileDir, { recursive: true });
|
|
86
131
|
// }
|
|
87
|
-
},
|
|
132
|
+
}, 20000);
|
|
88
133
|
|
|
89
134
|
it('npm run create Local details', async () => {
|
|
90
135
|
const fileName = 'MyTestDetails';
|
|
@@ -122,61 +167,23 @@ describe(`create publish and deleteAll local: ${serverDir} - ${compType}`, () =>
|
|
|
122
167
|
const script = `npm run publishAll LoanV2 01-01-01 N noFetch --prefix ../../..`;
|
|
123
168
|
const { stdout, stderr } = await exec(script);
|
|
124
169
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
else {
|
|
129
|
-
// console.log(stdout);
|
|
130
|
-
expect(stdout).not.toBeNull();
|
|
131
|
-
expect(stderr).not.toBeNull();
|
|
132
|
-
|
|
133
|
-
// expect(stdout).toContain('Compiled successfully.');
|
|
134
|
-
// expect(stdout).not.toContain('Compiled with warnings.');
|
|
135
|
-
expect(stdout).not.toContain('error');
|
|
136
|
-
expect(stdout).not.toContain('Error');
|
|
137
|
-
|
|
138
|
-
expect(stdout).toContain('Pega_DXIL_MyTestText');
|
|
139
|
-
expect(stdout).toContain('Pega_DXIL_MyTestPage');
|
|
140
|
-
expect(stdout).toContain('Pega_DXIL_MyTestDetails');
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// done();
|
|
144
|
-
}, 70000);
|
|
145
|
-
|
|
146
|
-
// simple test, no publish to server
|
|
147
|
-
it(`npm run publishLibrary PROD - ${isLibraryBased}`, async() => {
|
|
148
|
-
|
|
149
|
-
const script = `npm run publishLibrary Pega_DXIL 0.0.1 noPublish --prefix ../../..`;
|
|
150
|
-
const { stdout, stderr } = await exec(script);
|
|
151
|
-
|
|
152
|
-
if (isLibraryBased) {
|
|
153
|
-
expect(stdout).not.toBeNull();
|
|
154
|
-
expect(stderr).not.toBeNull();
|
|
155
|
-
|
|
156
|
-
expect(stdout).toContain('PRODUCTION, no publish');
|
|
157
|
-
}
|
|
158
|
-
else {
|
|
159
|
-
expect(stdout).toContain('Command only supported for library based components.');
|
|
160
|
-
}
|
|
170
|
+
// console.log(stdout);
|
|
171
|
+
expect(stdout).not.toBeNull();
|
|
172
|
+
expect(stderr).not.toBeNull();
|
|
161
173
|
|
|
162
|
-
|
|
174
|
+
// expect(stdout).toContain('Compiled successfully.');
|
|
175
|
+
// expect(stdout).not.toContain('Compiled with warnings.');
|
|
176
|
+
expect(stdout).not.toContain('error');
|
|
177
|
+
expect(stdout).not.toContain('Error');
|
|
163
178
|
|
|
164
|
-
|
|
179
|
+
expect(stdout).toContain('Pega_DXIL_MyTestText');
|
|
180
|
+
expect(stdout).toContain('Pega_DXIL_MyTestPage');
|
|
181
|
+
expect(stdout).toContain('Pega_DXIL_MyTestDetails');
|
|
165
182
|
|
|
166
|
-
const script = `npm run publishLibrary Pega_DXIL 0.0.1-dev noPublish --prefix ../../..`;
|
|
167
|
-
const { stdout, stderr } = await exec(script);
|
|
168
183
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
expect(stderr).not.toBeNull();
|
|
172
|
-
|
|
173
|
-
expect(stdout).toContain('OK to publish');
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
176
|
-
expect(stdout).toContain('Command only supported for library based components.');
|
|
177
|
-
}
|
|
184
|
+
// done();
|
|
185
|
+
}, 70000);
|
|
178
186
|
|
|
179
|
-
}, 30000);
|
|
180
187
|
|
|
181
188
|
|
|
182
189
|
it('npm run deleteAll Local', async () => {
|