@pega/custom-dx-components 0.25.50 → 0.25.52

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/custom-dx-components",
3
- "version": "0.25.50",
3
+ "version": "0.25.52",
4
4
  "description": "Utility for building custom UI components",
5
5
  "bin": "./bin/index.js",
6
6
  "keywords": [
@@ -373,7 +373,7 @@ addDebugLog("createAll", "", "+");
373
373
  data = data && JSON.parse(data);
374
374
 
375
375
  if (!data[COMPONENTS_DIRECTORY_PATH]) {
376
- console.error(`${chalk.red.bold('ERROR')} Could not able find components directory path in config.json`);
376
+ console.error(`${chalk.red.bold('ERROR')} Unable to find components directory path in config.json`);
377
377
  process.exit(1);
378
378
  }
379
379
 
@@ -60,7 +60,7 @@ addDebugLog("getLaunchPadFilterQuestions", "", "");
60
60
 
61
61
  if (!data[COMPONENTS_DIRECTORY_PATH]) {
62
62
  console.error(
63
- `${chalk.red.bold('ERROR')} Could not able find components directory path in config.json`
63
+ `${chalk.red.bold('ERROR')} Unable to find components directory path in config.json`
64
64
  );
65
65
  process.exit(1);
66
66
  }
@@ -55,7 +55,7 @@ addDebugLog("getLaunchPadFilterQuestions", "", "");
55
55
 
56
56
  if (!data[COMPONENTS_DIRECTORY_PATH]) {
57
57
  console.error(
58
- `${chalk.red.bold('ERROR')} Could not able find components directory path in config.json`
58
+ `${chalk.red.bold('ERROR')} Unable to find components directory path in config.json`
59
59
  );
60
60
  process.exit(1);
61
61
  }
@@ -5,6 +5,7 @@ import { join } from 'path';
5
5
  import inquirer from 'inquirer';
6
6
  import ncp from 'ncp';
7
7
  import chalk from 'chalk';
8
+ import { Listr } from 'listr2';
8
9
 
9
10
  import {
10
11
  checkPathAccess,
@@ -145,6 +146,7 @@ addDebugLog("exportCLArch", `exportPath: ${exportPath}, orgLibName: ${orgLibName
145
146
  // archive it
146
147
  output = await zipVersionAndArchiveCL(configDef.currentOrgLib, configDef.buildVersion);
147
148
 
149
+
148
150
  // if archiving, need to wait before copying
149
151
  output.on('close', function() {
150
152
  fs.copyFileSync(archFileName, exportFile );
@@ -402,7 +404,26 @@ export default async options => {
402
404
  else {
403
405
  await checkAccessTokenExpiration();
404
406
 
405
- // publish to server
407
+
408
+ const tasks = new Listr(
409
+ [
410
+ {
411
+ title: 'Saving local archive',
412
+ task: async () => {
413
+
414
+ // local archive so it will get stored
415
+ await zipVersionAndArchive(orgLibName, selectedVersion);
416
+ }
417
+ }
418
+ ],
419
+ { concurrent: false, exitOnError: true }
420
+ );
421
+
422
+ await tasks.run().catch(err => {
423
+ console.log(chalk.bold.red(err.toString()));
424
+ process.exit(1);
425
+ });
426
+
406
427
  await publishArchive(orgLibName, selectedVersion);
407
428
 
408
429
  }
@@ -726,35 +726,98 @@ export default async options => {
726
726
 
727
727
  if (useInputConfig) {
728
728
  const inputConfig = await getInputConfigForCommand("importLibVersion");
729
+ const serverOrDirectory = inputConfig.serverOrDirectory;
729
730
  const filePath = inputConfig.fileLocation;
730
731
  const fileName = inputConfig.fileName;
732
+ const serverAppName = "ComponentLibraryArchive";
733
+ const serverArchiveName = inputConfig.serverArchiveName;
734
+ const serverArchiveType = "zip";
735
+ const serverRulesetName = inputConfig.serverRulesetName;
736
+ const serverRulesetVersion = inputConfig.serverRulesetVersion;
731
737
 
732
738
 
733
739
  console.log("");
734
740
 
735
- const tasks = new Listr(
736
- [
737
- {
738
- title: `Importing archive`,
739
- task: async () => {
740
- await importArch( filePath, fileName, hasArch);
741
+ if (serverOrDirectory.toLowerCase() === "server") {
742
+ await checkAccessTokenExpiration();
743
+
744
+
745
+ if (serverArchiveName) {
746
+ // ALL option
747
+ const defaultPegaServerConfig = await getPegaServerConfig();
748
+
749
+ let fileName = `${serverArchiveName}.${serverArchiveType}`;
750
+ let fileData;
751
+
752
+ console.log("");
753
+
754
+ const tasks = new Listr(
755
+ [
756
+ {
757
+ title: 'Fetching archive from server',
758
+ task: async () => {
759
+ // get archive
760
+ fileData = await getServerLibraryArchive(serverAppName, serverArchiveName, serverArchiveType, serverRulesetName, serverRulesetVersion);
761
+ }
762
+ },
763
+ {
764
+ title: 'Saving archive in store',
765
+ task: async () => {
766
+ await writeZipBuffer(fileName, fileData.pyFileSource);
767
+
768
+ // import archive
769
+ const currentDirectory = process.cwd();
770
+ const tempDirectory = join(currentDirectory, TEMP_PATH);
771
+
772
+ await importArchServer( tempDirectory, fileName, hasArch);
773
+ }
774
+ }
775
+ ],
776
+ { concurrent: false, exitOnError: true }
777
+ );
778
+
779
+ await tasks.run().catch(err => {
780
+ console.log(chalk.bold.red(err.toString()));
781
+ process.exit(1);
782
+ });
783
+
784
+
785
+
786
+ }
787
+ else {
788
+ // No library with that name
789
+ console.log(chalk.redBright(`No library archives exist on server.`));
790
+ process.exit();
791
+
792
+ }
793
+ }
794
+ else {
795
+ const tasks = new Listr(
796
+ [
797
+ {
798
+ title: `Importing archive`,
799
+ task: async () => {
800
+ await importArch( filePath, fileName, hasArch);
801
+ }
741
802
  }
742
- }
743
- ],
744
- { concurrent: false, exitOnError: true }
745
- );
803
+ ],
804
+ { concurrent: false, exitOnError: true }
805
+ );
746
806
 
747
807
 
748
- await tasks.run().catch(err => {
749
- console.log(chalk.bold.red(err.toString()));
750
- process.exit(1);
751
- });
808
+ await tasks.run().catch(err => {
809
+ console.log(chalk.bold.red(err.toString()));
810
+ process.exit(1);
811
+ });
812
+
813
+ console.log("");
814
+
815
+ // reapply to save if changed, because imported task.config may have overriden and we want
816
+ // to keep what was entered as the latest
817
+ await updateSavedFilePath(filePath);
818
+ }
752
819
 
753
- console.log("");
754
820
 
755
- // reapply to save if changed, because imported task.config may have overriden and we want
756
- // to keep what was entered as the latest
757
- await updateSavedFilePath(filePath);
758
821
 
759
822
  }
760
823
  else {
@@ -82,9 +82,9 @@
82
82
  "author": "",
83
83
  "license": "Enter License",
84
84
  "dependencies": {
85
- "@pega/cosmos-react-condition-builder": "^8.0.0-build.43.4",
86
- "@pega/cosmos-react-core": "^8.0.0-build.43.4",
87
- "@pega/cosmos-react-work": "^8.0.0-build.43.4",
85
+ "@pega/cosmos-react-condition-builder": "^8.1.0",
86
+ "@pega/cosmos-react-core": "^8.1.0",
87
+ "@pega/cosmos-react-work": "^8.1.0",
88
88
  "@pega/eslint-config": "^0.16.3",
89
89
  "@pega/tsconfig": "^0.16.3",
90
90
  "babel-loader": "^10.0.0",
@@ -107,7 +107,7 @@
107
107
  "@babel/preset-react": "^7.27.1",
108
108
  "@babel/preset-typescript": "^7.27.1",
109
109
  "@pega/configs": "^0.16.3",
110
- "@pega/custom-dx-components": "~0.25.50",
110
+ "@pega/custom-dx-components": "~0.25.52",
111
111
  "@pega/pcore-pconnect-typedefs": "^4.1.0-alpha.1",
112
112
  "@storybook/addon-actions": "^8.6.14",
113
113
  "@storybook/addon-essentials": "^8.6.14",
@@ -57,7 +57,7 @@ addDebugLog("getLaunchPadFilterQuestions", "", "");
57
57
 
58
58
  if (!data[COMPONENTS_DIRECTORY_PATH]) {
59
59
  console.error(
60
- `${chalk.red.bold('ERROR')} Could not able find components directory path in config.json`
60
+ `${chalk.red.bold('ERROR')} Unable to find components directory path in config.json`
61
61
  );
62
62
  process.exit(1);
63
63
  }
@@ -145,7 +145,7 @@ addDebugLog("listLibrary", "", "+");
145
145
  else {
146
146
  // No library with that name
147
147
  console.log(chalk.redBright(`No other library versions for ${libraryName} exist other than current library version.`));
148
- console.log(chalk.redBright(`To see contents for the currnet library version, enter 'npm run list'.`));
148
+ console.log(chalk.redBright(`To see contents for the current library version, enter 'npm run list'.`));
149
149
  addDebugLog("listLibrary", "END", "-");
150
150
  process.exit();
151
151
  }
@@ -29,7 +29,7 @@ addDebugLog("getServerLibraryVersions", `libraryName: ${libraryName}`, "");
29
29
  const tokenAndStaticServer = await getC11NB2STokenAndStaticServer();
30
30
 
31
31
  if (tokenAndStaticServer.C11NB2S === undefined) {
32
- console.log(chalk.redBright("Need to authenticate, missing services token.\nDeleting a library requires authentication to acquire a token to delete."));
32
+ console.log(chalk.redBright("Need to authenticate, missing services token."));
33
33
  process.exit(1);
34
34
  }
35
35
 
@@ -346,7 +346,7 @@ addDebugLog("move", "", "+");
346
346
 
347
347
  if (!data[COMPONENTS_DIRECTORY_PATH]) {
348
348
  console.error(
349
- `${chalk.red.bold('ERROR')} Could not able find components directory path in config.json`
349
+ `${chalk.red.bold('ERROR')} Unable find to components directory path in config.json`
350
350
  );
351
351
  process.exit(1);
352
352
  }
@@ -67,18 +67,18 @@ addDebugLog("updateConfig", `oldComponentKey: ${oldComponentKey}, newComponentKe
67
67
  configData.version = version;
68
68
  configData.description = (description != '') ? description : componentLabel;
69
69
 
70
- if (allowedApplications.trim() === '') {
71
- allowedApplications = [];
72
- } else {
73
- if (allowedApplications.indexOf(',') !== -1) {
74
- allowedApplications = allowedApplications.split(',');
75
- }
76
- allowedApplications = [].concat(allowedApplications);
77
- }
70
+ // if (allowedApplications.trim() === '') {
71
+ // allowedApplications = [];
72
+ // } else {
73
+ // if (allowedApplications.indexOf(',') !== -1) {
74
+ // allowedApplications = allowedApplications.split(',');
75
+ // }
76
+ // allowedApplications = [].concat(allowedApplications);
77
+ // }
78
78
 
79
- allowedApplications = allowedApplications.filter(el => !!el.trim()).map(el => el.trim());
79
+ // allowedApplications = allowedApplications.filter(el => !!el.trim()).map(el => el.trim());
80
80
 
81
- configData.allowedApplications = allowedApplications;
81
+ // configData.allowedApplications = allowedApplications;
82
82
 
83
83
  // stringify "4", makes the json string look like JSON in the file, formated instead of a single line
84
84
  fs.writeFileSync(join(targetDirectory, "/config.json"), JSON.stringify(configData, null, 4), { encoding: 'utf8' });
@@ -199,7 +199,7 @@ addDebugLog("rename", "", "+");
199
199
 
200
200
  if (!data[COMPONENTS_DIRECTORY_PATH]) {
201
201
  console.error(
202
- `${chalk.red.bold('ERROR')} Could not able find components directory path in config.json`
202
+ `${chalk.red.bold('ERROR')} Unable to find components directory path in config.json`
203
203
  );
204
204
  process.exit(1);
205
205
  }
@@ -323,12 +323,12 @@ addDebugLog("rename", "", "+");
323
323
  },
324
324
  when: () => !isLibraryBased
325
325
  },
326
- {
327
- name: 'allowedApplications',
328
- message: 'Please enter the application names to be supported (comma-separated). ',
329
- suffix: 'Keep empty for all applications',
330
- when: () => !isLibraryBased
331
- },
326
+ // {
327
+ // name: 'allowedApplications',
328
+ // message: 'Please enter the application names to be supported (comma-separated). ',
329
+ // suffix: 'Keep empty for all applications',
330
+ // when: () => !isLibraryBased
331
+ // },
332
332
  {
333
333
  name: 'description',
334
334
  message: 'Enter new description for the component (defaults to new label)',
@@ -267,7 +267,7 @@ addDebugLog("renameLibrary", "", "+");
267
267
 
268
268
  if (!data[COMPONENTS_DIRECTORY_PATH]) {
269
269
  console.error(
270
- `${chalk.red.bold('ERROR')} Could not able find components directory path in config.json`
270
+ `${chalk.red.bold('ERROR')} Unable to find components directory path in config.json`
271
271
  );
272
272
  process.exit(1);
273
273
  }
package/src/util.js CHANGED
@@ -184,7 +184,12 @@ export const setUpDefaults = async () => {
184
184
 
185
185
  retrievedConfigData.serverType = data["server-config"].serverType;
186
186
  retrievedConfigData.devBuild = data["server-config"].devBuild;
187
- retrievedConfigData.devServerPort = data["server-config"].devServerPort;
187
+
188
+ // override devBuild for libraryBasedCL, always false.
189
+ if (retrievedConfigData.isLibraryBasedCL) {
190
+ retrievedConfigData.devBuild = false;
191
+ }
192
+ retrievedConfigData.devServerPort = data["server-config"].devServerPort;
188
193
 
189
194
  retrievedConfigData.buildVersion = retrievedConfigData.devBuild ? `${retrievedConfigData.version}-dev` : retrievedConfigData.version;
190
195
  retrievedConfigData.currentOrgLib = `${retrievedConfigData.organization}_${retrievedConfigData.library}`;
@@ -278,7 +283,7 @@ if (showDebug) addDebugLog("checkPathAccess", "END", "-");
278
283
  else {
279
284
  if (showDebug) addDebugLog("checkPathAccess", "path: ".concat(path), "+");
280
285
  const message =
281
- errorMessage || `${chalk.red.bold('ERROR')} Could not able to access path - ${path}`;
286
+ errorMessage || `${chalk.red.bold('ERROR')} Unable to access path - ${path}`;
282
287
  console.error(message);
283
288
  if (showDebug) addDebugLog("checkPathAccess", "END", "-");
284
289
  process.exit(1);
@@ -307,7 +312,7 @@ if (showDebug) addDebugLog("getUseWebPackPromotion", "", "");
307
312
 
308
313
  if (!data[COMPONENTS_DIRECTORY_PATH]) {
309
314
  console.error(
310
- `${chalk.red.bold('ERROR')} Could not able find components directory path in config.json`
315
+ `${chalk.red.bold('ERROR')} Unable to find components directory path in config.json`
311
316
  );
312
317
  process.exit(1);
313
318
  }
@@ -335,7 +340,7 @@ if (showDebug) addDebugLog("updateUseWebPackPromotion", "", "");
335
340
 
336
341
  if (!data[COMPONENTS_DIRECTORY_PATH]) {
337
342
  console.error(
338
- `${chalk.red.bold('ERROR')} Could not able find components directory path in config.json`
343
+ `${chalk.red.bold('ERROR')} Unable to find components directory path in config.json`
339
344
  );
340
345
  process.exit(1);
341
346
  }
@@ -605,7 +610,7 @@ if (showDebug) addDebugLog("deleteLocalComponent", `componentKey: ${componentKey
605
610
 
606
611
  if (!data[COMPONENTS_DIRECTORY_PATH]) {
607
612
  console.error(
608
- `${chalk.red.bold('ERROR')} Could not able find components directory path in config.json`
613
+ `${chalk.red.bold('ERROR')} Unable to find components directory path in config.json`
609
614
  );
610
615
  process.exit(1);
611
616
  }
@@ -1072,6 +1077,10 @@ export const getConfigDevBuild = async() => {
1072
1077
  if (showDebug) addDebugLog("getConfigDevBuild", "", "");
1073
1078
  // const serverConfig = await getPegaServerConfig();
1074
1079
 
1080
+ if (getLibraryBasedCL()) {
1081
+ return false;
1082
+ }
1083
+
1075
1084
  // return serverConfig.devBuild;
1076
1085
  return defaultConfigs.devBuild;
1077
1086
 
@@ -1257,7 +1266,7 @@ if (showDebug) addDebugLog("getComponentDirectoryPath", "", "+");
1257
1266
 
1258
1267
  if (!data[COMPONENTS_DIRECTORY_PATH]) {
1259
1268
  console.error(
1260
- `${chalk.red.bold('ERROR')} Could not able find components directory path in config.json`
1269
+ `${chalk.red.bold('ERROR')} Unable to find components directory path in config.json`
1261
1270
  );
1262
1271
  process.exit(1);
1263
1272
  }
@@ -1340,7 +1349,7 @@ export const showVersion = async () => {
1340
1349
  if (nodeMajorVersion < 22 && nodeMinorVersion < 15 ) {
1341
1350
  console.log(
1342
1351
  chalk.redBright(
1343
- `DX Component Builder - SDK requires node v20.15.0 or greater, current version: ${process.version}`
1352
+ `DX Component Builder - requires node v22.15.0 or greater, current version: ${process.version}`
1344
1353
  )
1345
1354
  );
1346
1355
  process.exit(1);
@@ -1363,7 +1372,7 @@ export const checkForBranch = async(rulesetName) => {
1363
1372
  if (rulesetName.toLowerCase().indexOf("_branch") >= 0) {
1364
1373
  console.log(
1365
1374
  chalk.redBright(
1366
- `Ruleset ${chalk.bold(`${rulesetName}`)} cannot be a branch ruleset.`
1375
+ `Ruleset ${chalk.bold(`${rulesetName}`)} is a branch ruleset.\nPublishing to branch rulesets are not supported.`
1367
1376
  )
1368
1377
  );
1369
1378
  process.exit(1);
@@ -1451,7 +1460,7 @@ if (showDebug) addDebugLog("deleteInfinityServerComponent", `componentKey: ${com
1451
1460
  if (!response.ok) {
1452
1461
  if (status === 401) {
1453
1462
  throw new Error(
1454
- 'Error occurred in authentication. Please regenerate using authenticate'
1463
+ 'Error occurred in authentication. Please regenerate using authenticate.'
1455
1464
  );
1456
1465
  // console.log(accessTokenUri, refreshToken);
1457
1466
  /* TODO - Handle refresh_token */