@pega/custom-dx-components 0.25.28 → 0.25.29

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.28",
3
+ "version": "0.25.29",
4
4
  "description": "Utility for building custom UI components",
5
5
  "bin": "./bin/index.js",
6
6
  "scripts": {
@@ -12,12 +12,15 @@ import {
12
12
  addDebugLog,
13
13
  cleanUp,
14
14
  getLibraryBased,
15
+ getLibraryBasedCL,
15
16
  checkLibraryAndArchives,
16
17
  getConfigDefaults,
17
18
  zipVersionAndArchive } from '../../util.js';
18
19
 
19
20
  import { getBuildComponentQuestions } from './helper.js';
20
21
 
22
+ import { buildLibV3 } from '@pega/constellation-dx-components-build-utils/index.js';
23
+
21
24
 
22
25
  export function getCustomTasks(componentKey, sourceMap, devBuild, options, showStats, skipBuild) {
23
26
  addDebugLog("getCustomTasks", `componentKey: ${componentKey}, sourceMap: ${sourceMap}, devBuild: ${devBuild}, skipBuild: ${skipBuild}`, "");
@@ -54,6 +57,7 @@ export default async options => {
54
57
  await checkLibraryAndArchives();
55
58
 
56
59
  const isLibraryBased = getLibraryBased();
60
+ const isLibraryBasedCL = getLibraryBasedCL();
57
61
 
58
62
  addDebugLog("buildAllComponents", "", "+");
59
63
  const components = await getComponents();
@@ -99,7 +103,7 @@ addDebugLog("buildAllComponents", "", "+");
99
103
  }
100
104
 
101
105
  // if skipBuild, then do a build here as opposed to every step (v1 is every step, v2, just once)
102
- if (skipBuild && firstComponent) {
106
+ if (skipBuild && firstComponent && !isLibraryBasedCL) {
103
107
  console.log();
104
108
  console.log(chalk.bold.green("Validation compile..."));
105
109
  await bundleComponent(firstComponent, sourceMap, devBuild, showStats);
@@ -107,6 +111,21 @@ addDebugLog("buildAllComponents", "", "+");
107
111
  await zipVersionAndArchive(confDef.currentOrgLib, confDef.buildVersion);
108
112
  }
109
113
 
114
+ if (isLibraryBasedCL) {
115
+ console.log();
116
+ console.log(chalk.bold.green("Validation via build library..."));
117
+ const confDef = getConfigDefaults();
118
+ const organization = confDef.organization;
119
+ const library = confDef.library;
120
+
121
+ const buildLibName = organization.concat('_').concat(library);
122
+
123
+ buildLibV3(
124
+ buildLibName,
125
+ confDef.buildVersion
126
+ );
127
+ }
128
+
110
129
 
111
130
 
112
131
  // once done, remove leftover directories
@@ -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.28",
110
+ "@pega/custom-dx-components": "~0.25.29",
111
111
  "@pega/pcore-pconnect-typedefs": "^4.1.0-alpha.1",
112
112
  "@storybook/addon-actions": "^8.6.12",
113
113
  "@storybook/addon-essentials": "^8.6.12",
@@ -218,27 +218,28 @@ addDebugLog("publishComponentToServer", `data: ${data}`, "");
218
218
 
219
219
  try {
220
220
  const respData = isLaunchpad ? await response.text() : await response.json();
221
- console.log(chalk.bold.green(`Success : ${isLaunchpad ? respData : respData.message}`));
222
-
223
221
  if (status === 500) {
224
222
  status = 999;
225
- throw new Error(respData.message);
223
+ throw Error( "\n" + respData.message);
226
224
  }
225
+
226
+ console.log(chalk.bold.green(`Success : ${isLaunchpad ? respData : respData.message}`));
227
+
227
228
  } catch (err) {
228
229
  if (status === 500) {
229
230
  throw new Error(
230
231
  `Error occurred in authentication. Please regenerate using authenticate`
231
232
  );
232
233
  } else if (status === 999) {
233
- throw new Error(err);
234
+ throw Error(err);
234
235
  }
235
236
  }
236
237
  } else {
237
- throw new Error(`Error occurred in authentication. Please regenerate using authenticate`);
238
+ throw new Error(`Error occurred in authentication. Please regenerate using authenticate`);
238
239
  }
239
240
  } catch (err) {
240
241
  // throw new Error(`Error occurred in authentication. Please regenerate using authenticate`);
241
- throw new Error(err);
242
+ throw Error(err);
242
243
  }
243
244
  }
244
245
  };
package/src/util.js CHANGED
@@ -2444,8 +2444,12 @@ if (showDebug) addDebugLog("restoreFromArchive", `fileName: ${fileName}, orgLibN
2444
2444
  const archiveDirectory = join (currentDirectory, ARCHIVES_PATH, `${orgLibName}`, `${version}`);
2445
2445
  const archFileName = join(archiveDirectory, fileName);
2446
2446
 
2447
- await unZipFromArchive(archFileName);
2448
2447
 
2448
+ if (!fs.existsSync(archiveDirectory)) {
2449
+ throw new Error (`Archive ${orgLibName}/${version} does NOT exist.`);
2450
+ }
2451
+
2452
+ await unZipFromArchive(archFileName);
2449
2453
 
2450
2454
  const tempPackagePath = join (tempDirectory, PACKAGE_JSON_FILENAME);
2451
2455
  const currentPackagePath = join(currentDirectory, PACKAGE_JSON_FILENAME);