@pega/dx-component-builder-sdk 0.1.5 → 0.1.7
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/constants.js +8 -4
- package/src/tasks/build/helper.js +4 -22
- package/src/tasks/build/index.js +54 -7
- package/src/tasks/bundle/index.js +2 -2
- package/src/tasks/create/index.js +50 -4
- package/src/tasks/create/templates/SDK-React/Field/Boolean/demo.stories.jsx.mustache +26 -14
- package/src/tasks/create/templates/SDK-React/Field/Boolean/mock.stories.js.mustache +15 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal/demo.stories.jsx.mustache +17 -10
- package/src/tasks/create/templates/SDK-React/Field/Decimal/mock.stories.js.mustache +14 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Currency/demo.stories.jsx.mustache +16 -10
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Currency/mock.stories.js.mustache +14 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Percentage/demo.stories.jsx.mustache +17 -10
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Percentage/mock.stories.js.mustache +14 -0
- package/src/tasks/create/templates/SDK-React/Field/Integer/demo.stories.jsx.mustache +16 -10
- package/src/tasks/create/templates/SDK-React/Field/Integer/mock.stories.js.mustache +14 -0
- package/src/tasks/create/templates/SDK-React/Field/Picklist/demo.stories.jsx.mustache +25 -16
- package/src/tasks/create/templates/SDK-React/Field/Picklist/mock.stories.js.mustache +30 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Phone/demo.stories.jsx.mustache +3 -1
- package/src/tasks/create/templates/SDK-React/Template/PAGE/demo.stories.jsx.mustache +79 -0
- package/src/tasks/create/templates/SDK-React/Template/PAGE/mock.stories.js.mustache +115 -0
- package/src/tasks/delete/helper.js +9 -24
- package/src/tasks/delete/index.js +2 -3
- package/src/tasks/delete-all/helper.js +9 -23
- package/src/tasks/delete-all/index.js +2 -3
- package/src/tasks/list/helper.js +3 -21
- package/src/tasks/list/index.js +2 -3
- package/src/tasks/map/map.js +4 -3
- package/src/tasks/override/index.js +13 -13
- package/src/tasks/publish/helper.js +77 -15
- package/src/tasks/publish/index.js +103 -15
- package/src/tasks/publish-all/helper.js +77 -13
- package/src/tasks/publish-all/index.js +109 -25
- package/src/tasks/validator/index.js +7 -5
- package/src/util.js +69 -17
package/src/util.js
CHANGED
|
@@ -34,7 +34,9 @@ import {
|
|
|
34
34
|
COMPONENT_PREFIX_TEMPLATES_PATH,
|
|
35
35
|
COMPONENT_PREFIX_WIDGETS_PATH,
|
|
36
36
|
COMPONENT_PREFIX_DSE_PATH,
|
|
37
|
-
COMPONENT_PREFIX_INFRA_PATH
|
|
37
|
+
COMPONENT_PREFIX_INFRA_PATH,
|
|
38
|
+
CATEGORY_CUSTOM,
|
|
39
|
+
CATEGORY_OVERRIDE
|
|
38
40
|
} from './constants.js';
|
|
39
41
|
|
|
40
42
|
|
|
@@ -54,7 +56,7 @@ export const checkPathAccess = async (path, options = {}) => {
|
|
|
54
56
|
}
|
|
55
57
|
};
|
|
56
58
|
|
|
57
|
-
export const deleteLocalComponent = async (componentKey, category =
|
|
59
|
+
export const deleteLocalComponent = async (componentKey, category = CATEGORY_CUSTOM) => {
|
|
58
60
|
const currentDirectory = process.cwd();
|
|
59
61
|
const pegaConfigJsonPath = join(currentDirectory, DXCB_CONFIG_JSON_FILENAME);
|
|
60
62
|
const categoryDirectory = join("/", category.toLowerCase());
|
|
@@ -73,16 +75,22 @@ export const deleteLocalComponent = async (componentKey, category = "custom") =>
|
|
|
73
75
|
|
|
74
76
|
const directory = join(currentDirectory, data[COMPONENTS_DIRECTORY_PATH], categoryDirectory, componentKey);
|
|
75
77
|
|
|
76
|
-
//
|
|
77
|
-
fs.
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
// test for the directory
|
|
79
|
+
if (fs.existsSync(directory)) {
|
|
80
|
+
//fs.rmdir(directory, { recursive: true }, err => {
|
|
81
|
+
fs.rm(directory, { recursive: true }, err => {
|
|
82
|
+
if (err) {
|
|
83
|
+
throw err;
|
|
84
|
+
}
|
|
81
85
|
|
|
82
|
-
|
|
86
|
+
console.log(`${chalk.red.bold(componentKey)} is deleted from Local ${category} `);
|
|
83
87
|
|
|
84
88
|
|
|
85
|
-
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
console.log(`${chalk.red.bold(componentKey)} is NOT FOUND from Local ${category} `);
|
|
93
|
+
}
|
|
86
94
|
};
|
|
87
95
|
|
|
88
96
|
export const deleteServerComponent = async componentKey => {
|
|
@@ -122,7 +130,26 @@ export const deleteServerComponent = async componentKey => {
|
|
|
122
130
|
}
|
|
123
131
|
};
|
|
124
132
|
|
|
125
|
-
export const
|
|
133
|
+
export const getOptionsCategory = (options) => {
|
|
134
|
+
let categoryType = null;
|
|
135
|
+
if (options.params[3]) {
|
|
136
|
+
let catType = options.params[3];
|
|
137
|
+
|
|
138
|
+
switch (catType.toLowerCase()) {
|
|
139
|
+
case "override" :
|
|
140
|
+
case "o" :
|
|
141
|
+
categoryType = "override";
|
|
142
|
+
break;
|
|
143
|
+
case "custom" :
|
|
144
|
+
case "c" :
|
|
145
|
+
categoryType = "custom";
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return categoryType;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export const getComponents = async (showSeparator = false, category = CATEGORY_CUSTOM) => {
|
|
126
153
|
const currentDirectory = process.cwd();
|
|
127
154
|
const pegaConfigJsonPath = join(currentDirectory, DXCB_CONFIG_JSON_FILENAME);
|
|
128
155
|
const categoryDirectory = join("/", category.toLowerCase());
|
|
@@ -144,7 +171,7 @@ export const getComponents = async (showSeparator = false, category = "custom")
|
|
|
144
171
|
let compList = new Array();
|
|
145
172
|
|
|
146
173
|
switch (category) {
|
|
147
|
-
case
|
|
174
|
+
case CATEGORY_CUSTOM:
|
|
148
175
|
const fieldComps = await getSubComponents(directory, FIELD_PATH);
|
|
149
176
|
const templateComps = await getSubComponents(directory, TEMPLATE_PATH);
|
|
150
177
|
const widgetComps = await getSubComponents(directory, WIDGET_PATH);
|
|
@@ -166,7 +193,7 @@ export const getComponents = async (showSeparator = false, category = "custom")
|
|
|
166
193
|
compList.push(...widgetComps);
|
|
167
194
|
}
|
|
168
195
|
break;
|
|
169
|
-
case
|
|
196
|
+
case CATEGORY_OVERRIDE:
|
|
170
197
|
const formsComps = await getSubComponents(directory, FORMS_PATH);
|
|
171
198
|
const templatesComps = await getSubComponents(directory, TEMPLATES_PATH);
|
|
172
199
|
const widgetsComps = await getSubComponents(directory, WIDGETS_PATH);
|
|
@@ -217,7 +244,30 @@ export const getSubComponents = async (directory, type) => {
|
|
|
217
244
|
.map(dirent => dirent.name);
|
|
218
245
|
}
|
|
219
246
|
|
|
220
|
-
|
|
247
|
+
|
|
248
|
+
export const getDirectoryFiles = async (directory) => {
|
|
249
|
+
return fs
|
|
250
|
+
.readdirSync(directory, { withFileTypes: true })
|
|
251
|
+
.filter(dirent => !dirent.isDirectory())
|
|
252
|
+
.map(dirent => dirent.name);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/*
|
|
256
|
+
export const createBlankConfigExt = async (directory, name) => {
|
|
257
|
+
|
|
258
|
+
let fileData = "{";
|
|
259
|
+
fileData = fileData.concat("\n\t");
|
|
260
|
+
fileData = fileData.concat("\"name\" : \"");
|
|
261
|
+
fileData = fileData.concat(`${name}`);
|
|
262
|
+
fileData = fileData.concat("\", \n\t");
|
|
263
|
+
fileData = fileData.concat("\"properties\" : [ ] \n");
|
|
264
|
+
fileData = fileData.concat("}");
|
|
265
|
+
return fs.writeFileSync( join(directory, "/config-ext.json"), fileData, { encoding: 'utf8' });
|
|
266
|
+
}
|
|
267
|
+
*/
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
export const getComponentsObj = async (showSeparator = false, category = CATEGORY_CUSTOM) => {
|
|
221
271
|
const currentDirectory = process.cwd();
|
|
222
272
|
const pegaConfigJsonPath = join(currentDirectory, DXCB_CONFIG_JSON_FILENAME);
|
|
223
273
|
const categoryDirectory = join("/", category.toLowerCase());
|
|
@@ -238,7 +288,7 @@ export const getComponentsObj = async (showSeparator = false, category = "custom
|
|
|
238
288
|
let compList = new Array();
|
|
239
289
|
|
|
240
290
|
switch (category) {
|
|
241
|
-
case
|
|
291
|
+
case CATEGORY_CUSTOM:
|
|
242
292
|
const fieldComps = await getSubComponents(directory, FIELD_PATH);
|
|
243
293
|
const templateComps = await getSubComponents(directory, TEMPLATE_PATH);
|
|
244
294
|
const widgetComps = await getSubComponents(directory, WIDGET_PATH);
|
|
@@ -283,7 +333,7 @@ export const getComponentsObj = async (showSeparator = false, category = "custom
|
|
|
283
333
|
));
|
|
284
334
|
}
|
|
285
335
|
break;
|
|
286
|
-
case
|
|
336
|
+
case CATEGORY_OVERRIDE:
|
|
287
337
|
const formsComps = await getSubComponents(directory, FORMS_PATH);
|
|
288
338
|
const templatesComps = await getSubComponents(directory, TEMPLATES_PATH);
|
|
289
339
|
const widgetsComps = await getSubComponents(directory, WIDGETS_PATH);
|
|
@@ -375,7 +425,9 @@ export const getSubComponentsAndDir = async (directory, type) => {
|
|
|
375
425
|
.map(dirent => prefix + dirent.name);
|
|
376
426
|
}
|
|
377
427
|
|
|
378
|
-
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
export const getComponentsAndSubDirectory = async (category = CATEGORY_CUSTOM) => {
|
|
379
431
|
const currentDirectory = process.cwd();
|
|
380
432
|
const pegaConfigJsonPath = join(currentDirectory, DXCB_CONFIG_JSON_FILENAME);
|
|
381
433
|
const categoryDirectory = join("/", category.toLowerCase());
|
|
@@ -459,7 +511,7 @@ export const getComponentDefaults = async () => {
|
|
|
459
511
|
return config.component;
|
|
460
512
|
};
|
|
461
513
|
|
|
462
|
-
export const getComponentDirectoryPath = async (componentKey, category =
|
|
514
|
+
export const getComponentDirectoryPath = async (componentKey, category = CATEGORY_CUSTOM) => {
|
|
463
515
|
const currentDirectory = process.cwd();
|
|
464
516
|
const pegaConfigJsonPath = join(currentDirectory, DXCB_CONFIG_JSON_FILENAME);
|
|
465
517
|
const categoryDirectory = join("/", category.toLowerCase());
|