@pega/custom-dx-components 0.242.42 → 0.242.44
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 +2 -0
- package/src/tasks/create/templates/Constellation/Field/Boolean/config.json.mustache +5 -2
- package/src/tasks/create/templates/Constellation/Field/Date/config.json.mustache +4 -1
- package/src/tasks/create/templates/Constellation/Field/DateTime/config.json.mustache +4 -1
- package/src/tasks/create/templates/Constellation/Field/Decimal/config.json.mustache +4 -1
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/config.json.mustache +4 -1
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/config.json.mustache +4 -1
- package/src/tasks/create/templates/Constellation/Field/Icon-Button-URL/config.json.mustache +4 -1
- package/src/tasks/create/templates/Constellation/Field/Integer/config.json.mustache +4 -1
- package/src/tasks/create/templates/Constellation/Field/Picklist/config.json.mustache +4 -1
- package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/config.json.mustache +4 -1
- package/src/tasks/create/templates/Constellation/Field/Picklist-RadioButtons/config.json.mustache +4 -1
- package/src/tasks/create/templates/Constellation/Field/Text/config.json.mustache +6 -3
- package/src/tasks/create/templates/Constellation/Field/Text-Email/config.json.mustache +4 -1
- package/src/tasks/create/templates/Constellation/Field/Text-Input/config.json.mustache +4 -1
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/config.json.mustache +4 -1
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/config.json.mustache +4 -1
- package/src/tasks/create/templates/Constellation/Field/Text-URL/config.json.mustache +4 -1
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/config.json.mustache +4 -1
- package/src/tasks/create/templates/Launchpad/Field/Icon-Button-URL/config.json.mustache +4 -1
- package/src/tasks/export-archive/helper.js +24 -2
- package/src/tasks/export-archive/index.js +5 -1
- package/src/tasks/import-comp/helper.js +24 -3
- package/src/tasks/import-comp/index.js +101 -67
- package/src/tasks/init/template/package.json.mustache +1 -1
- package/src/tasks/init/template/tasks.config.json +2 -0
- package/src/util.js +42 -3
- package/tests/assets/library/components/create/Pega_DXIL_MyTestText/config.json +3 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyBoolean/config.json +5 -2
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyCurrency/config.json +4 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDate/config.json +4 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDateTime/config.json +4 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDecimal/config.json +4 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyEmail/config.json +4 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyIconButtonURL/config.json +4 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyInteger/config.json +4 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyParagraph/config.json +4 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPercentage/config.json +4 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPhone/config.json +4 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPicklist/config.json +4 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyRadiobuttons/config.json +4 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MySearchbox/config.json +4 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyText/config.json +3 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyTextInput/config.json +4 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyTimeOfDay/config.json +4 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyURL/config.json +4 -1
- package/tests/assets/original/components/create/Pega_DXIL_MyTestText/config.json +3 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyBoolean/config.json +5 -2
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyCurrency/config.json +4 -1
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDate/config.json +4 -1
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDateTime/config.json +4 -1
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDecimal/config.json +4 -1
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyEmail/config.json +4 -1
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyIconButtonURL/config.json +4 -1
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyInteger/config.json +4 -1
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyParagraph/config.json +4 -1
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPercentage/config.json +4 -1
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPhone/config.json +4 -1
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPicklist/config.json +4 -1
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyRadiobuttons/config.json +4 -1
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MySearchbox/config.json +4 -1
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyText/config.json +3 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyTextInput/config.json +4 -1
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyTimeOfDay/config.json +4 -1
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyURL/config.json +4 -1
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyBoolean/config.json +5 -2
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyCurrency/config.json +4 -1
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDate/config.json +4 -1
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDateTime/config.json +4 -1
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDecimal/config.json +4 -1
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyEmail/config.json +4 -1
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyIconButtonURL/config.json +4 -1
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyInteger/config.json +4 -1
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyParagraph/config.json +4 -1
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPercentage/config.json +4 -1
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPhone/config.json +4 -1
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPicklist/config.json +4 -1
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyRadiobuttons/config.json +4 -1
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MySearchbox/config.json +4 -1
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyText/config.json +3 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyTextInput/config.json +4 -1
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyTimeOfDay/config.json +4 -1
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyURL/config.json +4 -1
package/package.json
CHANGED
package/src/constants.js
CHANGED
|
@@ -6,6 +6,8 @@ export const WEBPACK_CONFIG_JS_FILENAME = 'webpack.config.js';
|
|
|
6
6
|
export const WEBPACK_PATHS_JS_FILENAME = 'paths.js';
|
|
7
7
|
export const USE_PROMOTED_WEB_PACK = 'usePromotedWebPack';
|
|
8
8
|
export const COMPONENTS_DIRECTORY_PATH = 'components-directory-path';
|
|
9
|
+
export const IMPORT_RELATIVE_PATH = 'import-relative-path';
|
|
10
|
+
export const EXPORT_RELATIVE_PATH = 'export-relative-path';
|
|
9
11
|
export const COMPONENTS_PATH = 'component';
|
|
10
12
|
export const TOKEN_PATH = 'node_modules/@pega/custom-dx-components/.access_token';
|
|
11
13
|
export const OOTB_COMPONENTS = 'node_modules/@pega/custom-dx-components/.ootb_components';
|
|
@@ -109,6 +109,9 @@
|
|
|
109
109
|
"label": "@L $this.label",
|
|
110
110
|
"placeholder": "@L Select...",
|
|
111
111
|
"listType": "associated",
|
|
112
|
-
"datasource": "@ASSOCIATED .$this.name"
|
|
112
|
+
"datasource": "@ASSOCIATED .$this.name",
|
|
113
|
+
"detailFVLItem": true,
|
|
114
|
+
"isFormWidth" : false,
|
|
115
|
+
"isContainerWidth" : false
|
|
113
116
|
}
|
|
114
117
|
}
|
package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/config.json.mustache
CHANGED
|
@@ -110,6 +110,9 @@
|
|
|
110
110
|
"placeholder": "@L Select...",
|
|
111
111
|
"listType": "associated",
|
|
112
112
|
"datasource": "@ASSOCIATED .$this.name",
|
|
113
|
-
"deferDatasource": true
|
|
113
|
+
"deferDatasource": true,
|
|
114
|
+
"detailFVLItem": true,
|
|
115
|
+
"isFormWidth" : false,
|
|
116
|
+
"isContainerWidth" : false
|
|
114
117
|
}
|
|
115
118
|
}
|
package/src/tasks/create/templates/Constellation/Field/Picklist-RadioButtons/config.json.mustache
CHANGED
|
@@ -108,6 +108,9 @@
|
|
|
108
108
|
"defaultConfig": {
|
|
109
109
|
"label": "@L $this.label",
|
|
110
110
|
"listType": "associated",
|
|
111
|
-
"datasource": "@ASSOCIATED .$this.name"
|
|
111
|
+
"datasource": "@ASSOCIATED .$this.name",
|
|
112
|
+
"detailFVLItem": true,
|
|
113
|
+
"isFormWidth" : true,
|
|
114
|
+
"isContainerWidth" : false
|
|
112
115
|
}
|
|
113
116
|
}
|
|
@@ -58,19 +58,22 @@
|
|
|
58
58
|
"label": "@L $this.label",
|
|
59
59
|
"placeholder": "@L Select...",
|
|
60
60
|
"listType": "associated",
|
|
61
|
-
"datasource": "@ASSOCIATED .$this.name"
|
|
61
|
+
"datasource": "@ASSOCIATED .$this.name",
|
|
62
62
|
{{/IS_PICKLIST}}
|
|
63
63
|
{{#IS_BOOLEAN}}
|
|
64
64
|
"trueText": "True",
|
|
65
|
-
"falseText": "False"
|
|
65
|
+
"falseText": "False",
|
|
66
66
|
{{/IS_BOOLEAN}}
|
|
67
67
|
{{#IS_PHONE}}
|
|
68
68
|
"datasource": {
|
|
69
69
|
"source": "@DATASOURCE D_pyCountryCallingCodeList.pxResults",
|
|
70
70
|
"fields": {
|
|
71
71
|
"value": "@P .pyCallingCode"
|
|
72
|
-
}
|
|
72
|
+
},
|
|
73
73
|
}
|
|
74
74
|
{{/IS_PHONE}}
|
|
75
|
+
"detailFVLItem": true,
|
|
76
|
+
"isFormWidth" : false,
|
|
77
|
+
"isContainerWidth" : false
|
|
75
78
|
}
|
|
76
79
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { join } from 'path';
|
|
4
|
-
import { addDebugLog, getConfigDefaults, getLibraryArchiveDirectories, getLibraryArchivesVersions } from '../../util.js';
|
|
4
|
+
import { addDebugLog, getConfigDefaults, getLibraryArchiveDirectories, getLibraryArchivesVersions, setConfigExportRelativePath, forceDefaultsUpdate } from '../../util.js';
|
|
5
5
|
|
|
6
6
|
export const SOURCE_OF_COMPONENT_TYPES = {
|
|
7
7
|
SERVER: 'Server',
|
|
@@ -20,9 +20,11 @@ addDebugLog("getFilePathQuestions", "", "");
|
|
|
20
20
|
console.log("\tWindows:\tC:\\Users\\name\\...\n");
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
const configDef = getConfigDefaults();
|
|
24
|
+
|
|
23
25
|
const currentDirectory = process.cwd();
|
|
24
26
|
const arPathParts = currentDirectory.split(path.sep);
|
|
25
|
-
let defaultPath = join(arPathParts[0], arPathParts[1], arPathParts[2],
|
|
27
|
+
let defaultPath = join(arPathParts[0], arPathParts[1], arPathParts[2], configDef.exportRelativePath);
|
|
26
28
|
if (path.sep === "/") {
|
|
27
29
|
defaultPath = "/".concat(defaultPath);
|
|
28
30
|
}
|
|
@@ -83,3 +85,23 @@ addDebugLog("getLibraryVersionQuestion", "", "");
|
|
|
83
85
|
}
|
|
84
86
|
];
|
|
85
87
|
};
|
|
88
|
+
|
|
89
|
+
export const updateSavedExportFilePath = async(filePath) => {
|
|
90
|
+
const currentDirectory = process.cwd();
|
|
91
|
+
const arPathParts = currentDirectory.split(path.sep);
|
|
92
|
+
const configDef = getConfigDefaults();
|
|
93
|
+
|
|
94
|
+
let defaultPath = join(path.sep, arPathParts[0], arPathParts[1], arPathParts[2]);
|
|
95
|
+
|
|
96
|
+
if (filePath.indexOf(defaultPath) === 0) {
|
|
97
|
+
// same starting path, so we can save the relative
|
|
98
|
+
const relativePath = filePath.replace(defaultPath.concat("/"), "");
|
|
99
|
+
|
|
100
|
+
if (relativePath != configDef.importRelativePath) {
|
|
101
|
+
await setConfigExportRelativePath(relativePath);
|
|
102
|
+
await forceDefaultsUpdate();
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
cleanUpTemp
|
|
19
19
|
} from '../../util.js';
|
|
20
20
|
import { TASKS_CONFIG_JSON_FILENAME, ARCHIVES_PATH } from '../../constants.js';
|
|
21
|
-
import { getFilePathQuestions, getLibraryQuestion, getLibraryVersionQuestion } from './helper.js';
|
|
21
|
+
import { getFilePathQuestions, getLibraryQuestion, getLibraryVersionQuestion, updateSavedExportFilePath } from './helper.js';
|
|
22
22
|
|
|
23
23
|
export const DXCB_CONFIG_INTERNAL_JSON_FILENAME = 'src/dxcb.config.json';
|
|
24
24
|
const currentDirectory = process.cwd();
|
|
@@ -129,6 +129,8 @@ addDebugLog("exportArch", `exportPath: ${exportPath}, orgLibName: ${orgLibName},
|
|
|
129
129
|
const createNewPath = newPathAnswer.createNewPath;
|
|
130
130
|
if (createNewPath) {
|
|
131
131
|
fs.mkdirSync(exportPath, { recursive: true });
|
|
132
|
+
|
|
133
|
+
await updateSavedExportFilePath(exportPath);
|
|
132
134
|
}
|
|
133
135
|
else {
|
|
134
136
|
console.log(chalk.green("Store not exported."));
|
|
@@ -211,6 +213,8 @@ export default async options => {
|
|
|
211
213
|
const filePathAnswers = await inquirer.prompt(filePathQuestions);
|
|
212
214
|
let { filePath } = filePathAnswers;
|
|
213
215
|
|
|
216
|
+
await updateSavedExportFilePath(filePath);
|
|
217
|
+
|
|
214
218
|
|
|
215
219
|
// if (path.sep === "/") {
|
|
216
220
|
// if (filePath.lastIndexOf(path.sep) != filePath.length - 1) {
|
|
@@ -2,8 +2,7 @@ import chalk from 'chalk';
|
|
|
2
2
|
import fs from 'fs';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import { join } from 'path';
|
|
5
|
-
import { addDebugLog } from '../../util.js';
|
|
6
|
-
|
|
5
|
+
import { addDebugLog, getConfigDefaults, setConfigImportRelativePath, forceDefaultsUpdate } from '../../util.js';
|
|
7
6
|
|
|
8
7
|
export const getFilePathQuestions = async () => {
|
|
9
8
|
addDebugLog("getFilePathQuestions", "", "");
|
|
@@ -16,9 +15,11 @@ addDebugLog("getFilePathQuestions", "", "");
|
|
|
16
15
|
console.log("\tWindows:\tC:\\Users\\name\\...\n");
|
|
17
16
|
}
|
|
18
17
|
|
|
18
|
+
const configDef = getConfigDefaults();
|
|
19
|
+
|
|
19
20
|
const currentDirectory = process.cwd();
|
|
20
21
|
const arPathParts = currentDirectory.split(path.sep);
|
|
21
|
-
let defaultPath = join(arPathParts[0], arPathParts[1], arPathParts[2],
|
|
22
|
+
let defaultPath = join(arPathParts[0], arPathParts[1], arPathParts[2], configDef.importRelativePath);
|
|
22
23
|
if (path.sep === "/") {
|
|
23
24
|
defaultPath = "/".concat(defaultPath);
|
|
24
25
|
}
|
|
@@ -45,3 +46,23 @@ addDebugLog("getFileNameQuestions", "", "");
|
|
|
45
46
|
},
|
|
46
47
|
];
|
|
47
48
|
};
|
|
49
|
+
|
|
50
|
+
export const updateSavedFilePath = async(filePath) => {
|
|
51
|
+
const currentDirectory = process.cwd();
|
|
52
|
+
const arPathParts = currentDirectory.split(path.sep);
|
|
53
|
+
const configDef = getConfigDefaults();
|
|
54
|
+
|
|
55
|
+
let defaultPath = join(path.sep, arPathParts[0], arPathParts[1], arPathParts[2]);
|
|
56
|
+
|
|
57
|
+
if (filePath.indexOf(defaultPath) === 0) {
|
|
58
|
+
// same starting path, so we can save the relative
|
|
59
|
+
const relativePath = filePath.replace(defaultPath.concat("/"), "");
|
|
60
|
+
|
|
61
|
+
if (relativePath != configDef.importRelativePath) {
|
|
62
|
+
await setConfigImportRelativePath(relativePath);
|
|
63
|
+
await forceDefaultsUpdate();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -17,7 +17,9 @@ import {
|
|
|
17
17
|
getComponents
|
|
18
18
|
} from '../../util.js';
|
|
19
19
|
import { TASKS_CONFIG_JSON_FILENAME } from '../../constants.js';
|
|
20
|
-
import { getFilePathQuestions, getFileNameQuestions } from './helper.js';
|
|
20
|
+
import { getFilePathQuestions, getFileNameQuestions, updateSavedFilePath } from './helper.js';
|
|
21
|
+
|
|
22
|
+
import buildComponent from '../build-comp/index.js';
|
|
21
23
|
|
|
22
24
|
export const DXCB_CONFIG_INTERNAL_JSON_FILENAME = 'src/dxcb.config.json';
|
|
23
25
|
const currentDirectory = process.cwd();
|
|
@@ -155,90 +157,120 @@ export const importComp = async(filePath, fileName) => {
|
|
|
155
157
|
addDebugLog("importComp", `filePath: ${filePath}, fileName: ${fileName}`, "");
|
|
156
158
|
|
|
157
159
|
const currentDirectory = process.cwd();
|
|
158
|
-
const compDirectory = join(currentDirectory, "src", "components");
|
|
160
|
+
// const compDirectory = join(currentDirectory, "src", "components");
|
|
161
|
+
|
|
159
162
|
const copyFilePath = join(filePath, fileName);
|
|
160
163
|
|
|
161
164
|
const configDef = getConfigDefaults();
|
|
162
|
-
const copyDir =
|
|
165
|
+
const copyDir = await getComponentDirectoryPath(fileName);
|
|
166
|
+
let configData;
|
|
167
|
+
let newName = "";
|
|
168
|
+
let newLabel = "";
|
|
163
169
|
|
|
164
|
-
if (fs.existsSync(
|
|
165
|
-
fs.
|
|
166
|
-
|
|
170
|
+
if (fs.existsSync(copyDir)) {
|
|
171
|
+
configData = fs.readFileSync(join(copyDir, "/config.json"), { encoding: 'utf8' });
|
|
172
|
+
configData = configData && JSON.parse(configData);
|
|
167
173
|
|
|
168
|
-
|
|
169
|
-
|
|
174
|
+
const compName = configData.componentKey.split("_")[2];
|
|
175
|
+
const potentialCompKey = `${configDef.currentOrgLib}_${compName}`;
|
|
176
|
+
const currentCompList = await getComponents();
|
|
170
177
|
|
|
171
|
-
const compName = configData.componentKey.split("_")[2];
|
|
172
|
-
const potentialCompKey = `${configDef.currentOrgLib}_${compName}`;
|
|
173
|
-
const currentCompList = await getComponents();
|
|
174
|
-
let newName = "";
|
|
175
|
-
let newLabel = "";
|
|
176
178
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
179
|
+
if (currentCompList && currentCompList.includes(potentialCompKey)) {
|
|
180
|
+
console.log(`\nComponent ${chalk.yellow(`${potentialCompKey}`)} already exists.`);
|
|
181
|
+
const proceedAnswers = await inquirer.prompt([
|
|
180
182
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
},
|
|
188
|
-
{
|
|
189
|
-
name: 'componentName',
|
|
190
|
-
message: 'Enter component name (required)',
|
|
191
|
-
when(answers) {
|
|
192
|
-
return answers.proceedAs === 'New name';
|
|
183
|
+
{
|
|
184
|
+
name: 'proceedAs',
|
|
185
|
+
type: 'rawlist',
|
|
186
|
+
message: `Proceed as ?`,
|
|
187
|
+
default: 'No import',
|
|
188
|
+
choices: ['No import', 'Overwrite', 'New name']
|
|
193
189
|
},
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
190
|
+
{
|
|
191
|
+
name: 'componentName',
|
|
192
|
+
message: 'Enter component name (required)',
|
|
193
|
+
when(answers) {
|
|
194
|
+
return answers.proceedAs === 'New name';
|
|
195
|
+
},
|
|
196
|
+
validate: value => {
|
|
197
|
+
/* value should not be empty
|
|
198
|
+
It should not have spaces
|
|
199
|
+
It should not start with a number
|
|
200
|
+
Only case-insensitive alphanumeric values are allowed
|
|
201
|
+
*/
|
|
202
|
+
if (value && !/^\d/.test(value) && value === sanitize(value)) {
|
|
203
|
+
return true;
|
|
204
|
+
}
|
|
205
|
+
return 'Only alphanumeric values are allowed, starting with alphabets, no spaces.';
|
|
202
206
|
}
|
|
203
|
-
return 'Only alphanumeric values are allowed, starting with alphabets, no spaces.';
|
|
204
|
-
}
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
name: 'componentLabel',
|
|
208
|
-
message: 'Enter component label for display (required)',
|
|
209
|
-
when(answers) {
|
|
210
|
-
return answers.proceedAs === 'New name';
|
|
211
207
|
},
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
208
|
+
{
|
|
209
|
+
name: 'componentLabel',
|
|
210
|
+
message: 'Enter component label for display (required)',
|
|
211
|
+
when(answers) {
|
|
212
|
+
return answers.proceedAs === 'New name';
|
|
213
|
+
},
|
|
214
|
+
validate: value => {
|
|
215
|
+
if (value) {
|
|
216
|
+
return true;
|
|
217
|
+
}
|
|
218
|
+
return 'Please provide value for label';
|
|
215
219
|
}
|
|
216
|
-
return 'Please provide value for label';
|
|
217
220
|
}
|
|
221
|
+
]);
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
switch (proceedAnswers.proceedAs) {
|
|
225
|
+
case 'No import':
|
|
226
|
+
// removed copied
|
|
227
|
+
// fs.rmSync(copyDir, { recursive: true, force: true, maxRetries: 2 });
|
|
228
|
+
process.exit();
|
|
229
|
+
break;
|
|
230
|
+
case 'Overwrite':
|
|
231
|
+
// remove existing
|
|
232
|
+
const existingComp = await getComponentDirectoryPath(potentialCompKey);
|
|
233
|
+
fs.rmSync(existingComp, { recursive: true, force: true, maxRetries: 2 });
|
|
234
|
+
break;
|
|
235
|
+
case 'New name':
|
|
236
|
+
newName = proceedAnswers.componentName;
|
|
237
|
+
newLabel = proceedAnswers.componentLabel;
|
|
238
|
+
break;
|
|
218
239
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
switch (proceedAnswers.proceedAs) {
|
|
222
|
-
case 'No import':
|
|
223
|
-
// removed copied
|
|
224
|
-
fs.rmSync(copyDir, { recursive: true, force: true, maxRetries: 2 });
|
|
225
|
-
process.exit();
|
|
226
|
-
break;
|
|
227
|
-
case 'Overwrite':
|
|
228
|
-
// remove existing
|
|
229
|
-
const exitingComp = join(compDirectory, potentialCompKey);
|
|
230
|
-
fs.rmSync(exitingComp, { recursive: true, force: true, maxRetries: 2 });
|
|
231
|
-
break;
|
|
232
|
-
case 'New name':
|
|
233
|
-
newName = proceedAnswers.componentName;
|
|
234
|
-
newLabel = proceedAnswers.componentLabel;
|
|
235
|
-
break;
|
|
240
|
+
|
|
236
241
|
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
if (fs.existsSync(copyFilePath)) {
|
|
245
|
+
fs.cpSync(copyFilePath, copyDir, { recursive: true, force: true });
|
|
246
|
+
configData = fs.readFileSync(join(copyDir, "/config.json"), { encoding: 'utf8' });
|
|
247
|
+
|
|
248
|
+
configData = configData && JSON.parse(configData);
|
|
249
|
+
|
|
250
|
+
const newCompKey = await renameComponent(configData.componentKey, configDef.currentOrgLib, configDef.buildVersion, newName, newLabel, null);
|
|
251
|
+
console.log(`\n${chalk.green(`${fileName}`)} has been imported as ${chalk.green(`${newCompKey}`)}\n`);
|
|
252
|
+
|
|
253
|
+
const validateAnswers = await inquirer.prompt([
|
|
254
|
+
{
|
|
255
|
+
name: 'doValidate',
|
|
256
|
+
type: 'confirm',
|
|
257
|
+
message: `Validate ${chalk.yellow(`${newCompKey}`)}`,
|
|
258
|
+
default: true
|
|
259
|
+
}]);
|
|
260
|
+
|
|
261
|
+
if (validateAnswers.doValidate) {
|
|
262
|
+
const args = [ '','', '', `${newCompKey}`];
|
|
263
|
+
let myOptions = {};
|
|
264
|
+
myOptions["params"] = args;
|
|
265
|
+
|
|
266
|
+
await buildComponent(myOptions);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
|
|
237
270
|
|
|
238
271
|
}
|
|
239
272
|
|
|
240
|
-
|
|
241
|
-
console.log(`\n${chalk.green(`${fileName}`)} has been imported as ${chalk.green(`${newCompKey}`)}`);
|
|
273
|
+
|
|
242
274
|
|
|
243
275
|
|
|
244
276
|
}
|
|
@@ -307,6 +339,8 @@ addDebugLog("importComponent", "", "+");
|
|
|
307
339
|
process.exit();
|
|
308
340
|
}
|
|
309
341
|
|
|
342
|
+
await updateSavedFilePath(filePath);
|
|
343
|
+
|
|
310
344
|
const fileNameQuestions = await getFileNameQuestions(compFileList);
|
|
311
345
|
const fileNameAnswers = await inquirer.prompt(fileNameQuestions);
|
|
312
346
|
const {fileName} = fileNameAnswers;
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
},
|
|
101
101
|
"devDependencies": {
|
|
102
102
|
"@pega/configs": "^0.6.0",
|
|
103
|
-
"@pega/custom-dx-components": "0.242.
|
|
103
|
+
"@pega/custom-dx-components": "~0.242.44",
|
|
104
104
|
"@pega/pcore-pconnect-typedefs": "~3.0.0",
|
|
105
105
|
"@storybook/addon-actions": "^7.6.7",
|
|
106
106
|
"@storybook/addon-essentials": "^7.6.19",
|