@pega/custom-dx-components 24.2.11 → 24.2.13
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/Date/demo.stories.tsx.mustache +2 -2
- package/src/tasks/create/templates/Constellation/Field/DateTime/demo.stories.tsx.mustache +2 -2
- package/src/tasks/create/templates/Constellation/Field/Icon-Button-URL/demo.stories.tsx.mustache +2 -2
- package/src/tasks/create/templates/Constellation/Template/DETAILS/demo.stories.tsx.mustache +3 -3
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/demo.stories.tsx.mustache +3 -3
- package/src/tasks/create/templates/Constellation/Template/PAGE/demo.stories.tsx.mustache +2 -2
- package/src/tasks/create/templates/Constellation/Widget/CASE/demo.stories.tsx.mustache +4 -4
- package/src/tasks/create/templates/Constellation/Widget/PAGE/demo.stories.tsx.mustache +2 -2
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/demo.stories.tsx.mustache +3 -3
- package/src/tasks/create/templates/Launchpad/Field/Icon-Button-URL/demo.stories.tsx.mustache +2 -2
- package/src/tasks/create/templates/Launchpad/Widget/CASE/demo.stories.tsx.mustache +4 -4
- package/src/tasks/create/templates/Launchpad/Widget/PAGE/demo.stories.tsx.mustache +2 -2
- package/src/tasks/create/templates/Launchpad/Widget/PAGE-CASE/demo.stories.tsx.mustache +3 -3
- package/src/tasks/create-lib/index.js +85 -1
- package/src/tasks/create-version/index.js +60 -16
- package/src/tasks/delete-lib/index.js +43 -14
- package/src/tasks/delete-version/index.js +30 -9
- package/src/tasks/import-archive/index.js +27 -14
- package/src/tasks/import-comp/index.js +144 -82
- package/src/tasks/init/template/package.json.mustache +1 -1
- package/src/tasks/publish/index.js +34 -18
- package/src/tasks/publish-lib/index.js +19 -2
- package/src/tasks/set-perm/index.js +14 -2
- package/src/tasks/switch-lib/index.js +83 -34
- package/src/tasks/switch-version/index.js +69 -14
- package/src/util.js +99 -2
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyCaseWidget/demo.stories.tsx +4 -4
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDate/demo.stories.tsx +2 -2
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDateTime/demo.stories.tsx +2 -2
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDetails/demo.stories.tsx +3 -3
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyIconButtonURL/demo.stories.tsx +2 -2
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPage/demo.stories.tsx +2 -2
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPageCaseWidget/demo.stories.tsx +3 -3
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPageWidget/demo.stories.tsx +2 -2
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/demo.stories.tsx +3 -3
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyCaseWidget/demo.stories.tsx +4 -4
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDate/demo.stories.tsx +2 -2
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDateTime/demo.stories.tsx +2 -2
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDetails/demo.stories.tsx +3 -3
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyIconButtonURL/demo.stories.tsx +2 -2
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPage/demo.stories.tsx +2 -2
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPageCaseWidget/demo.stories.tsx +3 -3
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPageWidget/demo.stories.tsx +2 -2
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/demo.stories.tsx +3 -3
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyCaseWidget/demo.stories.tsx +4 -4
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDate/demo.stories.tsx +2 -2
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDateTime/demo.stories.tsx +2 -2
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDetails/demo.stories.tsx +3 -3
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyIconButtonURL/demo.stories.tsx +2 -2
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPage/demo.stories.tsx +2 -2
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPageCaseWidget/demo.stories.tsx +3 -3
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPageWidget/demo.stories.tsx +2 -2
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/demo.stories.tsx +3 -3
- package/tests/functional/localLibCreateLibBuildLibDeleteLib.test.js +1 -1
- package/tests/functional/localLibCreateLibBuildLibListPubDeleteLib.test.js +1 -1
- package/tests/functional/localLibCreateLibValidateDeleteLib.test.js +1 -1
|
@@ -7,7 +7,10 @@ import {
|
|
|
7
7
|
checkLibraryAndArchives,
|
|
8
8
|
getConfigDefaults,
|
|
9
9
|
addDebugLog,
|
|
10
|
-
cleanUpTemp
|
|
10
|
+
cleanUpTemp,
|
|
11
|
+
getUseInputConfig,
|
|
12
|
+
getInputConfigForCommand,
|
|
13
|
+
convertYNToBoolean
|
|
11
14
|
} from '../../util.js';
|
|
12
15
|
|
|
13
16
|
import { deleteLibraryVersion } from '../delete-lib/index.js';
|
|
@@ -15,6 +18,8 @@ import { deleteLibraryVersion } from '../delete-lib/index.js';
|
|
|
15
18
|
|
|
16
19
|
export default async (options) => {
|
|
17
20
|
const isLibraryBased = getLibraryBased();
|
|
21
|
+
const useInputConfig = getUseInputConfig();
|
|
22
|
+
|
|
18
23
|
if (!isLibraryBased) {
|
|
19
24
|
console.log(`Command only supported for ${chalk.bold.green('library mode')} components.`)
|
|
20
25
|
process.exit();
|
|
@@ -33,19 +38,35 @@ addDebugLog("deleteVersion", "", "+");
|
|
|
33
38
|
const configDef = getConfigDefaults();
|
|
34
39
|
let libraryName = configDef.currentOrgLib;
|
|
35
40
|
|
|
36
|
-
if (
|
|
37
|
-
|
|
38
|
-
version =
|
|
41
|
+
if (useInputConfig) {
|
|
42
|
+
const inputConfig = await getInputConfigForCommand("deleteLibVersion");
|
|
43
|
+
version = inputConfig.libraryVersion;
|
|
44
|
+
const isPermanent = inputConfig.isPermanent;
|
|
45
|
+
const permBuild = convertYNToBoolean(isPermanent);
|
|
39
46
|
|
|
40
|
-
if (
|
|
41
|
-
|
|
42
|
-
okToDelete = !!(okToDel === 'Y' || okToDel === 'y' || okToDel === true || okToDel === 'true');
|
|
47
|
+
if (!permBuild && version != "ALL") {
|
|
48
|
+
version = version.concat("-dev");
|
|
43
49
|
}
|
|
50
|
+
|
|
51
|
+
okToDelete = convertYNToBoolean(inputConfig.confirmDelete);
|
|
44
52
|
}
|
|
45
|
-
else
|
|
46
|
-
|
|
53
|
+
else {
|
|
54
|
+
if (options.params.length >= 5) {
|
|
55
|
+
libraryName = options.params[3]
|
|
56
|
+
version = options.params[4];
|
|
57
|
+
|
|
58
|
+
if (options.params.length >=6 ) {
|
|
59
|
+
const okToDel = options.params[5];
|
|
60
|
+
okToDelete = !!(okToDel === 'Y' || okToDel === 'y' || okToDel === true || okToDel === 'true');
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
else if (options.params.length >= 4) {
|
|
64
|
+
libraryName = options.params[3];
|
|
65
|
+
}
|
|
47
66
|
}
|
|
48
67
|
|
|
68
|
+
|
|
69
|
+
|
|
49
70
|
await deleteLibraryVersion(libraryName, version, okToDelete);
|
|
50
71
|
|
|
51
72
|
|
|
@@ -23,7 +23,9 @@ import {
|
|
|
23
23
|
cleanUpTemp,
|
|
24
24
|
hasArchives,
|
|
25
25
|
restoreFromArchive,
|
|
26
|
-
forceDefaultsUpdate
|
|
26
|
+
forceDefaultsUpdate,
|
|
27
|
+
getUseInputConfig,
|
|
28
|
+
getInputConfigForCommand
|
|
27
29
|
} from '../../util.js';
|
|
28
30
|
import { TASKS_CONFIG_JSON_FILENAME, ARCHIVES_PATH, TEMP_PATH } from '../../constants.js';
|
|
29
31
|
import { getFilePathQuestions, getFileNameQuestions, updateTempArchive, updateSavedFilePath } from './helper.js';
|
|
@@ -395,6 +397,8 @@ export default async options => {
|
|
|
395
397
|
|
|
396
398
|
await checkPathAccess(pegaConfigJsonPath);
|
|
397
399
|
const isLibraryBased = getLibraryBased();
|
|
400
|
+
const useInputConfig = getUseInputConfig();
|
|
401
|
+
|
|
398
402
|
if (!isLibraryBased) {
|
|
399
403
|
console.log(`Command only supported for ${chalk.bold.green('library mode')} components.`)
|
|
400
404
|
process.exit();
|
|
@@ -415,22 +419,33 @@ export default async options => {
|
|
|
415
419
|
}
|
|
416
420
|
else {
|
|
417
421
|
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
+
let filePath;
|
|
423
|
+
let fileName;
|
|
424
|
+
|
|
425
|
+
if (useInputConfig) {
|
|
426
|
+
const inputConfig = await getInputConfigForCommand("importLibVersion");
|
|
427
|
+
filePath = inputConfig.fileLocation;
|
|
428
|
+
fileName = inputConfig.fileName;
|
|
422
429
|
|
|
423
|
-
if (!zipFileList || zipFileList.length === 0) {
|
|
424
|
-
console.log(chalk.red.bold(`No zip files exist at path: ${filePath}`));
|
|
425
|
-
process.exit();
|
|
426
430
|
}
|
|
431
|
+
else {
|
|
432
|
+
const filePathQuestions = await getFilePathQuestions();
|
|
433
|
+
const filePathAnswers = await inquirer.prompt(filePathQuestions);
|
|
434
|
+
({ filePath } = filePathAnswers);
|
|
435
|
+
const zipFileList = await getZipFileList(filePath);
|
|
436
|
+
|
|
437
|
+
if (!zipFileList || zipFileList.length === 0) {
|
|
438
|
+
console.log(chalk.red.bold(`No zip files exist at path: ${filePath}`));
|
|
439
|
+
process.exit();
|
|
440
|
+
}
|
|
427
441
|
|
|
428
|
-
|
|
442
|
+
await updateSavedFilePath(filePath);
|
|
429
443
|
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
444
|
+
const fileNameQuestions = await getFileNameQuestions(zipFileList);
|
|
445
|
+
const fileNameAnswers = await inquirer.prompt(fileNameQuestions);
|
|
446
|
+
({fileName} = fileNameAnswers);
|
|
433
447
|
|
|
448
|
+
}
|
|
434
449
|
|
|
435
450
|
await importArch( filePath, fileName, hasArch);
|
|
436
451
|
|
|
@@ -438,8 +453,6 @@ export default async options => {
|
|
|
438
453
|
// to keep what was entered as the latest
|
|
439
454
|
await updateSavedFilePath(filePath);
|
|
440
455
|
|
|
441
|
-
|
|
442
|
-
|
|
443
456
|
}
|
|
444
457
|
|
|
445
458
|
addDebugLog("importArchive", "END", "-");
|
|
@@ -14,7 +14,10 @@ import {
|
|
|
14
14
|
addDebugLog,
|
|
15
15
|
checkLibraryAndArchives,
|
|
16
16
|
getConfigDefaults,
|
|
17
|
-
getComponents
|
|
17
|
+
getComponents,
|
|
18
|
+
getUseInputConfig,
|
|
19
|
+
getInputConfigForCommand,
|
|
20
|
+
convertYNToBoolean
|
|
18
21
|
} from '../../util.js';
|
|
19
22
|
import { TASKS_CONFIG_JSON_FILENAME } from '../../constants.js';
|
|
20
23
|
import { getFilePathQuestions, getFileNameQuestions, updateSavedFilePath } from './helper.js';
|
|
@@ -156,6 +159,8 @@ addDebugLog("renameComponent", `library: ${library}, componentKey: ${componentKe
|
|
|
156
159
|
export const importComp = async(filePath, fileName, askValidate) => {
|
|
157
160
|
addDebugLog("importComp", `filePath: ${filePath}, fileName: ${fileName}`, "");
|
|
158
161
|
|
|
162
|
+
const useInputConfig = getUseInputConfig();
|
|
163
|
+
|
|
159
164
|
const currentDirectory = process.cwd();
|
|
160
165
|
// const compDirectory = join(currentDirectory, "src", "components");
|
|
161
166
|
|
|
@@ -166,6 +171,8 @@ addDebugLog("importComp", `filePath: ${filePath}, fileName: ${fileName}`, "");
|
|
|
166
171
|
let configData;
|
|
167
172
|
let newName = "";
|
|
168
173
|
let newLabel = "";
|
|
174
|
+
let proceedAs;
|
|
175
|
+
|
|
169
176
|
|
|
170
177
|
if (fs.existsSync(copyDir)) {
|
|
171
178
|
configData = fs.readFileSync(join(copyDir, "/config.json"), { encoding: 'utf8' });
|
|
@@ -178,66 +185,96 @@ addDebugLog("importComp", `filePath: ${filePath}, fileName: ${fileName}`, "");
|
|
|
178
185
|
|
|
179
186
|
if (currentCompList && currentCompList.includes(potentialCompKey)) {
|
|
180
187
|
console.log(`\nComponent ${chalk.yellow(`${potentialCompKey}`)} already exists.`);
|
|
181
|
-
const proceedAnswers = await inquirer.prompt([
|
|
182
188
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
if (useInputConfig) {
|
|
192
|
+
const inputConfig = await getInputConfigForCommand("importComponent");
|
|
193
|
+
proceedAs = inputConfig.proceedIfExists;
|
|
194
|
+
|
|
195
|
+
newName = inputConfig?.newComponentName;
|
|
196
|
+
newLabel = inputConfig?.newComponentLabel;
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
switch (proceedAs) {
|
|
200
|
+
case 'No import':
|
|
201
|
+
// removed copied
|
|
202
|
+
// fs.rmSync(copyDir, { recursive: true, force: true, maxRetries: 2 });
|
|
203
|
+
process.exit();
|
|
204
|
+
break;
|
|
205
|
+
case 'Overwrite':
|
|
206
|
+
// remove existing
|
|
207
|
+
const existingComp = await getComponentDirectoryPath(potentialCompKey);
|
|
208
|
+
fs.rmSync(existingComp, { recursive: true, force: true, maxRetries: 2 });
|
|
209
|
+
break;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
const proceedAnswers = await inquirer.prompt([
|
|
215
|
+
|
|
216
|
+
{
|
|
217
|
+
name: 'proceedAs',
|
|
218
|
+
type: 'rawlist',
|
|
219
|
+
message: `Proceed as ?`,
|
|
220
|
+
default: 'No import',
|
|
221
|
+
choices: ['No import', 'Overwrite', 'New name']
|
|
195
222
|
},
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
223
|
+
{
|
|
224
|
+
name: 'componentName',
|
|
225
|
+
message: 'Enter component name (required)',
|
|
226
|
+
when(answers) {
|
|
227
|
+
return answers.proceedAs === 'New name';
|
|
228
|
+
},
|
|
229
|
+
validate: value => {
|
|
230
|
+
/* value should not be empty
|
|
231
|
+
It should not have spaces
|
|
232
|
+
It should not start with a number
|
|
233
|
+
Only case-insensitive alphanumeric values are allowed
|
|
234
|
+
*/
|
|
235
|
+
if (value && !/^\d/.test(value) && value === sanitize(value)) {
|
|
236
|
+
return true;
|
|
237
|
+
}
|
|
238
|
+
return 'Only alphanumeric values are allowed, starting with alphabets, no spaces.';
|
|
204
239
|
}
|
|
205
|
-
return 'Only alphanumeric values are allowed, starting with alphabets, no spaces.';
|
|
206
|
-
}
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
name: 'componentLabel',
|
|
210
|
-
message: 'Enter component label for display (required)',
|
|
211
|
-
when(answers) {
|
|
212
|
-
return answers.proceedAs === 'New name';
|
|
213
240
|
},
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
241
|
+
{
|
|
242
|
+
name: 'componentLabel',
|
|
243
|
+
message: 'Enter component label for display (required)',
|
|
244
|
+
when(answers) {
|
|
245
|
+
return answers.proceedAs === 'New name';
|
|
246
|
+
},
|
|
247
|
+
validate: value => {
|
|
248
|
+
if (value) {
|
|
249
|
+
return true;
|
|
250
|
+
}
|
|
251
|
+
return 'Please provide value for label';
|
|
217
252
|
}
|
|
218
|
-
return 'Please provide value for label';
|
|
219
253
|
}
|
|
254
|
+
]);
|
|
255
|
+
|
|
256
|
+
proceedAs = proceedAnswers.proceedAs;
|
|
257
|
+
|
|
258
|
+
switch (proceedAs) {
|
|
259
|
+
case 'No import':
|
|
260
|
+
// removed copied
|
|
261
|
+
// fs.rmSync(copyDir, { recursive: true, force: true, maxRetries: 2 });
|
|
262
|
+
process.exit();
|
|
263
|
+
break;
|
|
264
|
+
case 'Overwrite':
|
|
265
|
+
// remove existing
|
|
266
|
+
const existingComp = await getComponentDirectoryPath(potentialCompKey);
|
|
267
|
+
fs.rmSync(existingComp, { recursive: true, force: true, maxRetries: 2 });
|
|
268
|
+
break;
|
|
269
|
+
case 'New name':
|
|
270
|
+
newName = proceedAnswers.componentName;
|
|
271
|
+
newLabel = proceedAnswers.componentLabel;
|
|
272
|
+
break;
|
|
220
273
|
}
|
|
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;
|
|
239
274
|
}
|
|
240
275
|
|
|
276
|
+
|
|
277
|
+
|
|
241
278
|
}
|
|
242
279
|
}
|
|
243
280
|
|
|
@@ -251,30 +288,39 @@ addDebugLog("importComp", `filePath: ${filePath}, fileName: ${fileName}`, "");
|
|
|
251
288
|
console.log(`\n${chalk.green(`${fileName}`)} has been imported as ${chalk.green(`${newCompKey}`)}\n`);
|
|
252
289
|
|
|
253
290
|
if (askValidate) {
|
|
254
|
-
const validateAnswers = await inquirer.prompt([
|
|
255
|
-
{
|
|
256
|
-
name: 'doValidate',
|
|
257
|
-
type: 'confirm',
|
|
258
|
-
message: `Validate ${chalk.yellow(`${newCompKey}`)}`,
|
|
259
|
-
default: true
|
|
260
|
-
}]);
|
|
261
|
-
|
|
262
|
-
if (validateAnswers.doValidate) {
|
|
263
|
-
const args = [ '','', '', `${newCompKey}`];
|
|
264
|
-
let myOptions = {};
|
|
265
|
-
myOptions["params"] = args;
|
|
266
|
-
|
|
267
|
-
await buildComponent(myOptions);
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
|
|
272
291
|
|
|
292
|
+
if (useInputConfig) {
|
|
293
|
+
const inputConfig = await getInputConfigForCommand("importComponent");
|
|
294
|
+
if (convertYNToBoolean(inputConfig.doValidation)) {
|
|
295
|
+
const args = [ '','', '', `${newCompKey}`];
|
|
296
|
+
let myOptions = {};
|
|
297
|
+
myOptions["params"] = args;
|
|
273
298
|
|
|
274
|
-
|
|
299
|
+
await buildComponent(myOptions);
|
|
300
|
+
}
|
|
275
301
|
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
const validateAnswers = await inquirer.prompt([
|
|
305
|
+
{
|
|
306
|
+
name: 'doValidate',
|
|
307
|
+
type: 'confirm',
|
|
308
|
+
message: `Validate ${chalk.yellow(`${newCompKey}`)}`,
|
|
309
|
+
default: true
|
|
310
|
+
}]);
|
|
311
|
+
|
|
312
|
+
if (validateAnswers.doValidate) {
|
|
313
|
+
const args = [ '','', '', `${newCompKey}`];
|
|
314
|
+
let myOptions = {};
|
|
315
|
+
myOptions["params"] = args;
|
|
316
|
+
|
|
317
|
+
await buildComponent(myOptions);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
276
320
|
|
|
321
|
+
}
|
|
277
322
|
|
|
323
|
+
}
|
|
278
324
|
|
|
279
325
|
}
|
|
280
326
|
|
|
@@ -321,6 +367,8 @@ export default async options => {
|
|
|
321
367
|
await checkLibraryAndArchives();
|
|
322
368
|
await checkPathAccess(pegaConfigJsonPath);
|
|
323
369
|
|
|
370
|
+
const useInputConfig = getUseInputConfig();
|
|
371
|
+
|
|
324
372
|
addDebugLog("importComponent", "", "+");
|
|
325
373
|
|
|
326
374
|
if (options.params.length >= 5) {
|
|
@@ -340,22 +388,36 @@ addDebugLog("importComponent", "", "+");
|
|
|
340
388
|
}
|
|
341
389
|
else {
|
|
342
390
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
391
|
+
let filePath;
|
|
392
|
+
let fileName;
|
|
393
|
+
|
|
394
|
+
if (useInputConfig) {
|
|
395
|
+
const inputConfig = await getInputConfigForCommand("importComponent");
|
|
396
|
+
filePath = inputConfig.fileLocation;
|
|
397
|
+
fileName = inputConfig.fileName;
|
|
398
|
+
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
401
|
+
const filePathQuestions = await getFilePathQuestions();
|
|
402
|
+
const filePathAnswers = await inquirer.prompt(filePathQuestions);
|
|
403
|
+
({ filePath } = filePathAnswers);
|
|
404
|
+
|
|
405
|
+
const compFileList = await getComponentList(filePath);
|
|
406
|
+
|
|
407
|
+
if (!compFileList || compFileList.length === 0) {
|
|
408
|
+
console.log(chalk.red.bold(`No component files exist at path: ${filePath}`));
|
|
409
|
+
process.exit();
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
await updateSavedFilePath(filePath);
|
|
346
413
|
|
|
347
|
-
|
|
414
|
+
const fileNameQuestions = await getFileNameQuestions(compFileList);
|
|
415
|
+
const fileNameAnswers = await inquirer.prompt(fileNameQuestions);
|
|
416
|
+
({fileName} = fileNameAnswers);
|
|
348
417
|
|
|
349
|
-
if (!compFileList || compFileList.length === 0) {
|
|
350
|
-
console.log(chalk.red.bold(`No component files exist at path: ${filePath}`));
|
|
351
|
-
process.exit();
|
|
352
418
|
}
|
|
353
419
|
|
|
354
|
-
await updateSavedFilePath(filePath);
|
|
355
420
|
|
|
356
|
-
const fileNameQuestions = await getFileNameQuestions(compFileList);
|
|
357
|
-
const fileNameAnswers = await inquirer.prompt(fileNameQuestions);
|
|
358
|
-
const {fileName} = fileNameAnswers;
|
|
359
421
|
|
|
360
422
|
await importComp( filePath, fileName, true);
|
|
361
423
|
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
},
|
|
102
102
|
"devDependencies": {
|
|
103
103
|
"@pega/configs": "^0.15.1",
|
|
104
|
-
"@pega/custom-dx-components": "~24.2.
|
|
104
|
+
"@pega/custom-dx-components": "~24.2.13",
|
|
105
105
|
"@pega/pcore-pconnect-typedefs": "3.2.1",
|
|
106
106
|
"@storybook/addon-actions": "^7.6.19",
|
|
107
107
|
"@storybook/addon-essentials": "^7.6.19",
|
|
@@ -6,7 +6,7 @@ import fs from 'fs';
|
|
|
6
6
|
import validate from '../validator/index.js';
|
|
7
7
|
import bundleComponent from '../bundle/index.js';
|
|
8
8
|
import { lintComponent } from '../linter/index.js';
|
|
9
|
-
import { getComponentDirectoryPath, showVersion, getLibraryBased, addDebugLog, getPegaServerConfig, updateServerConfigRuleSetAndVersion, checkLibraryAndArchives, getConfigDevBuild, checkJWTExpiration, getConfigDefaults } from '../../util.js';
|
|
9
|
+
import { getComponentDirectoryPath, showVersion, getLibraryBased, getUseInputConfig, addDebugLog, getPegaServerConfig, updateServerConfigRuleSetAndVersion, checkLibraryAndArchives, getConfigDevBuild, checkJWTExpiration, getConfigDefaults, getInputConfigForCommand } from '../../util.js';
|
|
10
10
|
|
|
11
11
|
import { getPublishComponentQuestions, publishComponentToServer, zipComponent } from './helper.js';
|
|
12
12
|
import { default as buildLibrary } from '../build-lib/index.js';
|
|
@@ -21,6 +21,7 @@ export default async options => {
|
|
|
21
21
|
await showVersion();
|
|
22
22
|
await checkLibraryAndArchives();
|
|
23
23
|
const isLibraryBased = getLibraryBased();
|
|
24
|
+
const useInputConfig = getUseInputConfig();
|
|
24
25
|
|
|
25
26
|
addDebugLog("publish", "", "+");
|
|
26
27
|
|
|
@@ -37,34 +38,49 @@ addDebugLog("publish", "", "+");
|
|
|
37
38
|
const currentVersion = orgLib.buildVersion;
|
|
38
39
|
|
|
39
40
|
|
|
41
|
+
if (useInputConfig) {
|
|
42
|
+
const inputConfig = await getInputConfigForCommand("publish");
|
|
43
|
+
|
|
44
|
+
console.log("Input config: ");
|
|
45
|
+
console.log(inputConfig);
|
|
46
|
+
|
|
47
|
+
if (inputConfig.okToPublish ) {
|
|
48
|
+
if (devBuild || (!devBuild && inputConfig.okToPublishPermanent)) {
|
|
49
|
+
okToPublish = true;
|
|
50
|
+
}
|
|
40
51
|
|
|
41
|
-
const publishThisVersion = await inquirer.prompt([
|
|
42
|
-
{
|
|
43
|
-
name: 'confirmPublish',
|
|
44
|
-
type: 'confirm',
|
|
45
|
-
message: `Publish ${chalk.bold.green(`${orgLib.displayLibVersion}`)}, proceed ?`,
|
|
46
|
-
default: true
|
|
47
52
|
}
|
|
48
|
-
]);
|
|
49
53
|
|
|
50
|
-
if (publishThisVersion.confirmPublish) {
|
|
51
|
-
okToPublish = true;
|
|
52
54
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
okToPublish = false;
|
|
56
|
-
console.log("");
|
|
57
|
-
const publishAnswers = await inquirer.prompt([
|
|
55
|
+
else {
|
|
56
|
+
const publishThisVersion = await inquirer.prompt([
|
|
58
57
|
{
|
|
59
58
|
name: 'confirmPublish',
|
|
60
59
|
type: 'confirm',
|
|
61
|
-
message: `
|
|
62
|
-
default:
|
|
60
|
+
message: `Publish ${chalk.bold.green(`${orgLib.displayLibVersion}`)}, proceed ?`,
|
|
61
|
+
default: true
|
|
63
62
|
}
|
|
64
63
|
]);
|
|
65
|
-
|
|
64
|
+
|
|
65
|
+
if (publishThisVersion.confirmPublish) {
|
|
66
66
|
okToPublish = true;
|
|
67
67
|
}
|
|
68
|
+
|
|
69
|
+
if (okToPublish && !devBuild) {
|
|
70
|
+
okToPublish = false;
|
|
71
|
+
console.log("");
|
|
72
|
+
const publishAnswers = await inquirer.prompt([
|
|
73
|
+
{
|
|
74
|
+
name: 'confirmPublish',
|
|
75
|
+
type: 'confirm',
|
|
76
|
+
message: `You are about to publish a ${chalk.bold.yellow('PRODUCTION')} version which can ${chalk.bold.yellow('NOT')} be deleted, proceed ?`,
|
|
77
|
+
default: false
|
|
78
|
+
}
|
|
79
|
+
]);
|
|
80
|
+
if (publishAnswers.confirmPublish) {
|
|
81
|
+
okToPublish = true;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
68
84
|
}
|
|
69
85
|
|
|
70
86
|
if (okToPublish) {
|
|
@@ -4,7 +4,7 @@ import chalk from 'chalk';
|
|
|
4
4
|
|
|
5
5
|
import validate from '../validator/index.js';
|
|
6
6
|
import { lintComponent } from '../linter/index.js';
|
|
7
|
-
import { getComponentDirectoryPath, showVersion, getC11NB2STokenAndStaticServer, getLocalLibraryVersions, getLibraryBased, deletePublishExtras, addDebugLog, checkLibraryAndArchives, checkJWTExpiration, getConfigDefaults } from '../../util.js';
|
|
7
|
+
import { getComponentDirectoryPath, showVersion, getC11NB2STokenAndStaticServer, getLocalLibraryVersions, getLibraryBased, deletePublishExtras, addDebugLog, checkLibraryAndArchives, checkJWTExpiration, getConfigDefaults, getUseInputConfig, getInputConfigForCommand } from '../../util.js';
|
|
8
8
|
|
|
9
9
|
import { publishLib, listLibJSONResponse, deleteLibVersion } from '@pega/constellation-dx-components-build-utils/index.js';
|
|
10
10
|
|
|
@@ -178,6 +178,11 @@ addDebugLog("publishLibrary", "", "+");
|
|
|
178
178
|
({version} = versionAnswers);
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
+
const useInputConfig = getUseInputConfig();
|
|
182
|
+
let inputConfig = {};
|
|
183
|
+
if (useInputConfig) {
|
|
184
|
+
inputConfig = await getInputConfigForCommand("publish");
|
|
185
|
+
}
|
|
181
186
|
|
|
182
187
|
let okToPublish = true;
|
|
183
188
|
|
|
@@ -190,6 +195,8 @@ addDebugLog("publishLibrary", "", "+");
|
|
|
190
195
|
|
|
191
196
|
if (!version.includes("-dev") && !internalPublish) {
|
|
192
197
|
okToPublish = false;
|
|
198
|
+
|
|
199
|
+
|
|
193
200
|
const publishAnswers = await inquirer.prompt([
|
|
194
201
|
|
|
195
202
|
{
|
|
@@ -204,6 +211,9 @@ addDebugLog("publishLibrary", "", "+");
|
|
|
204
211
|
}
|
|
205
212
|
}
|
|
206
213
|
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
207
217
|
if (noRealPublish) {
|
|
208
218
|
// this is as far as JEST test can go since need server for rest and don't want to use server.
|
|
209
219
|
console.log("OK to publish.");
|
|
@@ -218,8 +228,15 @@ addDebugLog("publishLibrary", "", "+");
|
|
|
218
228
|
|
|
219
229
|
await deletePublishExtras(libraryName, version);
|
|
220
230
|
|
|
231
|
+
if (useInputConfig) {
|
|
232
|
+
if (inputConfig.okToOverride) {
|
|
233
|
+
// to override
|
|
234
|
+
overrideExisting = true;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
221
237
|
|
|
222
|
-
|
|
238
|
+
|
|
239
|
+
if (libVersionExists && !overrideExisting) {
|
|
223
240
|
console.log("\nLibrary " + chalk.bold.yellow(`${libraryName}/${version}`) + " already exists.");
|
|
224
241
|
const questions = [
|
|
225
242
|
{
|
|
@@ -13,6 +13,8 @@ import {
|
|
|
13
13
|
setConfigDevBuild,
|
|
14
14
|
updateConfigVersion,
|
|
15
15
|
checkLibraryAndArchives,
|
|
16
|
+
getUseInputConfig,
|
|
17
|
+
getInputConfigForCommand,
|
|
16
18
|
forceDefaultsUpdate } from '../../util.js';
|
|
17
19
|
import { showCurrentStatus } from '../show-status/index.js';
|
|
18
20
|
|
|
@@ -126,6 +128,8 @@ addDebugLog("setPermanent", "", "");
|
|
|
126
128
|
|
|
127
129
|
export default async options => {
|
|
128
130
|
const isLibraryBased = getLibraryBased();
|
|
131
|
+
const useInputConfig = getUseInputConfig();
|
|
132
|
+
|
|
129
133
|
if (!isLibraryBased) {
|
|
130
134
|
console.log(`Command only supported for ${chalk.bold.green('library mode')} components.`);
|
|
131
135
|
process.exit();
|
|
@@ -136,9 +140,17 @@ addDebugLog("setPerm", "", "+");
|
|
|
136
140
|
await checkLibraryAndArchives();
|
|
137
141
|
|
|
138
142
|
let inputYN = "";
|
|
143
|
+
if (useInputConfig) {
|
|
144
|
+
const inputConfig = await getInputConfigForCommand("setPermanent");
|
|
145
|
+
inputYN = inputConfig.makePermanent;
|
|
146
|
+
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
|
|
150
|
+
if (options.params.length >= 4) {
|
|
151
|
+
inputYN = options.params[3];
|
|
152
|
+
}
|
|
139
153
|
|
|
140
|
-
if (options.params.length >= 4) {
|
|
141
|
-
inputYN = options.params[3];
|
|
142
154
|
}
|
|
143
155
|
|
|
144
156
|
// await showCurrentStatus();
|