@pega/custom-dx-components 0.8.2 → 0.8.3
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
|
@@ -24,23 +24,8 @@ export const SOURCE_OF_COMPONENT_TYPES = {
|
|
|
24
24
|
LOCAL: 'Local'
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
let data = fs.readFileSync(pegaConfigJsonPath, { encoding: 'utf8' });
|
|
31
|
-
data = data && JSON.parse(data);
|
|
32
|
-
|
|
33
|
-
if (!data[COMPONENTS_DIRECTORY_PATH]) {
|
|
34
|
-
console.error(
|
|
35
|
-
`${chalk.red.bold('ERROR')} Could not able find components directory path in config.json`
|
|
36
|
-
);
|
|
37
|
-
process.exit(1);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const componentData = data[COMPONENTS_PATH];
|
|
41
|
-
|
|
42
|
-
let { library } = componentData;
|
|
43
|
-
let { organization } = JSON.parse(fs.readFileSync(path.resolve('package.json'), 'utf8'));
|
|
27
|
+
let library;
|
|
28
|
+
let organization;
|
|
44
29
|
|
|
45
30
|
export const getDeleteComponentsQuestions = async (options) => {
|
|
46
31
|
const defaultPegaServerConfig = await getPegaServerConfig();
|
|
@@ -62,31 +47,47 @@ export const getDeleteComponentsQuestions = async (options) => {
|
|
|
62
47
|
export const getLaunchPadFilterQuestions = async () => {
|
|
63
48
|
const defaultPegaServerConfig = await getPegaServerConfig();
|
|
64
49
|
|
|
50
|
+
const currentDirectory = process.cwd();
|
|
51
|
+
const pegaConfigJsonPath = join(currentDirectory, TASKS_CONFIG_JSON_FILENAME);
|
|
52
|
+
|
|
53
|
+
let data = fs.readFileSync(pegaConfigJsonPath, { encoding: 'utf8' });
|
|
54
|
+
data = data && JSON.parse(data);
|
|
55
|
+
|
|
56
|
+
if (!data[COMPONENTS_DIRECTORY_PATH]) {
|
|
57
|
+
console.error(`${chalk.red.bold('ERROR')} Could not able find components directory path in config.json`);
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const componentData = data[COMPONENTS_PATH];
|
|
62
|
+
|
|
63
|
+
({ library } = componentData);
|
|
64
|
+
({ organization } = JSON.parse(fs.readFileSync(path.resolve('package.json'), 'utf8')));
|
|
65
|
+
|
|
65
66
|
return [
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
67
|
+
{
|
|
68
|
+
name: 'organization',
|
|
69
|
+
message: 'Enter component organization (required)',
|
|
70
|
+
default: organization,
|
|
71
|
+
validate: (value) => {
|
|
72
|
+
if (value) {
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
return 'Please provide value for organization';
|
|
73
76
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: 'library',
|
|
80
|
+
message: 'Enter library name (required)',
|
|
81
|
+
default: library,
|
|
82
|
+
validate: (value) => {
|
|
83
|
+
if (value) {
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
return 'Please provide value for library';
|
|
84
87
|
}
|
|
85
|
-
return 'Please provide value for library';
|
|
86
88
|
}
|
|
87
|
-
}
|
|
88
89
|
];
|
|
89
|
-
}
|
|
90
|
+
};
|
|
90
91
|
|
|
91
92
|
export const deleteLocalComponents = async (sourceOfComponents, options) => {
|
|
92
93
|
const localComponents = await getComponents();
|
|
@@ -124,27 +125,23 @@ export const deleteLocalComponents = async (sourceOfComponents, options) => {
|
|
|
124
125
|
};
|
|
125
126
|
|
|
126
127
|
export const deleteServerComponents = async (sourceOfComponents, answers) => {
|
|
127
|
-
|
|
128
128
|
const defaultPegaServerConfig = await getPegaServerConfig();
|
|
129
129
|
const isLaunchpad = defaultPegaServerConfig.serverType === 'launchpad';
|
|
130
130
|
|
|
131
|
-
|
|
132
131
|
if (isLaunchpad) {
|
|
133
132
|
const questions = await getLaunchPadFilterQuestions();
|
|
134
133
|
const lpAnswers = await inquirer.prompt(questions);
|
|
135
134
|
|
|
136
|
-
({library, organization} = lpAnswers);
|
|
135
|
+
({ library, organization } = lpAnswers);
|
|
137
136
|
}
|
|
138
137
|
|
|
139
138
|
const spinner = ora('Fetching components from server').start();
|
|
140
139
|
const data = await getComponentsFromServer(library, organization);
|
|
141
140
|
spinner.stop();
|
|
142
141
|
|
|
143
|
-
|
|
144
142
|
let serverComponents;
|
|
145
143
|
if (isLaunchpad) {
|
|
146
144
|
serverComponents = data;
|
|
147
|
-
|
|
148
145
|
} else {
|
|
149
146
|
try {
|
|
150
147
|
if (typeof data === 'object') {
|
|
@@ -157,7 +154,6 @@ export const deleteServerComponents = async (sourceOfComponents, answers) => {
|
|
|
157
154
|
}
|
|
158
155
|
}
|
|
159
156
|
|
|
160
|
-
|
|
161
157
|
if (serverComponents && serverComponents?.length > 0) {
|
|
162
158
|
if (isLaunchpad) {
|
|
163
159
|
const choicesArr = serverComponents.map(({ name: componentName, type, version }) => {
|
|
@@ -25,23 +25,8 @@ export const SOURCE_OF_COMPONENT_TYPES = {
|
|
|
25
25
|
LOCAL: 'Local'
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
let data = fs.readFileSync(pegaConfigJsonPath, { encoding: 'utf8' });
|
|
32
|
-
data = data && JSON.parse(data);
|
|
33
|
-
|
|
34
|
-
if (!data[COMPONENTS_DIRECTORY_PATH]) {
|
|
35
|
-
console.error(
|
|
36
|
-
`${chalk.red.bold('ERROR')} Could not able find components directory path in config.json`
|
|
37
|
-
);
|
|
38
|
-
process.exit(1);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const componentData = data[COMPONENTS_PATH];
|
|
42
|
-
|
|
43
|
-
let { library } = componentData;
|
|
44
|
-
let { organization } = JSON.parse(fs.readFileSync(path.resolve('package.json'), 'utf8'));
|
|
28
|
+
let library;
|
|
29
|
+
let organization;
|
|
45
30
|
|
|
46
31
|
export const getDeleteComponentsQuestions = async (options) => {
|
|
47
32
|
const defaultPegaServerConfig = await getPegaServerConfig();
|
|
@@ -62,13 +47,28 @@ export const getDeleteComponentsQuestions = async (options) => {
|
|
|
62
47
|
|
|
63
48
|
export const getLaunchPadFilterQuestions = async () => {
|
|
64
49
|
const defaultPegaServerConfig = await getPegaServerConfig();
|
|
50
|
+
const currentDirectory = process.cwd();
|
|
51
|
+
const pegaConfigJsonPath = join(currentDirectory, TASKS_CONFIG_JSON_FILENAME);
|
|
52
|
+
|
|
53
|
+
let data = fs.readFileSync(pegaConfigJsonPath, { encoding: 'utf8' });
|
|
54
|
+
data = data && JSON.parse(data);
|
|
55
|
+
|
|
56
|
+
if (!data[COMPONENTS_DIRECTORY_PATH]) {
|
|
57
|
+
console.error(`${chalk.red.bold('ERROR')} Could not able find components directory path in config.json`);
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const componentData = data[COMPONENTS_PATH];
|
|
62
|
+
|
|
63
|
+
({ library } = componentData);
|
|
64
|
+
({ organization } = JSON.parse(fs.readFileSync(path.resolve('package.json'), 'utf8')));
|
|
65
65
|
|
|
66
66
|
return [
|
|
67
67
|
{
|
|
68
68
|
name: 'organization',
|
|
69
69
|
message: 'Enter component organization (required)',
|
|
70
70
|
default: organization,
|
|
71
|
-
validate: value => {
|
|
71
|
+
validate: (value) => {
|
|
72
72
|
if (value) {
|
|
73
73
|
return true;
|
|
74
74
|
}
|
|
@@ -79,7 +79,7 @@ export const getLaunchPadFilterQuestions = async () => {
|
|
|
79
79
|
name: 'library',
|
|
80
80
|
message: 'Enter library name (required)',
|
|
81
81
|
default: library,
|
|
82
|
-
validate: value => {
|
|
82
|
+
validate: (value) => {
|
|
83
83
|
if (value) {
|
|
84
84
|
return true;
|
|
85
85
|
}
|
|
@@ -87,7 +87,7 @@ export const getLaunchPadFilterQuestions = async () => {
|
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
];
|
|
90
|
-
}
|
|
90
|
+
};
|
|
91
91
|
|
|
92
92
|
export const deleteLocalComponents = async (sourceOfComponents, options) => {
|
|
93
93
|
const localComponents = await getComponents();
|
|
@@ -133,7 +133,6 @@ export const deleteLocalComponents = async (sourceOfComponents, options) => {
|
|
|
133
133
|
};
|
|
134
134
|
|
|
135
135
|
export const deleteServerComponents = async (sourceOfComponents, answers) => {
|
|
136
|
-
|
|
137
136
|
const defaultPegaServerConfig = await getPegaServerConfig();
|
|
138
137
|
const isLaunchpad = defaultPegaServerConfig.serverType === 'launchpad';
|
|
139
138
|
|
|
@@ -141,14 +140,13 @@ export const deleteServerComponents = async (sourceOfComponents, answers) => {
|
|
|
141
140
|
const questions = await getLaunchPadFilterQuestions();
|
|
142
141
|
const lpAnswers = await inquirer.prompt(questions);
|
|
143
142
|
|
|
144
|
-
({library, organization} = lpAnswers);
|
|
143
|
+
({ library, organization } = lpAnswers);
|
|
145
144
|
}
|
|
146
145
|
|
|
147
146
|
const spinner = ora('Fetching components from server').start();
|
|
148
147
|
const data = await getComponentsFromServer(library, organization);
|
|
149
148
|
spinner.stop();
|
|
150
149
|
|
|
151
|
-
|
|
152
150
|
// const serverComponents = isLaunchpad ? data : data.pxResults;
|
|
153
151
|
let serverComponents;
|
|
154
152
|
if (isLaunchpad) {
|
|
@@ -165,8 +163,6 @@ export const deleteServerComponents = async (sourceOfComponents, answers) => {
|
|
|
165
163
|
}
|
|
166
164
|
}
|
|
167
165
|
|
|
168
|
-
|
|
169
|
-
|
|
170
166
|
if (serverComponents && serverComponents?.length > 0) {
|
|
171
167
|
if (isLaunchpad) {
|
|
172
168
|
serverComponents.forEach((component) => {
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@pega/configs": "^0.5.3",
|
|
69
|
-
"@pega/custom-dx-components": "^0.8.
|
|
69
|
+
"@pega/custom-dx-components": "^0.8.3",
|
|
70
70
|
"@pega/eslint-config": "^0.3.2",
|
|
71
71
|
"@storybook/addon-actions": "^6.5.12",
|
|
72
72
|
"@storybook/addon-essentials": "^6.5.12",
|