@pega/dx-component-builder-sdk 0.1.28 → 0.1.30
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 +4 -4
- package/src/tasks/create/templates/SDK-React/field/Boolean/index.tsx.mustache +0 -1
- package/src/tasks/create-all/index.js +14 -11
- package/src/tasks/index.js +1 -1
- package/src/tasks/publish/index.js +1 -1
- package/src/tasks/publish-all/helper.js +18 -10
- package/src/tasks/publish-all/index.js +67 -41
- package/src/tasks/validator/index.js +2 -2
- /package/src/tasks/{generate-missing-companions → scan-and-fix}/index.js +0 -0
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
createAllComponents,
|
|
10
10
|
deleteComponent,
|
|
11
11
|
deleteAllComponents,
|
|
12
|
-
|
|
12
|
+
scanAndFix,
|
|
13
13
|
listComponents,
|
|
14
14
|
mapAllComponents,
|
|
15
15
|
overrideComponent,
|
|
@@ -38,7 +38,7 @@ const TASKS = {
|
|
|
38
38
|
DELETE_ALL: "deleteAll",
|
|
39
39
|
AUTHENTICATE: 'authenticate',
|
|
40
40
|
UPGRADE: 'upgrade',
|
|
41
|
-
|
|
41
|
+
SCAN_AND_FIX: 'scanAndFix'
|
|
42
42
|
};
|
|
43
43
|
|
|
44
44
|
const parseArgumentsIntoOptions = rawArgs => {
|
|
@@ -128,8 +128,8 @@ export default async (args = []) => {
|
|
|
128
128
|
upgrade(options);
|
|
129
129
|
break;
|
|
130
130
|
}
|
|
131
|
-
case TASKS.
|
|
132
|
-
|
|
131
|
+
case TASKS.SCAN_AND_FIX: {
|
|
132
|
+
scanAndFix(options);
|
|
133
133
|
break;
|
|
134
134
|
}
|
|
135
135
|
default: {
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
FormHelperText
|
|
9
9
|
} from '@material-ui/core';
|
|
10
10
|
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
11
|
-
import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
|
|
12
11
|
import PropTypes from 'prop-types';
|
|
13
12
|
import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
|
|
14
13
|
import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
|
|
@@ -155,7 +155,8 @@ export const validateCompileAll = async (
|
|
|
155
155
|
const type = "Field";
|
|
156
156
|
const subtype = COMPONENT_SCHEMA.subtype.field[fieldIdx].value;
|
|
157
157
|
const prefixNoSpace = prefix.replace(/\s+/g, '');
|
|
158
|
-
const
|
|
158
|
+
const componentNameNoSpace = COMPONENT_SCHEMA.subtype.field[fieldIdx].name.replace(/\s+/g, '');
|
|
159
|
+
const componentName = "".concat(prefixNoSpace).concat(componentNameNoSpace);
|
|
159
160
|
const componentLabel = "".concat(prefix).concat(" ").concat(COMPONENT_SCHEMA.subtype.field[fieldIdx].name);
|
|
160
161
|
const description = componentLabel;
|
|
161
162
|
|
|
@@ -179,12 +180,13 @@ export const validateCompileAll = async (
|
|
|
179
180
|
const type = "Template";
|
|
180
181
|
const subtype = COMPONENT_SCHEMA.subtype.template[templateIdx].value;
|
|
181
182
|
const prefixNoSpace = prefix.replace(/\s+/g, '');
|
|
183
|
+
let templateNameOriginal = COMPONENT_SCHEMA.subtype.template[templateIdx].name;
|
|
182
184
|
let templateName = convertIntoPascalCase(COMPONENT_SCHEMA.subtype.template[templateIdx].name);
|
|
183
185
|
let templateLabel = convertIntoPascalCase(COMPONENT_SCHEMA.subtype.template[templateIdx].name);
|
|
184
|
-
if (
|
|
185
|
-
|
|
186
|
-
templateName = "TwoColumn".concat(
|
|
187
|
-
templateLabel = "Two Column".concat(
|
|
186
|
+
if (templateNameOriginal.indexOf("region") >= 0) {
|
|
187
|
+
let templateNameBase = convertIntoPascalCase(templateNameOriginal.replace(" region", ""));
|
|
188
|
+
templateName = "TwoColumn".concat(templateNameBase);
|
|
189
|
+
templateLabel = "Two Column ".concat(templateNameBase);
|
|
188
190
|
}
|
|
189
191
|
const componentName = "".concat(prefixNoSpace).concat(templateName);
|
|
190
192
|
const componentLabel = "".concat(prefix).concat(" ").concat(templateLabel);
|
|
@@ -211,10 +213,11 @@ export const validateCompileAll = async (
|
|
|
211
213
|
const type = "Widget";
|
|
212
214
|
const subtype = COMPONENT_SCHEMA.subtype.widget[widgetIdx].value;
|
|
213
215
|
const prefixNoSpace = prefix.replace(/\s+/g, '');
|
|
216
|
+
let widgetNameOriginal = COMPONENT_SCHEMA.subtype.template[widgetIdx].name;
|
|
214
217
|
let widgetName = convertIntoPascalCase(COMPONENT_SCHEMA.subtype.widget[widgetIdx].name).concat("Widget");
|
|
215
218
|
let widgetLabel = convertIntoPascalCase(COMPONENT_SCHEMA.subtype.widget[widgetIdx].name).concat(" Widget");
|
|
216
|
-
if (
|
|
217
|
-
widgetName =
|
|
219
|
+
if (widgetNameOriginal.indexOf("&") >= 0) {
|
|
220
|
+
widgetName = convertIntoPascalCase(widgetNameOriginal.replace(" & ", ""));
|
|
218
221
|
}
|
|
219
222
|
const componentName = "".concat(prefixNoSpace).concat(widgetName);
|
|
220
223
|
const componentLabel = "".concat(prefix).concat(" ").concat(widgetLabel);
|
|
@@ -302,7 +305,7 @@ export const validateCompile = async (
|
|
|
302
305
|
|
|
303
306
|
let componentsConstellation = await getComponents(false, CATEGORY_CONSTELLATION);
|
|
304
307
|
if (components.includes(componentKey)) {
|
|
305
|
-
console.log(chalk.red(`${componentKey}
|
|
308
|
+
console.log(chalk.red(`${componentKey} associated component already exists in ${targetDirectoryConstellation}`));
|
|
306
309
|
}
|
|
307
310
|
|
|
308
311
|
return;
|
|
@@ -310,7 +313,7 @@ export const validateCompile = async (
|
|
|
310
313
|
// test for constellation
|
|
311
314
|
const componentsConstellation = await getComponents(false, CATEGORY_CONSTELLATION);
|
|
312
315
|
if (componentsConstellation.includes(componentKey)) {
|
|
313
|
-
console.log(chalk.red(`${componentKey}
|
|
316
|
+
console.log(chalk.red(`${componentKey} associated component already exists in ${targetDirectoryConstellation}`));
|
|
314
317
|
return;
|
|
315
318
|
}
|
|
316
319
|
}
|
|
@@ -318,7 +321,7 @@ export const validateCompile = async (
|
|
|
318
321
|
// test for constellation
|
|
319
322
|
const componentsConstellation = await getComponents(false, CATEGORY_CONSTELLATION);
|
|
320
323
|
if (componentsConstellation.includes(componentKey)) {
|
|
321
|
-
console.log(chalk.red(`${componentKey}
|
|
324
|
+
console.log(chalk.red(`${componentKey} associated component already exists in ${targetDirectoryConstellation}`));
|
|
322
325
|
return;
|
|
323
326
|
}
|
|
324
327
|
}
|
|
@@ -368,7 +371,7 @@ export const validateCompile = async (
|
|
|
368
371
|
console.log(chalk.green(`created ${componentKey} component in ${targetDirectory}`));
|
|
369
372
|
}
|
|
370
373
|
|
|
371
|
-
console.log(chalk.green(`created ${componentKey}
|
|
374
|
+
console.log(chalk.green(`created ${componentKey} associated component in ${targetDirectoryConstellation}`));
|
|
372
375
|
|
|
373
376
|
};
|
|
374
377
|
|
package/src/tasks/index.js
CHANGED
|
@@ -14,4 +14,4 @@ export { default as authenticate } from './authenticate/index.js';
|
|
|
14
14
|
export { default as upgrade } from './upgrade/index.js';
|
|
15
15
|
export { default as buildComponent } from './build/index.js';
|
|
16
16
|
export { default as buildAllComponents } from './build-all/index.js';
|
|
17
|
-
export { default as
|
|
17
|
+
export { default as scanAndFix } from './scan-and-fix/index.js';
|
|
@@ -131,20 +131,20 @@ export const zipComponent = async (componentKey, category = CATEGORY_CUSTOM) =>
|
|
|
131
131
|
let configContent = "{ }";
|
|
132
132
|
if (category === CATEGORY_CUSTOM || category === CATEGORY_CONSTELLATION) {
|
|
133
133
|
configContent = Buffer.from(fs.readFileSync(`${srcDirectory}/config.json`)).toString();
|
|
134
|
-
fs.rm('dist', { recursive: true }, err => {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
});
|
|
134
|
+
//fs.rm('dist', { recursive: true }, err => {
|
|
135
|
+
// if (err) {
|
|
136
|
+
// throw err;
|
|
137
|
+
// }
|
|
138
|
+
//});
|
|
139
139
|
}
|
|
140
140
|
else {
|
|
141
141
|
if (fs.existsSync(configExtJson)) {
|
|
142
142
|
configContent = Buffer.from(fs.readFileSync(`${srcDirectory}/config-ext.json`)).toString();
|
|
143
|
-
fs.rm('dist', { recursive: true }, err => {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
});
|
|
143
|
+
//fs.rm('dist', { recursive: true }, err => {
|
|
144
|
+
// if (err) {
|
|
145
|
+
// throw err;
|
|
146
|
+
// }
|
|
147
|
+
//});
|
|
148
148
|
}
|
|
149
149
|
else {
|
|
150
150
|
const tempConfig = { "componentKey" : ""};
|
|
@@ -161,6 +161,14 @@ export const zipComponent = async (componentKey, category = CATEGORY_CUSTOM) =>
|
|
|
161
161
|
return { zipContent, configContent };
|
|
162
162
|
};
|
|
163
163
|
|
|
164
|
+
export const removeDist = async () => {
|
|
165
|
+
fs.rm('dist', { recursive: true }, err => {
|
|
166
|
+
if (err) {
|
|
167
|
+
throw err;
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
|
|
164
172
|
export const publishComponentToServer = async data => {
|
|
165
173
|
const { configContent, zipContent, rulesetName, rulesetVersion } = data;
|
|
166
174
|
let { componentKey } = data;
|
|
@@ -15,32 +15,12 @@ import { getPublishComponentQuestions,
|
|
|
15
15
|
zipComponent,
|
|
16
16
|
getBuildCategory,
|
|
17
17
|
mapConfigJsonToCompanion,
|
|
18
|
-
removeCompanionConfigJson
|
|
18
|
+
removeCompanionConfigJson,
|
|
19
|
+
removeDist
|
|
20
|
+
} from './helper.js';
|
|
19
21
|
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
export default async options => {
|
|
23
|
-
showVersion();
|
|
24
|
-
|
|
25
|
-
const catQuestion = await getBuildCategory(options);
|
|
26
|
-
const catAnwers = await inquirer.prompt(catQuestion);
|
|
27
|
-
|
|
28
|
-
let category = catAnwers.category;
|
|
29
|
-
if (category == null) {
|
|
30
|
-
category = getOptionsCategory(options);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const components = await getComponentsObj(false, category);
|
|
34
|
-
const questions = await getPublishComponentQuestions(category);
|
|
35
|
-
const answers = await inquirer.prompt(questions);
|
|
36
|
-
const {sourceMap, devBuild } = answers;
|
|
37
|
-
|
|
38
|
-
let content = {
|
|
39
|
-
...answers
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
var componentKey;
|
|
43
|
-
|
|
23
|
+
export function getCustomTasks(componentKey, category, sourceMap, devBuild, content, options) {
|
|
44
24
|
const customTasks = new Listr(
|
|
45
25
|
[
|
|
46
26
|
|
|
@@ -65,7 +45,7 @@ export default async options => {
|
|
|
65
45
|
}
|
|
66
46
|
},
|
|
67
47
|
{
|
|
68
|
-
title: 'Lint
|
|
48
|
+
title: 'Lint associated component',
|
|
69
49
|
task: async () => {
|
|
70
50
|
const targetDirectory = await getComponentDirectoryPath(componentKey, CATEGORY_CONSTELLATION);
|
|
71
51
|
// console.log(`in buildComponent Lint component task: componentKey: ${componentKey} targetDirectory: ${targetDirectory}`);
|
|
@@ -73,33 +53,33 @@ export default async options => {
|
|
|
73
53
|
}
|
|
74
54
|
},
|
|
75
55
|
{
|
|
76
|
-
title: 'Map config to
|
|
56
|
+
title: 'Map config to associated component',
|
|
77
57
|
task: async () => {
|
|
78
|
-
mapConfigJsonToCompanion(componentKey);
|
|
58
|
+
await mapConfigJsonToCompanion(componentKey);
|
|
79
59
|
}
|
|
80
60
|
},
|
|
81
61
|
{
|
|
82
|
-
title: 'Bundle
|
|
62
|
+
title: 'Bundle associated component',
|
|
83
63
|
task: async () => await bundleComponent(componentKey, sourceMap, devBuild, CATEGORY_CONSTELLATION),
|
|
84
64
|
skip: () => (options.skipBundle ? 'Skipped bundling component' : undefined)
|
|
85
65
|
},
|
|
86
66
|
{
|
|
87
|
-
title: 'Zip
|
|
67
|
+
title: 'Zip associated component',
|
|
88
68
|
task: async () => {
|
|
89
69
|
const output = await zipComponent(componentKey, CATEGORY_CONSTELLATION);
|
|
90
70
|
content = { ...content, ...output, componentKey };
|
|
91
71
|
}
|
|
92
72
|
},
|
|
93
73
|
{
|
|
94
|
-
title: 'Publish
|
|
74
|
+
title: 'Publish associated component',
|
|
95
75
|
task: async () => {
|
|
96
76
|
await publishComponentToServer(content);
|
|
97
77
|
}
|
|
98
78
|
},
|
|
99
79
|
{
|
|
100
|
-
title: 'Clean up
|
|
80
|
+
title: 'Clean up associated component',
|
|
101
81
|
task: async () => {
|
|
102
|
-
removeCompanionConfigJson(componentKey);
|
|
82
|
+
await removeCompanionConfigJson(componentKey);
|
|
103
83
|
}
|
|
104
84
|
}
|
|
105
85
|
],
|
|
@@ -108,6 +88,11 @@ export default async options => {
|
|
|
108
88
|
}
|
|
109
89
|
);
|
|
110
90
|
|
|
91
|
+
return customTasks;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export function getOverrideTasks(componentKey, category, sourceMap, devBuild, content, options) {
|
|
95
|
+
|
|
111
96
|
const overrideTasks = new Listr(
|
|
112
97
|
[
|
|
113
98
|
{
|
|
@@ -154,27 +139,68 @@ export default async options => {
|
|
|
154
139
|
}
|
|
155
140
|
);
|
|
156
141
|
|
|
142
|
+
return overrideTasks;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
export default async options => {
|
|
147
|
+
showVersion();
|
|
148
|
+
|
|
149
|
+
const catQuestion = await getBuildCategory(options);
|
|
150
|
+
const catAnwers = await inquirer.prompt(catQuestion);
|
|
151
|
+
|
|
152
|
+
let category = catAnwers.category;
|
|
153
|
+
if (category == null) {
|
|
154
|
+
category = getOptionsCategory(options);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const components = await getComponentsObj(false, category);
|
|
158
|
+
const questions = await getPublishComponentQuestions(category);
|
|
159
|
+
const answers = await inquirer.prompt(questions);
|
|
160
|
+
const {sourceMap, devBuild } = answers;
|
|
161
|
+
|
|
162
|
+
let content = {
|
|
163
|
+
...answers
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
var componentKey;
|
|
167
|
+
|
|
157
168
|
|
|
158
169
|
if (category === CATEGORY_CUSTOM) {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
170
|
+
|
|
171
|
+
for (var index in components) {
|
|
172
|
+
componentKey = components[index].value;
|
|
173
|
+
console.log(chalk.bold.green("Publishing: " + components[index].name));
|
|
174
|
+
|
|
175
|
+
let myCustomTasks = getCustomTasks(componentKey, category, sourceMap, devBuild, content, options);
|
|
176
|
+
|
|
177
|
+
await myCustomTasks.run().catch(err => {
|
|
178
|
+
console.log(chalk.bold.red(err.toString()));
|
|
164
179
|
});
|
|
165
|
-
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
|
|
166
185
|
}
|
|
167
186
|
else {
|
|
168
187
|
for (var index in components) {
|
|
169
188
|
componentKey = components[index].value;
|
|
170
189
|
console.log(chalk.bold.green("Publishing: " + components[index].name));
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
190
|
+
|
|
191
|
+
let myOverrideTasks = getOverrideTasks(componentKey, category, sourceMap, devBuild, content, options);
|
|
192
|
+
|
|
193
|
+
await myOverrideTasks.run().catch(err => {
|
|
194
|
+
console.log(chalk.bold.red(err.toString()));
|
|
195
|
+
});
|
|
174
196
|
}
|
|
197
|
+
|
|
175
198
|
}
|
|
176
199
|
|
|
177
200
|
|
|
201
|
+
// once done, remove leftover dist directory
|
|
202
|
+
removeDist();
|
|
203
|
+
|
|
178
204
|
|
|
179
205
|
return true;
|
|
180
206
|
};
|
|
@@ -23,7 +23,7 @@ const combinationTypes = ['PAGE', 'CASE'];
|
|
|
23
23
|
const allowedSubtypes = [
|
|
24
24
|
...new Set([
|
|
25
25
|
...COMPONENT_SCHEMA.subtype.field.map(({ value }) => value),
|
|
26
|
-
...COMPONENT_SCHEMA.subtype.template,
|
|
26
|
+
...COMPONENT_SCHEMA.subtype.template.map(({ value }) => value),
|
|
27
27
|
...COMPONENT_SCHEMA.subtype.widget.map(({ value }) => value)
|
|
28
28
|
])
|
|
29
29
|
];
|
|
@@ -32,7 +32,7 @@ const allowedSubtypes = [
|
|
|
32
32
|
const allowedOverrideSubtypes = [
|
|
33
33
|
...new Set([
|
|
34
34
|
...COMPONENT_SCHEMA.subtype.field.map(({ value }) => value),
|
|
35
|
-
...COMPONENT_SCHEMA.subtype.template,
|
|
35
|
+
...COMPONENT_SCHEMA.subtype.template.map(({ value }) => value),
|
|
36
36
|
...COMPONENT_SCHEMA.subtype.widget.map(({ value }) => value)
|
|
37
37
|
]), "ACTION", "DATA_CAPTURE", "SUMMARY", "CASEVIEW", "DATAVIEW", "LIST"
|
|
38
38
|
];
|
|
File without changes
|