@pega/custom-dx-components 0.23.4 → 0.23.5
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/jest.config.cjs +31 -12
- package/package.json +2 -1
- package/src/tasks/create/index.js +11 -4
- package/src/tasks/create-all/index.js +5 -2
- package/src/tasks/init/template/jest.config.cjs +0 -4
- package/src/tasks/init/template/package.json.mustache +2 -2
- package/src/tasks/init/template/test/functionTest/localCreateAllListDeleteAll.test.js +2 -2
- package/src/tasks/init/template/test/functionTest/localCreateBuildAllDeleteAll.test.js +5 -5
- package/src/tasks/init/template/test/functionTest/localCreateBuildDelete.test.js +1 -1
- package/src/tasks/init/template/test/functionTest/localCreateListDelete.test.js +2 -2
- package/src/tasks/init/template/test/functionTest/localCreatePublishAllDeleteAll.test.js +4 -4
- package/src/tasks/init/template/test/functionTest/localCreatePublishDelete.test.js +1 -1
- package/src/tasks/init/template/test/functionTest/localCreateRenameDelete.test.js +2 -2
- package/test/unitTest/util.test.js +23 -4
package/jest.config.cjs
CHANGED
|
@@ -1,18 +1,37 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
verbose: true,
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
roots: ['./test'],
|
|
4
|
+
moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx'],
|
|
5
|
+
testEnvironment: 'jsdom',
|
|
5
6
|
transform: {
|
|
6
|
-
'^.+\\.
|
|
7
|
-
"^.+\\.(js|jsx)$": "babel-jest"
|
|
7
|
+
'^.+\\.[t|j]sx?$': 'babel-jest'
|
|
8
8
|
},
|
|
9
9
|
collectCoverage: true,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
haste: {
|
|
11
|
+
retainAllFiles: true
|
|
12
|
+
},
|
|
13
|
+
testPathIgnorePatterns: [],
|
|
14
|
+
transformIgnorePatterns: [],
|
|
15
|
+
modulePathIgnorePatterns: [],
|
|
16
|
+
coveragePathIgnorePatterns: [],
|
|
17
|
+
collectCoverageFrom: ['./src/*.js'],
|
|
18
|
+
coverageThreshold: {
|
|
19
|
+
global: {
|
|
20
|
+
statements: 79,
|
|
21
|
+
branches: 74,
|
|
22
|
+
functions: 81,
|
|
23
|
+
lines: 80
|
|
17
24
|
}
|
|
18
|
-
}
|
|
25
|
+
},
|
|
26
|
+
reporters: [
|
|
27
|
+
'default',
|
|
28
|
+
[
|
|
29
|
+
'jest-junit',
|
|
30
|
+
{
|
|
31
|
+
suiteName: 'unit tests',
|
|
32
|
+
outputDirectory: 'build/test-results/test',
|
|
33
|
+
outputName: 'TEST-results-unit.xml'
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
]
|
|
37
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pega/custom-dx-components",
|
|
3
|
-
"version": "0.23.
|
|
3
|
+
"version": "0.23.5",
|
|
4
4
|
"description": "Utility for building custom UI components",
|
|
5
5
|
"bin": "./bin/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
"react-dev-utils": "^12.0.1",
|
|
50
50
|
"resolve": "1.22.1",
|
|
51
51
|
"resolve-url-loader": "^5.0.0",
|
|
52
|
+
"sass-loader": "^13.0.2",
|
|
52
53
|
"terser-webpack-plugin": "5.3.6",
|
|
53
54
|
"ts-loader": "^9.3.1",
|
|
54
55
|
"typescript": "^4.8.3",
|
|
@@ -109,7 +109,8 @@ const validateCompile = async (
|
|
|
109
109
|
type,
|
|
110
110
|
subtype,
|
|
111
111
|
description,
|
|
112
|
-
allowedApplications
|
|
112
|
+
allowedApplications,
|
|
113
|
+
organization
|
|
113
114
|
},
|
|
114
115
|
options
|
|
115
116
|
) => {
|
|
@@ -127,7 +128,11 @@ const validateCompile = async (
|
|
|
127
128
|
const templateDir = `./templates/${framework}/${type}/${sSubType}`;
|
|
128
129
|
const templateDirectory = fileURLToPath(new URL(templateDir, import.meta.url));
|
|
129
130
|
|
|
130
|
-
|
|
131
|
+
if (organization == null) {
|
|
132
|
+
({ organization } = JSON.parse(fs.readFileSync(path.resolve('package.json'), 'utf8')));
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
|
|
131
136
|
|
|
132
137
|
const componentKey = `${organization}_${library}_${componentName}`;
|
|
133
138
|
const targetDirectory = await getComponentDirectoryPath(componentKey);
|
|
@@ -162,7 +167,7 @@ const validateCompile = async (
|
|
|
162
167
|
export default async options => {
|
|
163
168
|
showVersion();
|
|
164
169
|
|
|
165
|
-
if (options.params.length >=
|
|
170
|
+
if (options.params.length >= 12) {
|
|
166
171
|
|
|
167
172
|
const type = options.params[3];
|
|
168
173
|
const subtype = options.params[4];
|
|
@@ -172,6 +177,7 @@ export default async options => {
|
|
|
172
177
|
const library = options.params[8];
|
|
173
178
|
const allowedApplications = options.params[9];
|
|
174
179
|
const description = options.params[10];
|
|
180
|
+
const organization = options.params[11];
|
|
175
181
|
const framework = "Constellation";
|
|
176
182
|
|
|
177
183
|
await validateCompile(
|
|
@@ -184,7 +190,8 @@ export default async options => {
|
|
|
184
190
|
type,
|
|
185
191
|
subtype,
|
|
186
192
|
description,
|
|
187
|
-
allowedApplications
|
|
193
|
+
allowedApplications,
|
|
194
|
+
organization
|
|
188
195
|
},
|
|
189
196
|
options
|
|
190
197
|
);
|
|
@@ -331,18 +331,21 @@ export default async options => {
|
|
|
331
331
|
const componentData = data[COMPONENTS_PATH];
|
|
332
332
|
|
|
333
333
|
const { library } = componentData;
|
|
334
|
-
|
|
334
|
+
let { organization } = JSON.parse(fs.readFileSync(path.resolve('package.json'), 'utf8'));
|
|
335
335
|
|
|
336
336
|
let componentDefaults = await getComponentDefaults();
|
|
337
337
|
componentDefaults.library = library;
|
|
338
338
|
|
|
339
339
|
|
|
340
|
-
if (options.params.length >=
|
|
340
|
+
if (options.params.length >= 8) {
|
|
341
341
|
const prefix = options.params[3];
|
|
342
342
|
const version = options.params[4];
|
|
343
343
|
const library = options.params[5];
|
|
344
344
|
const allowedApplications = options.params[6];
|
|
345
345
|
|
|
346
|
+
// overwrite
|
|
347
|
+
organization = options.params[7];
|
|
348
|
+
|
|
346
349
|
await validateCompileAll(
|
|
347
350
|
{
|
|
348
351
|
prefix,
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
verbose: true,
|
|
3
3
|
moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx'],
|
|
4
|
-
|
|
5
4
|
transform: {
|
|
6
5
|
'^.+\\.[t|j]sx?$': 'babel-jest'
|
|
7
6
|
},
|
|
8
7
|
collectCoverage: true,
|
|
9
|
-
haste: {
|
|
10
|
-
retainAllFiles: true
|
|
11
|
-
},
|
|
12
8
|
testPathIgnorePatterns: [],
|
|
13
9
|
transformIgnorePatterns: [],
|
|
14
10
|
modulePathIgnorePatterns: [],
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"test": "npm run test:functional && npm run test:unit",
|
|
26
26
|
"test:functional": "jest --runInBand test/functionTest --detectOpenHandles --coverage",
|
|
27
27
|
"test-coverage": "node --input-type=module --experimental-vm-modules node_modules/jest/bin/jest.js --runInBand node_modules/@pega/custom-dx-component --ci --testResultsProcessor='jest-junit' --coverage",
|
|
28
|
-
"test:unit": "npm run test:unit:local --prefix node_modules/@pega/custom-dx-components",
|
|
28
|
+
"test:unit": "npm run test:unit:local --prefix node_modules/@pega/custom-dx-components",
|
|
29
29
|
"lint:types": "tsc --noEmit",
|
|
30
30
|
"lint:es": "eslint .",
|
|
31
31
|
"lint:styles": "stylelint \"./**/*.@(js|jsx|ts|tsx)\"",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@pega/configs": "^0.5.3",
|
|
67
|
-
"@pega/custom-dx-components": "^0.23.
|
|
67
|
+
"@pega/custom-dx-components": "^0.23.5",
|
|
68
68
|
"@pega/eslint-config": "^0.3.2",
|
|
69
69
|
"@storybook/addon-actions": "^6.5.12",
|
|
70
70
|
"@storybook/addon-essentials": "^6.5.12",
|
|
@@ -4,7 +4,7 @@ const fs = require('fs');
|
|
|
4
4
|
const util = require('node:util');
|
|
5
5
|
const exec = util.promisify(require('node:child_process').exec);
|
|
6
6
|
|
|
7
|
-
describe('
|
|
7
|
+
describe('createAll list and deleteAll local', () => {
|
|
8
8
|
it('initial delete/cleanup', async () => {
|
|
9
9
|
const script = `npm run deleteAll Local Y`;
|
|
10
10
|
|
|
@@ -15,7 +15,7 @@ describe('create test and delete local', () => {
|
|
|
15
15
|
});
|
|
16
16
|
|
|
17
17
|
it('npm run createAll Local', async () => {
|
|
18
|
-
const script = `npm run createAll "My " 0.0.1 DXIL ""`;
|
|
18
|
+
const script = `npm run createAll "My " 0.0.1 DXIL "" Pega`;
|
|
19
19
|
|
|
20
20
|
const { stdout, stderr } = await exec(script);
|
|
21
21
|
// console.log(stdout);
|
|
@@ -4,7 +4,7 @@ const fs = require('fs');
|
|
|
4
4
|
const util = require('node:util');
|
|
5
5
|
const exec = util.promisify(require('node:child_process').exec);
|
|
6
6
|
|
|
7
|
-
describe('create
|
|
7
|
+
describe('create buildAll and deleteAll local', () => {
|
|
8
8
|
it('initial delete/cleanup', async () => {
|
|
9
9
|
const script = `npm run deleteAll Local Y`;
|
|
10
10
|
|
|
@@ -17,7 +17,7 @@ describe('create build and delete local', () => {
|
|
|
17
17
|
it('npm run create Local text', async () => {
|
|
18
18
|
const fileName = 'MyTestText';
|
|
19
19
|
const newFileName = `Pega_DXIL_${fileName}`;
|
|
20
|
-
const script = `npm run create Field Text ${fileName} "My Test Text" 0.0.1 DXIL "" "My Test Text Description"`;
|
|
20
|
+
const script = `npm run create Field Text ${fileName} "My Test Text" 0.0.1 DXIL "" "My Test Text Description" Pega`;
|
|
21
21
|
|
|
22
22
|
const { stdout, stderr } = await exec(script);
|
|
23
23
|
// console.log(stdout);
|
|
@@ -46,7 +46,7 @@ describe('create build and delete local', () => {
|
|
|
46
46
|
it('npm run create Local page', async () => {
|
|
47
47
|
const fileName = 'MyTestPage';
|
|
48
48
|
const newFileName = `Pega_DXIL_${fileName}`;
|
|
49
|
-
const script = `npm run create Widget PAGE ${fileName} "My Test Page" 0.0.1 DXIL "" "My Test Page Description"`;
|
|
49
|
+
const script = `npm run create Widget PAGE ${fileName} "My Test Page" 0.0.1 DXIL "" "My Test Page Description" Pega`;
|
|
50
50
|
|
|
51
51
|
const { stdout, stderr } = await exec(script);
|
|
52
52
|
// console.log(stdout);
|
|
@@ -75,7 +75,7 @@ describe('create build and delete local', () => {
|
|
|
75
75
|
it('npm run create Local details', async () => {
|
|
76
76
|
const fileName = 'MyTestDetails';
|
|
77
77
|
const newFileName = `Pega_DXIL_${fileName}`;
|
|
78
|
-
const script = `npm run create Template DETAILS ${fileName} "My Test Details" 0.0.1 DXIL "" "My Test Details Description"`;
|
|
78
|
+
const script = `npm run create Template DETAILS ${fileName} "My Test Details" 0.0.1 DXIL "" "My Test Details Description" Pega`;
|
|
79
79
|
|
|
80
80
|
const { stdout, stderr } = await exec(script);
|
|
81
81
|
// console.log(stdout);
|
|
@@ -144,5 +144,5 @@ describe('create build and delete local', () => {
|
|
|
144
144
|
// const createFile = path.resolve(path.join(`src/components/${newFileName}`, 'index.jsx'));
|
|
145
145
|
// const doesExist = fs.existsSync(createFile);
|
|
146
146
|
// expect(doesExist).not.toBeTruthy();
|
|
147
|
-
},
|
|
147
|
+
}, 20000);
|
|
148
148
|
});
|
|
@@ -17,7 +17,7 @@ describe('create build and delete local', () => {
|
|
|
17
17
|
it('npm run create Local', async () => {
|
|
18
18
|
const fileName = 'MyTestText';
|
|
19
19
|
const newFileName = `Pega_DXIL_${fileName}`;
|
|
20
|
-
const script = `npm run create Field Text ${fileName} "My Test Text" 0.0.1 DXIL "" "My Test Text Description"`;
|
|
20
|
+
const script = `npm run create Field Text ${fileName} "My Test Text" 0.0.1 DXIL "" "My Test Text Description" Pega`;
|
|
21
21
|
|
|
22
22
|
const { stdout, stderr } = await exec(script);
|
|
23
23
|
// console.log(stdout);
|
|
@@ -4,7 +4,7 @@ const fs = require('fs');
|
|
|
4
4
|
const util = require('node:util');
|
|
5
5
|
const exec = util.promisify(require('node:child_process').exec);
|
|
6
6
|
|
|
7
|
-
describe('create
|
|
7
|
+
describe('create list and delete local', () => {
|
|
8
8
|
it('initial delete/cleanup', async () => {
|
|
9
9
|
const script = `npm run deleteAll Local Y`;
|
|
10
10
|
|
|
@@ -17,7 +17,7 @@ describe('create test and delete local', () => {
|
|
|
17
17
|
it('npm run create Local', async () => {
|
|
18
18
|
const fileName = 'MyTestText';
|
|
19
19
|
const newFileName = `Pega_DXIL_${fileName}`;
|
|
20
|
-
const script = `npm run create Field Text ${fileName} "My Test Text" 0.0.1 DXIL "" "My Test Text Description"`;
|
|
20
|
+
const script = `npm run create Field Text ${fileName} "My Test Text" 0.0.1 DXIL "" "My Test Text Description" Pega`;
|
|
21
21
|
|
|
22
22
|
const { stdout, stderr } = await exec(script);
|
|
23
23
|
// console.log(stdout);
|
|
@@ -4,7 +4,7 @@ const fs = require('fs');
|
|
|
4
4
|
const util = require('node:util');
|
|
5
5
|
const exec = util.promisify(require('node:child_process').exec);
|
|
6
6
|
|
|
7
|
-
describe('create publish and
|
|
7
|
+
describe('create publish and deleteAll local', () => {
|
|
8
8
|
it('initial delete/cleanup', async () => {
|
|
9
9
|
const script = `npm run deleteAll Local Y`;
|
|
10
10
|
|
|
@@ -17,7 +17,7 @@ describe('create publish and delete local', () => {
|
|
|
17
17
|
it('npm run create Local text', async () => {
|
|
18
18
|
const fileName = 'MyTestText';
|
|
19
19
|
const newFileName = `Pega_DXIL_${fileName}`;
|
|
20
|
-
const script = `npm run create Field Text ${fileName} "My Test Text" 0.0.1 DXIL "" "My Test Text Description"`;
|
|
20
|
+
const script = `npm run create Field Text ${fileName} "My Test Text" 0.0.1 DXIL "" "My Test Text Description" Pega`;
|
|
21
21
|
|
|
22
22
|
const { stdout, stderr } = await exec(script);
|
|
23
23
|
// console.log(stdout);
|
|
@@ -46,7 +46,7 @@ describe('create publish and delete local', () => {
|
|
|
46
46
|
it('npm run create Local page', async () => {
|
|
47
47
|
const fileName = 'MyTestPage';
|
|
48
48
|
const newFileName = `Pega_DXIL_${fileName}`;
|
|
49
|
-
const script = `npm run create Widget PAGE ${fileName} "My Test Page" 0.0.1 DXIL "" "My Test Page Description"`;
|
|
49
|
+
const script = `npm run create Widget PAGE ${fileName} "My Test Page" 0.0.1 DXIL "" "My Test Page Description" Pega`;
|
|
50
50
|
|
|
51
51
|
const { stdout, stderr } = await exec(script);
|
|
52
52
|
// console.log(stdout);
|
|
@@ -75,7 +75,7 @@ describe('create publish and delete local', () => {
|
|
|
75
75
|
it('npm run create Local details', async () => {
|
|
76
76
|
const fileName = 'MyTestDetails';
|
|
77
77
|
const newFileName = `Pega_DXIL_${fileName}`;
|
|
78
|
-
const script = `npm run create Template DETAILS ${fileName} "My Test Details" 0.0.1 DXIL "" "My Test Details Description"`;
|
|
78
|
+
const script = `npm run create Template DETAILS ${fileName} "My Test Details" 0.0.1 DXIL "" "My Test Details Description" Pega`;
|
|
79
79
|
|
|
80
80
|
const { stdout, stderr } = await exec(script);
|
|
81
81
|
// console.log(stdout);
|
|
@@ -17,7 +17,7 @@ describe('create publish and delete local', () => {
|
|
|
17
17
|
it('npm run create Local', async () => {
|
|
18
18
|
const fileName = 'MyTestText';
|
|
19
19
|
const newFileName = `Pega_DXIL_${fileName}`;
|
|
20
|
-
const script = `npm run create Field Text ${fileName} "My Test Text" 0.0.1 DXIL "" "My Test Text Description"`;
|
|
20
|
+
const script = `npm run create Field Text ${fileName} "My Test Text" 0.0.1 DXIL "" "My Test Text Description" Pega`;
|
|
21
21
|
|
|
22
22
|
const { stdout, stderr } = await exec(script);
|
|
23
23
|
// console.log(stdout);
|
|
@@ -4,7 +4,7 @@ const fs = require('fs');
|
|
|
4
4
|
const util = require('node:util');
|
|
5
5
|
const exec = util.promisify(require('node:child_process').exec);
|
|
6
6
|
|
|
7
|
-
describe('create
|
|
7
|
+
describe('create rename and delete local', () => {
|
|
8
8
|
it('initial delete/cleanup', async () => {
|
|
9
9
|
const script = `npm run deleteAll Local Y`;
|
|
10
10
|
|
|
@@ -17,7 +17,7 @@ describe('create test and delete local', () => {
|
|
|
17
17
|
it('npm run create Local', async () => {
|
|
18
18
|
const fileName = 'MyTestText';
|
|
19
19
|
const newFileName = `Pega_DXIL_${fileName}`;
|
|
20
|
-
const script = `npm run create Field Text ${fileName} "My Test Text" 0.0.1 DXIL "" "My Test Text Description"`;
|
|
20
|
+
const script = `npm run create Field Text ${fileName} "My Test Text" 0.0.1 DXIL "" "My Test Text Description" Pega`;
|
|
21
21
|
|
|
22
22
|
const { stdout, stderr } = await exec(script);
|
|
23
23
|
// console.log(stdout);
|
|
@@ -37,6 +37,25 @@ const mockAcces = {
|
|
|
37
37
|
TOKEN_PATH: '.access_token'
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
// should be overridden
|
|
41
|
+
let libraryName = "not valid";
|
|
42
|
+
let organizationName = "not valid";
|
|
43
|
+
let version = "not valid";
|
|
44
|
+
|
|
45
|
+
beforeAll( async () => {
|
|
46
|
+
const thePath = process.cwd().replace("node_modules/@pega/custom-dx-components","");
|
|
47
|
+
const cwdMock = jest.spyOn(process, 'cwd');
|
|
48
|
+
cwdMock.mockReturnValue(thePath);
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
const oConf = await getPegaConfig();
|
|
52
|
+
libraryName = oConf.component.library;
|
|
53
|
+
version = oConf.component.version;
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
});
|
|
58
|
+
|
|
40
59
|
// describe('utils fetch', () => {
|
|
41
60
|
// let promiseStub = null;
|
|
42
61
|
|
|
@@ -279,8 +298,8 @@ describe('utils test', () => {
|
|
|
279
298
|
|
|
280
299
|
expect(oConf).not.toBeNull;
|
|
281
300
|
expect(sPath).toMatch('src/components');
|
|
282
|
-
expect(oConf.component.library).toMatch(
|
|
283
|
-
expect(oConf.component.version).toMatch(
|
|
301
|
+
expect(oConf.component.library).toMatch(libraryName);
|
|
302
|
+
expect(oConf.component.version).toMatch(version);
|
|
284
303
|
|
|
285
304
|
cwdMock.mockRestore();
|
|
286
305
|
|
|
@@ -317,8 +336,8 @@ describe('utils test', () => {
|
|
|
317
336
|
const oConf = await getComponentDefaults();
|
|
318
337
|
|
|
319
338
|
expect(oConf).not.toBeNull;
|
|
320
|
-
expect(oConf.library).toMatch(
|
|
321
|
-
expect(oConf.version).toMatch(
|
|
339
|
+
expect(oConf.library).toMatch(libraryName);
|
|
340
|
+
expect(oConf.version).toMatch(version);
|
|
322
341
|
|
|
323
342
|
cwdMock.mockRestore();
|
|
324
343
|
|