@pega/custom-dx-components 0.25.28 → 0.25.30

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.30",
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
@@ -238,6 +238,12 @@ export const importArch = async(filePath, fileName, hadArchive) => {
238
238
  addDebugLog("importArch", `filePath: ${filePath}, fileName: ${fileName}`, "");
239
239
 
240
240
  const currentDirectory = process.cwd();
241
+
242
+ const storeDirectory = join (currentDirectory, ARCHIVES_PATH);
243
+ if (!fs.existsSync(storeDirectory)) {
244
+ fs.mkdirSync(storeDirectory);
245
+ }
246
+
241
247
  const tempDirectory = join(currentDirectory, TEMP_PATH);
242
248
 
243
249
 
@@ -416,6 +422,11 @@ export const importArchServer = async(filePath, fileName, hadArchive) => {
416
422
  addDebugLog("importArch", `filePath: ${filePath}, fileName: ${fileName}`, "");
417
423
 
418
424
  const currentDirectory = process.cwd();
425
+ const storeDirectory = join (currentDirectory, ARCHIVES_PATH);
426
+ if (!fs.existsSync(storeDirectory)) {
427
+ fs.mkdirSync(storeDirectory);
428
+ }
429
+
419
430
  const tempDirectory = join(currentDirectory, TEMP_PATH);
420
431
 
421
432
  const zipFilePath = join(filePath, fileName);
@@ -632,6 +643,11 @@ export const writeZipBuffer = async(fileName, fileBuffer) => {
632
643
  const currentDirectory = process.cwd();
633
644
  const tempDirectory = join(currentDirectory, TEMP_PATH);
634
645
 
646
+ const storeDirectory = join (currentDirectory, ARCHIVES_PATH);
647
+ if (!fs.existsSync(storeDirectory)) {
648
+ fs.mkdirSync(storeDirectory);
649
+ }
650
+
635
651
  if (!fs.existsSync (tempDirectory)) {
636
652
  fs.mkdirSync(tempDirectory);
637
653
  }
@@ -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.30",
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
  };
@@ -3,6 +3,7 @@ import chalk from 'chalk';
3
3
  import fetch from 'node-fetch';
4
4
  import { join } from 'path';
5
5
  import fs from 'fs';
6
+ import ora from 'ora';
6
7
 
7
8
  import { zipUnArchiveToTempAndReturnBuffer, constructCompleteUrl, getHttpsAgent, getPegaServerConfig, addDebugLog, getConfigDefaults } from '../../util.js';
8
9
 
@@ -166,16 +167,22 @@ export default async (orgLibName, selectedVersion) => {
166
167
 
167
168
  zipContent = zipContent.replaceAll('"', "");
168
169
 
170
+ let spinner;
169
171
  try {
172
+ console.log("");
173
+ spinner = ora('Exporting to server...\n').start();
170
174
  publishComponentLibraryArchiveToServer(content, zipContent, true )
171
175
  .then( () => {
176
+ spinner.stop();
172
177
  console.log(chalk.green.bold(`Success: Published Archive ${content.libraryName}/${content.version} to server.`));
173
178
  })
174
179
  .catch( (err) => {
180
+ spinner.stop();
175
181
  console.log(chalk.red.bold(err));
176
182
  })
177
183
  }
178
184
  catch (err) {
185
+ spinner.stop();
179
186
  console.log(chalk.bold.red(err.toString()));
180
187
  }
181
188
 
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);