@pega/dx-component-builder-sdk 0.1.29 → 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 +6 -5
- package/src/tasks/index.js +1 -1
- package/src/tasks/publish-all/helper.js +18 -10
- package/src/tasks/publish-all/index.js +66 -40
- /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
|
|
|
@@ -304,7 +305,7 @@ export const validateCompile = async (
|
|
|
304
305
|
|
|
305
306
|
let componentsConstellation = await getComponents(false, CATEGORY_CONSTELLATION);
|
|
306
307
|
if (components.includes(componentKey)) {
|
|
307
|
-
console.log(chalk.red(`${componentKey}
|
|
308
|
+
console.log(chalk.red(`${componentKey} associated component already exists in ${targetDirectoryConstellation}`));
|
|
308
309
|
}
|
|
309
310
|
|
|
310
311
|
return;
|
|
@@ -312,7 +313,7 @@ export const validateCompile = async (
|
|
|
312
313
|
// test for constellation
|
|
313
314
|
const componentsConstellation = await getComponents(false, CATEGORY_CONSTELLATION);
|
|
314
315
|
if (componentsConstellation.includes(componentKey)) {
|
|
315
|
-
console.log(chalk.red(`${componentKey}
|
|
316
|
+
console.log(chalk.red(`${componentKey} associated component already exists in ${targetDirectoryConstellation}`));
|
|
316
317
|
return;
|
|
317
318
|
}
|
|
318
319
|
}
|
|
@@ -320,7 +321,7 @@ export const validateCompile = async (
|
|
|
320
321
|
// test for constellation
|
|
321
322
|
const componentsConstellation = await getComponents(false, CATEGORY_CONSTELLATION);
|
|
322
323
|
if (componentsConstellation.includes(componentKey)) {
|
|
323
|
-
console.log(chalk.red(`${componentKey}
|
|
324
|
+
console.log(chalk.red(`${componentKey} associated component already exists in ${targetDirectoryConstellation}`));
|
|
324
325
|
return;
|
|
325
326
|
}
|
|
326
327
|
}
|
|
@@ -370,7 +371,7 @@ export const validateCompile = async (
|
|
|
370
371
|
console.log(chalk.green(`created ${componentKey} component in ${targetDirectory}`));
|
|
371
372
|
}
|
|
372
373
|
|
|
373
|
-
console.log(chalk.green(`created ${componentKey}
|
|
374
|
+
console.log(chalk.green(`created ${componentKey} associated component in ${targetDirectoryConstellation}`));
|
|
374
375
|
|
|
375
376
|
};
|
|
376
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,31 +53,31 @@ 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
82
|
await removeCompanionConfigJson(componentKey);
|
|
103
83
|
}
|
|
@@ -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
|
};
|
|
File without changes
|