@pega/dx-component-builder-sdk 0.1.29 → 0.1.31
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/pega-dx-component-builder-sdk-0.1.31.tgz +0 -0
- package/src/cli.js +4 -4
- package/src/constants.js +1 -0
- package/src/tasks/create/templates/SDK-React/field/Boolean/index.tsx.mustache +0 -1
- package/src/tasks/create/templates/SDK-React/template/DETAILS/demo.stories.jsx.mustache +49 -487
- package/src/tasks/create/templates/SDK-React/template/DETAILS/index.tsx.mustache +70 -26
- package/src/tasks/create/templates/SDK-React/template/DETAILS/mock.stories.js.mustache +281 -21
- package/src/tasks/create/templates/SDK-React/template/DETAILS-region/demo.stories.jsx.mustache +42 -1076
- package/src/tasks/create/templates/SDK-React/template/DETAILS-region/index.tsx.mustache +67 -31
- package/src/tasks/create/templates/SDK-React/template/DETAILS-region/mock.stories.js.mustache +281 -25
- package/src/tasks/create/templates/SDK-React/template/FORM/demo.stories.jsx.mustache +17 -2
- package/src/tasks/create/templates/SDK-React/template/FORM/index.tsx.mustache +22 -22
- package/src/tasks/create/templates/SDK-React/template/FORM/utils.ts.mustache +76 -0
- package/src/tasks/create/templates/SDK-React/template/PAGE/demo.stories.jsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-React/widget/PAGE-CASE/demo.stories.jsx.mustache +8 -1
- package/src/tasks/create/templates/SDK-React/widget/PAGE-CASE/index.tsx.mustache +37 -11
- package/src/tasks/create-all/index.js +6 -5
- package/src/tasks/delete/helper.js +13 -1
- package/src/tasks/delete-all/helper.js +13 -1
- package/src/tasks/index.js +1 -1
- package/src/tasks/map/map.js +3 -2
- package/src/tasks/publish-all/helper.js +18 -10
- package/src/tasks/publish-all/index.js +63 -40
- package/src/util.js +22 -7
- /package/src/tasks/{generate-missing-companions → scan-and-fix}/index.js +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable react/no-unused-prop-types */
|
|
1
2
|
import React, {useState} from "react";
|
|
2
3
|
import PropTypes from "prop-types";
|
|
3
4
|
import TextField from '@material-ui/core/TextField';
|
|
@@ -31,25 +32,33 @@ const useStyles = makeStyles((theme) => ({
|
|
|
31
32
|
// any default values in config.pros should be set in defaultProps at bottom of this file
|
|
32
33
|
export default function {{COMPONENT_CLASS_NAME}}(props) {
|
|
33
34
|
// const componentName = "Operator";
|
|
34
|
-
const {
|
|
35
|
+
const {
|
|
36
|
+
label,
|
|
37
|
+
createLabel,
|
|
38
|
+
updateLabel,
|
|
39
|
+
createOperator,
|
|
40
|
+
updateOperator,
|
|
41
|
+
createDateTime,
|
|
42
|
+
updateDateTime
|
|
43
|
+
} = props;
|
|
35
44
|
const classes = useStyles();
|
|
36
45
|
|
|
37
|
-
const fieldLabel =
|
|
46
|
+
const fieldLabel = label.toLowerCase();
|
|
38
47
|
let caseOpLabel = "---";
|
|
39
48
|
let caseOpName = "---";
|
|
40
49
|
let caseOpId = "";
|
|
41
50
|
let caseTime = null;
|
|
42
51
|
|
|
43
52
|
if (fieldLabel === "create operator") {
|
|
44
|
-
caseOpLabel =
|
|
45
|
-
caseOpName =
|
|
46
|
-
caseTime =
|
|
47
|
-
caseOpId =
|
|
53
|
+
caseOpLabel = createLabel;
|
|
54
|
+
caseOpName = createOperator.userName;
|
|
55
|
+
caseTime = createDateTime;
|
|
56
|
+
caseOpId = createOperator.userId;
|
|
48
57
|
} else if (fieldLabel === "update operator") {
|
|
49
|
-
caseOpLabel =
|
|
50
|
-
caseOpName =
|
|
51
|
-
caseTime =
|
|
52
|
-
caseOpId =
|
|
58
|
+
caseOpLabel = updateLabel;
|
|
59
|
+
caseOpName = updateOperator.userName;
|
|
60
|
+
caseTime = updateDateTime;
|
|
61
|
+
caseOpId = updateOperator.userId;
|
|
53
62
|
}
|
|
54
63
|
|
|
55
64
|
// Popover-related
|
|
@@ -204,8 +213,25 @@ export default function {{COMPONENT_CLASS_NAME}}(props) {
|
|
|
204
213
|
}
|
|
205
214
|
|
|
206
215
|
{{COMPONENT_CLASS_NAME}}.defaultProps = {
|
|
216
|
+
createLabel: null,
|
|
217
|
+
updateLabel: null,
|
|
218
|
+
createOperator: null,
|
|
219
|
+
updateOperator: null,
|
|
220
|
+
createDateTime: null,
|
|
221
|
+
updateDateTime: null
|
|
207
222
|
};
|
|
208
223
|
|
|
209
224
|
{{COMPONENT_CLASS_NAME}}.propTypes = {
|
|
210
|
-
|
|
225
|
+
getPConnect: PropTypes.func.isRequired,
|
|
226
|
+
label: PropTypes.string,
|
|
227
|
+
createLabel: PropTypes.string,
|
|
228
|
+
updateLabel: PropTypes.string,
|
|
229
|
+
resolveLabel: PropTypes.string,
|
|
230
|
+
createOperator: PropTypes.objectOf(PropTypes.any),
|
|
231
|
+
updateOperator: PropTypes.objectOf(PropTypes.any),
|
|
232
|
+
resolveOperator: PropTypes.objectOf(PropTypes.any),
|
|
233
|
+
createDateTime: PropTypes.string,
|
|
234
|
+
updateDateTime: PropTypes.string,
|
|
235
|
+
resolveDateTime: PropTypes.string,
|
|
236
|
+
hideLabel: PropTypes.bool
|
|
211
237
|
};
|
|
@@ -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
|
|
|
@@ -19,6 +19,18 @@ export const SOURCE_OF_COMPONENT_TYPES = {
|
|
|
19
19
|
LOCAL: 'Local'
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
+
export const visualLCCategory = (category) => {
|
|
23
|
+
|
|
24
|
+
switch (category) {
|
|
25
|
+
case CATEGORY_CONSTELLATION :
|
|
26
|
+
return "custom-".concat(category.toLowerCase());
|
|
27
|
+
case CATEGORY_CUSTOM :
|
|
28
|
+
case CATEGORY_OVERRIDE :
|
|
29
|
+
return category.toLowerCase().concat("-sdk");
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return category.toLowerCase();
|
|
33
|
+
}
|
|
22
34
|
|
|
23
35
|
export const getDeleteComponentsQuestions = async (options, sourceOfComponentsOption) => {
|
|
24
36
|
const defaultPegaServerConfig = await getPegaServerConfig();
|
|
@@ -83,7 +95,7 @@ export const deleteLocalComponents = async (sourceOfComponents, category = CATEG
|
|
|
83
95
|
}
|
|
84
96
|
}
|
|
85
97
|
} else {
|
|
86
|
-
const categoryLC = category
|
|
98
|
+
const categoryLC = visualLCCategory(category);
|
|
87
99
|
console.log(chalk.bold.redBright(`No ${categoryLC} components in ${sourceOfComponents}`));
|
|
88
100
|
}
|
|
89
101
|
};
|
|
@@ -20,6 +20,18 @@ export const SOURCE_OF_COMPONENT_TYPES = {
|
|
|
20
20
|
LOCAL: 'Local'
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
+
export const visualLCCategory = (category) => {
|
|
24
|
+
|
|
25
|
+
switch (category) {
|
|
26
|
+
case CATEGORY_CONSTELLATION :
|
|
27
|
+
return "custom-".concat(category.toLowerCase());
|
|
28
|
+
case CATEGORY_CUSTOM :
|
|
29
|
+
case CATEGORY_OVERRIDE :
|
|
30
|
+
return category.toLowerCase().concat("-sdk");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return category.toLowerCase();
|
|
34
|
+
}
|
|
23
35
|
|
|
24
36
|
export const getDeleteComponentsQuestions = async (options, sourceOfComponentsOption) => {
|
|
25
37
|
const defaultPegaServerConfig = await getPegaServerConfig();
|
|
@@ -93,7 +105,7 @@ export const deleteLocalComponents = async (sourceOfComponents, category = CATEG
|
|
|
93
105
|
}
|
|
94
106
|
}
|
|
95
107
|
} else {
|
|
96
|
-
const categoryLC = category
|
|
108
|
+
const categoryLC = visualLCCategory(category);
|
|
97
109
|
console.log(chalk.bold.redBright(`No ${categoryLC} components in ${sourceOfComponents}`));
|
|
98
110
|
}
|
|
99
111
|
};
|
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';
|
package/src/tasks/map/map.js
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
CATEGORY_CUSTOM,
|
|
15
15
|
CATEGORY_CONSTELLATION,
|
|
16
16
|
COMPONENT_DIRECTORY_PREFIX_CUSTOM,
|
|
17
|
+
COMPONENT_DIRECTORY_SUFFIX_SDK,
|
|
17
18
|
DXCB_CONFIG
|
|
18
19
|
} from '../../constants.js';
|
|
19
20
|
|
|
@@ -25,7 +26,7 @@ export const updateComponentMap = async (componentKey, category = CATEGORY_CUSTO
|
|
|
25
26
|
|
|
26
27
|
const pegaConfigJsonPath = path.join(path.resolve(), SDK_CONFIG_JSON_FILENAME);
|
|
27
28
|
const pegaLocalComponentMapPath = path.join(path.resolve(), SDK_LOCAL_COMPONENT_MAP_FILENAME);
|
|
28
|
-
const categoryDirectory = (category === CATEGORY_CONSTELLATION) ? join("/", COMPONENT_DIRECTORY_PREFIX_CUSTOM + category.toLowerCase()) : join("/", category.toLowerCase());
|
|
29
|
+
const categoryDirectory = (category === CATEGORY_CONSTELLATION) ? join("/", COMPONENT_DIRECTORY_PREFIX_CUSTOM + category.toLowerCase()) : join("/", category.toLowerCase() + COMPONENT_DIRECTORY_SUFFIX_SDK);
|
|
29
30
|
|
|
30
31
|
const componentNameNoPrefix = removeComponentPrefix(componentKey);
|
|
31
32
|
const componentName = convertIntoPascalCase(componentNameNoPrefix);
|
|
@@ -68,7 +69,7 @@ export const updateComponentMap = async (componentKey, category = CATEGORY_CUSTO
|
|
|
68
69
|
|
|
69
70
|
export const deleteFromComponentMap = async (componentKey, category = CATEGORY_CUSTOM) => {
|
|
70
71
|
const pegaLocalComponentMapPath = path.join(path.resolve(), SDK_LOCAL_COMPONENT_MAP_FILENAME);
|
|
71
|
-
const categoryDirectory = (category === CATEGORY_CONSTELLATION) ? join("/", COMPONENT_DIRECTORY_PREFIX_CUSTOM + category.toLowerCase()) : join("/", category.toLowerCase());
|
|
72
|
+
const categoryDirectory = (category === CATEGORY_CONSTELLATION) ? join("/", COMPONENT_DIRECTORY_PREFIX_CUSTOM + category.toLowerCase()) : join("/", category.toLowerCase() + COMPONENT_DIRECTORY_SUFFIX_SDK);
|
|
72
73
|
const pegaConfigJsonPath = path.join(path.resolve(), SDK_CONFIG_JSON_FILENAME);
|
|
73
74
|
|
|
74
75
|
const componentNameNoPrefix = removeComponentPrefix(componentKey);
|
|
@@ -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,65 @@ 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
|
-
|
|
164
|
-
|
|
165
|
-
|
|
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()));
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
|
|
166
182
|
}
|
|
167
183
|
else {
|
|
168
184
|
for (var index in components) {
|
|
169
185
|
componentKey = components[index].value;
|
|
170
186
|
console.log(chalk.bold.green("Publishing: " + components[index].name));
|
|
171
|
-
|
|
172
|
-
|
|
187
|
+
|
|
188
|
+
let myOverrideTasks = getOverrideTasks(componentKey, category, sourceMap, devBuild, content, options);
|
|
189
|
+
|
|
190
|
+
await myOverrideTasks.run().catch(err => {
|
|
191
|
+
console.log(chalk.bold.red(err.toString()));
|
|
173
192
|
});
|
|
174
193
|
}
|
|
194
|
+
|
|
175
195
|
}
|
|
176
196
|
|
|
177
197
|
|
|
198
|
+
// once done, remove leftover dist directory
|
|
199
|
+
removeDist();
|
|
200
|
+
|
|
178
201
|
|
|
179
202
|
return true;
|
|
180
203
|
};
|
package/src/util.js
CHANGED
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
CATEGORY_OVERRIDE,
|
|
34
34
|
CATEGORY_CONSTELLATION,
|
|
35
35
|
COMPONENT_DIRECTORY_PREFIX_CUSTOM,
|
|
36
|
+
COMPONENT_DIRECTORY_SUFFIX_SDK,
|
|
36
37
|
DXCB_COMPONENT_DEFAULTS,
|
|
37
38
|
SERVER_CONFIG,
|
|
38
39
|
SERVER_REST_URL
|
|
@@ -55,10 +56,23 @@ export const checkPathAccess = async (path, options = {}) => {
|
|
|
55
56
|
}
|
|
56
57
|
};
|
|
57
58
|
|
|
59
|
+
export const visualLCCategory = (category) => {
|
|
60
|
+
|
|
61
|
+
switch (category) {
|
|
62
|
+
case CATEGORY_CONSTELLATION :
|
|
63
|
+
return "custom-".concat(category.toLowerCase());
|
|
64
|
+
case CATEGORY_CUSTOM :
|
|
65
|
+
case CATEGORY_OVERRIDE :
|
|
66
|
+
return category.toLowerCase().concat("-sdk");
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return category.toLowerCase();
|
|
70
|
+
}
|
|
71
|
+
|
|
58
72
|
export const deleteLocalComponent = async (componentKey, category = CATEGORY_CUSTOM) => {
|
|
59
73
|
const currentDirectory = process.cwd();
|
|
60
74
|
const pegaConfigJsonPath = join(currentDirectory, SDK_CONFIG_JSON_FILENAME);
|
|
61
|
-
const categoryDirectory = (category === CATEGORY_CONSTELLATION) ? join("/", COMPONENT_DIRECTORY_PREFIX_CUSTOM + category.toLowerCase()) : join("/", category.toLowerCase());
|
|
75
|
+
const categoryDirectory = (category === CATEGORY_CONSTELLATION) ? join("/", COMPONENT_DIRECTORY_PREFIX_CUSTOM + category.toLowerCase()) : join("/", category.toLowerCase() + COMPONENT_DIRECTORY_SUFFIX_SDK);
|
|
62
76
|
|
|
63
77
|
await checkPathAccess(pegaConfigJsonPath);
|
|
64
78
|
|
|
@@ -76,14 +90,15 @@ export const deleteLocalComponent = async (componentKey, category = CATEGORY_CUS
|
|
|
76
90
|
throw err;
|
|
77
91
|
}
|
|
78
92
|
|
|
79
|
-
const sCat = (category
|
|
93
|
+
const sCat = visualLCCategory(category);
|
|
80
94
|
console.log(`${chalk.red.bold(componentKey)} is deleted from Local ${sCat} `);
|
|
81
95
|
|
|
82
96
|
|
|
83
97
|
});
|
|
84
98
|
}
|
|
85
99
|
else {
|
|
86
|
-
|
|
100
|
+
const categoryLC = visualLCCategory(category);
|
|
101
|
+
console.log(`${chalk.red.bold(componentKey)} is NOT FOUND from Local ${categoryLC} `);
|
|
87
102
|
}
|
|
88
103
|
};
|
|
89
104
|
|
|
@@ -165,7 +180,7 @@ export const getOptionsSource = (options) => {
|
|
|
165
180
|
export const getComponents = async (showSeparator = false, category = CATEGORY_CUSTOM) => {
|
|
166
181
|
const currentDirectory = process.cwd();
|
|
167
182
|
const pegaConfigJsonPath = join(currentDirectory, SDK_CONFIG_JSON_FILENAME);
|
|
168
|
-
const categoryDirectory = (category === CATEGORY_CONSTELLATION) ? join("/", COMPONENT_DIRECTORY_PREFIX_CUSTOM + category.toLowerCase()) : join("/", category.toLowerCase());
|
|
183
|
+
const categoryDirectory = (category === CATEGORY_CONSTELLATION) ? join("/", COMPONENT_DIRECTORY_PREFIX_CUSTOM + category.toLowerCase()) : join("/", category.toLowerCase() + COMPONENT_DIRECTORY_SUFFIX_SDK);
|
|
169
184
|
|
|
170
185
|
await checkPathAccess(pegaConfigJsonPath);
|
|
171
186
|
|
|
@@ -262,7 +277,7 @@ export const getDirectoryFiles = async (directory) => {
|
|
|
262
277
|
export const getComponentsObj = async (showSeparator = false, category = CATEGORY_CUSTOM) => {
|
|
263
278
|
const currentDirectory = process.cwd();
|
|
264
279
|
const pegaConfigJsonPath = join(currentDirectory, SDK_CONFIG_JSON_FILENAME);
|
|
265
|
-
const categoryDirectory = (category === CATEGORY_CONSTELLATION) ? join("/", COMPONENT_DIRECTORY_PREFIX_CUSTOM + category.toLowerCase()) : join("/", category.toLowerCase());
|
|
280
|
+
const categoryDirectory = (category === CATEGORY_CONSTELLATION) ? join("/", COMPONENT_DIRECTORY_PREFIX_CUSTOM + category.toLowerCase()) : join("/", category.toLowerCase() + COMPONENT_DIRECTORY_SUFFIX_SDK);
|
|
266
281
|
|
|
267
282
|
await checkPathAccess(pegaConfigJsonPath);
|
|
268
283
|
|
|
@@ -415,7 +430,7 @@ export const getSubComponentsAndDir = async (directory, type) => {
|
|
|
415
430
|
export const getComponentsAndSubDirectory = async (category = CATEGORY_CUSTOM) => {
|
|
416
431
|
const currentDirectory = process.cwd();
|
|
417
432
|
const pegaConfigJsonPath = join(currentDirectory, SDK_CONFIG_JSON_FILENAME);
|
|
418
|
-
const categoryDirectory = (category === CATEGORY_CONSTELLATION) ? join("/", COMPONENT_DIRECTORY_PREFIX_CUSTOM + category.toLowerCase()) : join("/", category.toLowerCase());
|
|
433
|
+
const categoryDirectory = (category === CATEGORY_CONSTELLATION) ? join("/", COMPONENT_DIRECTORY_PREFIX_CUSTOM + category.toLowerCase()) : join("/", category.toLowerCase() + COMPONENT_DIRECTORY_SUFFIX_SDK);
|
|
419
434
|
|
|
420
435
|
await checkPathAccess(pegaConfigJsonPath);
|
|
421
436
|
|
|
@@ -484,7 +499,7 @@ export const getComponentDefaults = async () => {
|
|
|
484
499
|
export const getComponentDirectoryPath = async (componentKey, category = CATEGORY_CUSTOM) => {
|
|
485
500
|
const currentDirectory = process.cwd();
|
|
486
501
|
const pegaConfigJsonPath = join(currentDirectory, SDK_CONFIG_JSON_FILENAME);
|
|
487
|
-
const categoryDirectory = (category === CATEGORY_CONSTELLATION) ? join("/", COMPONENT_DIRECTORY_PREFIX_CUSTOM + category.toLowerCase()) : join("/", category.toLowerCase());
|
|
502
|
+
const categoryDirectory = (category === CATEGORY_CONSTELLATION) ? join("/", COMPONENT_DIRECTORY_PREFIX_CUSTOM + category.toLowerCase()) : join("/", category.toLowerCase() + COMPONENT_DIRECTORY_SUFFIX_SDK);
|
|
488
503
|
|
|
489
504
|
await checkPathAccess(pegaConfigJsonPath);
|
|
490
505
|
|
|
File without changes
|