@pega/custom-dx-components 0.25.51 → 0.25.53

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.51",
3
+ "version": "0.25.53",
4
4
  "description": "Utility for building custom UI components",
5
5
  "bin": "./bin/index.js",
6
6
  "keywords": [
@@ -45,6 +45,10 @@ export default async options => {
45
45
  // process and exit
46
46
  if (useInputConfig) {
47
47
  const inputConfig = await getInputConfigForCommand("createLib");
48
+ if (!inputConfig || Object.keys(inputConfig).length === 0) {
49
+ console.log(chalk.redBright("Configured for input config, but no input.config.json file found."));
50
+ process.exit(1);
51
+ }
48
52
 
49
53
  if (convertYNToBoolean(inputConfig.okToContinue)) {
50
54
  const libraryName = inputConfig.libraryName;
@@ -58,6 +58,10 @@ addDebugLog("createVersion", "", "+");
58
58
  // process and no inputs
59
59
  if (useInputConfig) {
60
60
  const inputConfig = await getInputConfigForCommand("createLibVersion");
61
+ if (!inputConfig || Object.keys(inputConfig).length === 0) {
62
+ console.log(chalk.redBright("Configured for input config, but no input.config.json file found."));
63
+ process.exit(1);
64
+ }
61
65
 
62
66
  if (convertYNToBoolean(inputConfig.okToContinue)) {
63
67
  version = inputConfig.libraryVersion;
@@ -236,6 +236,11 @@ addDebugLog("deleteLibrary", "", "+");
236
236
 
237
237
  if (useInputConfig) {
238
238
  const inputConfig = await getInputConfigForCommand("deleteLib");
239
+ if (!inputConfig || Object.keys(inputConfig).length === 0) {
240
+ console.log(chalk.redBright("Configured for input config, but no input.config.json file found."));
241
+ process.exit(1);
242
+ }
243
+
239
244
  libraryName = inputConfig.libraryName;
240
245
  version = inputConfig.libraryVersion;
241
246
  const isPermanent = inputConfig?.isPermanent || "N";
@@ -41,6 +41,11 @@ addDebugLog("deleteVersion", "", "+");
41
41
 
42
42
  if (useInputConfig) {
43
43
  const inputConfig = await getInputConfigForCommand("deleteLibVersion");
44
+ if (!inputConfig || Object.keys(inputConfig).length === 0) {
45
+ console.log(chalk.redBright("Configured for input config, but no input.config.json file found."));
46
+ process.exit(1);
47
+ }
48
+
44
49
  version = inputConfig.libraryVersion;
45
50
  const isPermanent = inputConfig?.isPermanent || "N";
46
51
  let permBuild = convertYNToBoolean(isPermanent);
@@ -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,103 @@ export default async options => {
726
726
 
727
727
  if (useInputConfig) {
728
728
  const inputConfig = await getInputConfigForCommand("importLibVersion");
729
+ if (!inputConfig || Object.keys(inputConfig).length === 0) {
730
+ console.log(chalk.redBright("Configured for input config, but no input.config.json file found."));
731
+ process.exit(1);
732
+ }
733
+
734
+ const serverOrDirectory = inputConfig.serverOrDirectory;
729
735
  const filePath = inputConfig.fileLocation;
730
736
  const fileName = inputConfig.fileName;
737
+ const serverAppName = "ComponentLibraryArchive";
738
+ const serverArchiveName = inputConfig.serverArchiveName;
739
+ const serverArchiveType = "zip";
740
+ const serverRulesetName = inputConfig.serverRulesetName;
741
+ const serverRulesetVersion = inputConfig.serverRulesetVersion;
731
742
 
732
743
 
733
744
  console.log("");
734
745
 
735
- const tasks = new Listr(
736
- [
737
- {
738
- title: `Importing archive`,
739
- task: async () => {
740
- await importArch( filePath, fileName, hasArch);
746
+ if (serverOrDirectory.toLowerCase() === "server") {
747
+ await checkAccessTokenExpiration();
748
+
749
+
750
+ if (serverArchiveName) {
751
+ // ALL option
752
+ const defaultPegaServerConfig = await getPegaServerConfig();
753
+
754
+ let fileName = `${serverArchiveName}.${serverArchiveType}`;
755
+ let fileData;
756
+
757
+ console.log("");
758
+
759
+ const tasks = new Listr(
760
+ [
761
+ {
762
+ title: 'Fetching archive from server',
763
+ task: async () => {
764
+ // get archive
765
+ fileData = await getServerLibraryArchive(serverAppName, serverArchiveName, serverArchiveType, serverRulesetName, serverRulesetVersion);
766
+ }
767
+ },
768
+ {
769
+ title: 'Saving archive in store',
770
+ task: async () => {
771
+ await writeZipBuffer(fileName, fileData.pyFileSource);
772
+
773
+ // import archive
774
+ const currentDirectory = process.cwd();
775
+ const tempDirectory = join(currentDirectory, TEMP_PATH);
776
+
777
+ await importArchServer( tempDirectory, fileName, hasArch);
778
+ }
779
+ }
780
+ ],
781
+ { concurrent: false, exitOnError: true }
782
+ );
783
+
784
+ await tasks.run().catch(err => {
785
+ console.log(chalk.bold.red(err.toString()));
786
+ process.exit(1);
787
+ });
788
+
789
+
790
+
791
+ }
792
+ else {
793
+ // No library with that name
794
+ console.log(chalk.redBright(`No library archives exist on server.`));
795
+ process.exit();
796
+
797
+ }
798
+ }
799
+ else {
800
+ const tasks = new Listr(
801
+ [
802
+ {
803
+ title: `Importing archive`,
804
+ task: async () => {
805
+ await importArch( filePath, fileName, hasArch);
806
+ }
741
807
  }
742
- }
743
- ],
744
- { concurrent: false, exitOnError: true }
745
- );
808
+ ],
809
+ { concurrent: false, exitOnError: true }
810
+ );
746
811
 
747
812
 
748
- await tasks.run().catch(err => {
749
- console.log(chalk.bold.red(err.toString()));
750
- process.exit(1);
751
- });
813
+ await tasks.run().catch(err => {
814
+ console.log(chalk.bold.red(err.toString()));
815
+ process.exit(1);
816
+ });
817
+
818
+ console.log("");
819
+
820
+ // reapply to save if changed, because imported task.config may have overriden and we want
821
+ // to keep what was entered as the latest
822
+ await updateSavedFilePath(filePath);
823
+ }
752
824
 
753
- console.log("");
754
825
 
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
826
 
759
827
  }
760
828
  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.51",
110
+ "@pega/custom-dx-components": "~0.25.53",
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",
@@ -75,6 +75,10 @@ addDebugLog("publish", "", "+");
75
75
 
76
76
  if (useInputConfig) {
77
77
  const inputConfig = await getInputConfigForCommand("publish");
78
+ if (!inputConfig || Object.keys(inputConfig).length === 0) {
79
+ console.log(chalk.redBright("Configured for input config, but no input.config.json file found."));
80
+ process.exit(1);
81
+ }
78
82
 
79
83
  const okToPubPerm = inputConfig?.okToPublishPermanent || "Y";
80
84
  const okToPublishPerm = convertYNToBoolean(okToPubPerm);
@@ -141,6 +141,11 @@ addDebugLog("setPerm", "", "+");
141
141
 
142
142
  if (useInputConfig) {
143
143
  const inputConfig = await getInputConfigForCommand("setPermanent");
144
+ if (!inputConfig || Object.keys(inputConfig).length === 0) {
145
+ console.log(chalk.redBright("Configured for input config, but no input.config.json file found."));
146
+ process.exit(1);
147
+ }
148
+
144
149
  inputYN = inputConfig.makePermanent;
145
150
 
146
151
  }
@@ -62,6 +62,10 @@ addDebugLog("switchLibrary", "", "+");
62
62
  // process and no inputs
63
63
  if (useInputConfig) {
64
64
  const inputConfig = await getInputConfigForCommand("switchLib");
65
+ if (!inputConfig || Object.keys(inputConfig).length === 0) {
66
+ console.log(chalk.redBright("Configured for input config, but no input.config.json file found."));
67
+ process.exit(1);
68
+ }
65
69
 
66
70
  if (convertYNToBoolean(inputConfig.okToContinue)) {
67
71
  const newLibraryName = inputConfig.libraryName;
@@ -62,6 +62,10 @@ addDebugLog("switchVersion", "", "+");
62
62
  // process and no inputs
63
63
  if (useInputConfig) {
64
64
  const inputConfig = await getInputConfigForCommand("switchLibVersion");
65
+ if (!inputConfig || Object.keys(inputConfig).length === 0) {
66
+ console.log(chalk.redBright("Configured for input config, but no input.config.json file found."));
67
+ process.exit(1);
68
+ }
65
69
 
66
70
  okToContinue = convertYNToBoolean(inputConfig.okToContinue);
67
71
  if (okToContinue) {
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}`;
@@ -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
 
@@ -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}`)} is a branch ruleset.\nBranch rulesets are not supported.`
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);