@pega/dx-component-builder-sdk 0.1.13 → 0.1.15

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/dx-component-builder-sdk",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "description": "Utility for building custom UI components",
5
5
  "bin": "./bin/index.js",
6
6
  "scripts": {
package/src/cli.js CHANGED
@@ -9,6 +9,7 @@ import {
9
9
  deleteAllComponents,
10
10
  generateMissingCompanions,
11
11
  listComponents,
12
+ mapAllComponents,
12
13
  overrideComponent,
13
14
  publishComponent,
14
15
  publishAllComponents,
@@ -21,6 +22,7 @@ const TASKS = {
21
22
  CREATE: 'create',
22
23
  OVERRIDE: 'override',
23
24
  BUILD: 'buildComponent',
25
+ MAP_ALL: "mapAll",
24
26
  PUBLISH: 'publish',
25
27
  PUBLISH_All: 'publishAll',
26
28
  LIST: 'list',
@@ -64,6 +66,10 @@ export default async (args = []) => {
64
66
  overrideComponent(options);
65
67
  break;
66
68
  }
69
+ case TASKS.MAP_ALL: {
70
+ mapAllComponents(options);
71
+ break;
72
+ }
67
73
  case TASKS.PUBLISH: {
68
74
  publishComponent(options);
69
75
  break;
package/src/constants.js CHANGED
@@ -323,10 +323,6 @@ export const COMPONENT_SCHEMA = {
323
323
  name: 'Stages',
324
324
  value: 'Stages'
325
325
  },
326
- {
327
- name: 'To Do',
328
- value: 'ToDo'
329
- },
330
326
  {
331
327
  name: 'Vertical Tabs',
332
328
  value: 'VerticalTabs/VerticalTabs'
@@ -518,6 +514,10 @@ export const COMPONENT_SCHEMA = {
518
514
  {
519
515
  name: 'Summary List',
520
516
  value: 'SummaryList'
517
+ },
518
+ {
519
+ name: 'To Do',
520
+ value: 'ToDo'
521
521
  }
522
522
  ],
523
523
  }
@@ -2,6 +2,7 @@ export { default as createComponent } from './create/index.js';
2
2
  export { default as overrideComponent } from './override/index.js';
3
3
  export { default as deleteComponent } from './delete/index.js';
4
4
  export { default as deleteAllComponents } from './delete-all/index.js';
5
+ export { default as mapAllComponents } from './map-all/index.js';
5
6
  export { default as publishComponent } from './publish/index.js';
6
7
  export { default as publishAllComponents } from './publish-all/index.js';
7
8
  export { default as listComponents } from './list/index.js';
@@ -0,0 +1,31 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import https from 'https';
4
+
5
+ import fetch from 'node-fetch';
6
+ import AdmZip from 'adm-zip';
7
+ import chalk from 'chalk';
8
+
9
+ import {
10
+ getComponentDirectoryPath,
11
+ getOptionsCategory
12
+ } from '../../util.js';
13
+ import { COMPONENT_SCHEMA, CATEGORY_CONSTELLATION, CATEGORY_CUSTOM } from '../../constants.js';
14
+
15
+
16
+
17
+ export const getBuildCategory = async (options) => {
18
+ const categoryType = getOptionsCategory(options);
19
+
20
+ return [
21
+ {
22
+ name: 'category',
23
+ type: 'rawlist',
24
+ message: 'Category of components ?',
25
+ choices: COMPONENT_SCHEMA.category,
26
+ when() {
27
+ return !options.params[4] && categoryType == null;
28
+ }
29
+ }
30
+ ];
31
+ };
@@ -0,0 +1,58 @@
1
+ import inquirer from 'inquirer';
2
+ import Listr from 'listr';
3
+ import chalk from 'chalk';
4
+
5
+ import validate from '../validator/index.js';
6
+ import { showVersion, getOptionsCategory, getComponentsObj } from '../../util.js';
7
+ import { updateComponentMap } from '../map/map.js';
8
+ import { CATEGORY_CUSTOM } from '../../constants.js';
9
+
10
+
11
+ import { getBuildCategory } from './helper.js';
12
+
13
+
14
+
15
+ export default async options => {
16
+ showVersion();
17
+
18
+ const catQuestion = await getBuildCategory(options);
19
+ const catAnwers = await inquirer.prompt(catQuestion);
20
+
21
+ let category = catAnwers.category;
22
+ if (category == null) {
23
+ category = getOptionsCategory(options);
24
+ }
25
+
26
+
27
+ const components = await getComponentsObj(false, category);
28
+
29
+
30
+ var componentKey;
31
+
32
+ const customTasks = new Listr(
33
+ [
34
+ {
35
+ title: 'Update component map',
36
+ task: async () => {
37
+ await updateComponentMap(componentKey, category);
38
+ }
39
+ }
40
+
41
+ ],
42
+ {
43
+ exitOnError: true
44
+ }
45
+ );
46
+
47
+
48
+ for (var index in components) {
49
+ componentKey = components[index].value;
50
+ console.log(chalk.bold.green("Mapping: " + components[index].name));
51
+ await customTasks.run().catch(err => {
52
+ console.log(chalk.bold.red(err.toString()));
53
+ });
54
+ }
55
+
56
+
57
+ return true;
58
+ };
package/src/util.js CHANGED
@@ -150,6 +150,25 @@ export const getOptionsCategory = (options) => {
150
150
  return categoryType;
151
151
  }
152
152
 
153
+ export const getOptionsSource = (options) => {
154
+ let sourceType = null;
155
+ if (options.params[3]) {
156
+ let srcType = options.params[3];
157
+
158
+ switch (srcType.toLowerCase()) {
159
+ case "server" :
160
+ case "s" :
161
+ sourceType = "Server";
162
+ break;
163
+ case "local" :
164
+ case "l" :
165
+ sourceType = "Local";
166
+ break;
167
+ }
168
+ }
169
+ return sourceType;
170
+ }
171
+
153
172
  export const getComponents = async (showSeparator = false, category = CATEGORY_CUSTOM) => {
154
173
  const currentDirectory = process.cwd();
155
174
  const pegaConfigJsonPath = join(currentDirectory, DXCB_CONFIG_JSON_FILENAME);