@pega/custom-dx-components 0.25.30 → 0.25.31

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.30",
3
+ "version": "0.25.31",
4
4
  "description": "Utility for building custom UI components",
5
5
  "bin": "./bin/index.js",
6
6
  "scripts": {
@@ -138,7 +138,7 @@ addDebugLog("deletePublished", "END", "-");
138
138
  else {
139
139
  // No library with that name
140
140
  const serverConfig = await getPegaServerConfig();
141
- console.log(chalk.redBright(`No server component libraries exist in given ruleset ${chalk.bold(`${serverConfig.rulesetName}:${serverConfig.rulesetVersion}`)}`));
141
+ console.log(chalk.redBright(`No server component libraries exist in given ruleset ${chalk.bold(`${rulesetName}:${rulesetVersion}`)}`));
142
142
  addDebugLog("listPublished", "END", "-");
143
143
  process.exit(1);
144
144
 
@@ -24,13 +24,15 @@ import {
24
24
  unZipFromArchive,
25
25
  zipVersionAndArchive,
26
26
  getLibraryArchiveDirectories,
27
+ getHaveDependencyDifference,
27
28
  hasLibraryAndVersion,
28
29
  cleanUpTemp,
29
30
  hasArchives,
30
31
  restoreFromArchive,
31
32
  forceDefaultsUpdate,
32
33
  getUseInputConfig,
33
- getInputConfigForCommand
34
+ getInputConfigForCommand,
35
+ getPegaServerConfig
34
36
  } from '../../util.js';
35
37
  import { TASKS_CONFIG_JSON_FILENAME, ARCHIVES_PATH, TEMP_PATH } from '../../constants.js';
36
38
  import { getFilePathQuestions, getFileNameQuestions, updateTempArchive, updateSavedFilePath, getServerOrDirectoryQuestion, getLibraryArchiveQuestion, getServerLibraryArchives, getServerLibraryArchive } from './helper.js';
@@ -409,10 +411,13 @@ export const importArch = async(filePath, fileName, hadArchive) => {
409
411
  await forceDefaultsUpdate();
410
412
  await showCurrentStatus();
411
413
 
412
- console.log('\n***************************************************************');
413
- console.log(chalk.bold.yellow('Dependencies have changed between versions, recommend updating.'));
414
- console.log(`>>> PLEASE run ${chalk.bold.yellow("'npm update'")}.`);
415
- console.log('***************************************************************\n');
414
+ if (getHaveDependencyDifference()) {
415
+ console.log('\n***************************************************************');
416
+ console.log(chalk.bold.yellow('Dependencies have changed between versions, recommend updating.'));
417
+ console.log(`>>> PLEASE run ${chalk.bold.yellow("'npm update'")}.`);
418
+ console.log('***************************************************************\n');
419
+ }
420
+
416
421
  }
417
422
 
418
423
 
@@ -604,10 +609,13 @@ addDebugLog("importArch", `filePath: ${filePath}, fileName: ${fileName}`, "");
604
609
  await forceDefaultsUpdate();
605
610
  await showCurrentStatus();
606
611
 
607
- console.log('\n***************************************************************');
608
- console.log(chalk.bold.yellow('Dependencies have changed between versions, recommend updating.'));
609
- console.log(`>>> PLEASE run ${chalk.bold.yellow("'npm update'")}.`);
610
- console.log('***************************************************************\n');
612
+ if (getHaveDependencyDifference()) {
613
+ console.log('\n***************************************************************');
614
+ console.log(chalk.bold.yellow('Dependencies have changed between versions, recommend updating.'));
615
+ console.log(`>>> PLEASE run ${chalk.bold.yellow("'npm update'")}.`);
616
+ console.log('***************************************************************\n');
617
+ }
618
+
611
619
  }
612
620
 
613
621
 
@@ -749,6 +757,9 @@ export default async options => {
749
757
 
750
758
  if (archiveVersions && archiveVersions.pxResults.length > 0) {
751
759
  // ALL option
760
+ const defaultPegaServerConfig = await getPegaServerConfig();
761
+
762
+ console.log(`\nRetrieved archives from server ${chalk.bold.green(`${defaultPegaServerConfig.server}`)}.`)
752
763
 
753
764
  // to name value pairs
754
765
  const archiveResults = archiveVersions["pxResults"].map( archive => ( { value: `${archive.pyApplicationName},${archive.pyFileName},${archive.pyFileType},${archive.pyRuleSet},${archive.pyRuleSetVersion}`, name: `${archive.pyLabel}, ${archive.pyRuleSet}:${archive.pyRuleSetVersion}` }) );
@@ -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.30",
110
+ "@pega/custom-dx-components": "~0.25.31",
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",
@@ -162,7 +162,10 @@ addDebugLog("listPublished", "END", "-");
162
162
 
163
163
 
164
164
  const {app_name, app_version } = await getApplicationAndVersionFromToken();
165
- console.log(chalk.green(`\nList of libraries for Application: ${chalk.bold.green(`${app_name} - ${app_version}`)}\n`));
165
+ const serverConfig = await getPegaServerConfig();
166
+ console.log(`\nServer ${chalk.green.bold(`${serverConfig.server}`)}.`);
167
+ console.log(chalk.green(`List of libraries for Application: ${chalk.bold.green(`${app_name} - ${app_version}`)}`));
168
+ console.log(`in ruleset: ${chalk.green.bold(`${serverConfig.rulesetName}:${serverConfig.rulesetVersion}`)}`);
166
169
 
167
170
 
168
171
  const libAnswers = await inquirer.prompt([
@@ -84,9 +84,6 @@ addDebugLog("copyWebPack","", "");
84
84
  }
85
85
 
86
86
 
87
-
88
-
89
-
90
87
  }
91
88
 
92
89
 
@@ -119,6 +119,8 @@ addDebugLog("publish", "", "+");
119
119
  // };
120
120
  options.params.push(answers.rulesetName);
121
121
  options.params.push(answers.rulesetVersion);
122
+
123
+ updateServerConfigRuleSetAndVersion(answers.rulesetName, answers.rulesetVersion);
122
124
  }
123
125
  }
124
126
 
@@ -158,6 +158,7 @@ export default async (orgLibName, selectedVersion) => {
158
158
 
159
159
  const archiveFileName = `${orgLibName}_${selectedVersion}.arch.zip`;
160
160
  const archiveDirectory = join (mainDirectory, ARCHIVES_PATH, `${orgLibName}`, `${selectedVersion}`);
161
+ const defaultPegaConfig = await getPegaServerConfig();
161
162
  if (fs.existsSync(archiveDirectory)) {
162
163
  const archiveFile = join(archiveDirectory, archiveFileName);
163
164
 
@@ -170,7 +171,7 @@ export default async (orgLibName, selectedVersion) => {
170
171
  let spinner;
171
172
  try {
172
173
  console.log("");
173
- spinner = ora('Exporting to server...\n').start();
174
+ spinner = ora(`Exporting to server ${defaultPegaConfig.server}. \n`).start();
174
175
  publishComponentLibraryArchiveToServer(content, zipContent, true )
175
176
  .then( () => {
176
177
  spinner.stop();
@@ -51,6 +51,10 @@ export const showHelpV1 = () => {
51
51
  console.log(`${chalk.cyan('npm run publishAll ')}\tpublish ALL components to server`);
52
52
 
53
53
  console.log("");
54
+ console.log(`\n${chalk.underline(`Notes`)}`);
55
+ console.log(`Cannot publish a component with prefix (Org_Lib) that matches a Rule-UI-ComponentLibrary (libraryModeCL) in same ruleset.`);
56
+
57
+ console.log("");
54
58
 
55
59
  };
56
60
 
@@ -77,8 +81,8 @@ export const showHelpV2 = (isCL) => {
77
81
  console.log(`\n${chalk.underline(`Library Versions`)}`);
78
82
  console.log(`${chalk.cyan('npm run createLibVersion')}\tcreate a new version within the current library`);
79
83
  console.log(`${chalk.cyan('npm run switchLibVersion')}\tswitch to different version within the current library`);
80
- console.log(`${chalk.cyan('npm run deleteLibVersion')}\tdelete current version, move to another version`);
81
- console.log(`${chalk.cyan('npm run restoreLibVersion ')}\trestore current version from local storage (current changes will be LOST)`);
84
+ console.log(`${chalk.cyan('npm run deleteLibVersion')}\tdelete current version, move to another version, delete is permanent`);
85
+ console.log(`${chalk.cyan('npm run restoreLibVersion ')}\trestores to current version from local storage (current changes will be LOST)`);
82
86
  console.log(`${chalk.cyan('npm run storeLibVersion ')}\tstore current version to local storage (must SAVE components before)`);
83
87
  if (isCL) {
84
88
  console.log(`${chalk.cyan('npm run exportLibVersion')}\texport current version as a zip file to a given local path or a server (must SAVE components before)`);
@@ -107,7 +111,10 @@ export const showHelpV2 = (isCL) => {
107
111
  console.log(`${chalk.cyan('npm run list ')}\t\tget list of components`);
108
112
  console.log(`${chalk.cyan('npm run delete ')}\t\tdelete a component`);
109
113
  console.log(`${chalk.cyan('npm run deleteAll ')}\t\tdelete ALL components`);
114
+
115
+ console.log("");
110
116
  console.log(`${chalk.cyan('npm run startStorybook')}\t\tstorybook components for testing`);
117
+ console.log(`${chalk.cyan('npm run test')}\t\t\trun component unit tests`);
111
118
  console.log("");
112
119
 
113
120
  console.log(`\n${chalk.underline(`Notes`)}`);
@@ -13,6 +13,7 @@ export const showCurrentStatus = async () => {
13
13
 
14
14
  const configDefaults = getConfigDefaults();
15
15
  const componentList = await getComponents();
16
+ const isLibraryBased = getLibraryBased();
16
17
  const isLibraryBasedCL = getLibraryBasedCL();
17
18
  const pegaServer = await getPegaServerConfig();
18
19
 
@@ -35,8 +36,13 @@ export const showCurrentStatus = async () => {
35
36
 
36
37
  console.log("");
37
38
 
38
- if (isLibraryBasedCL) {
39
+ if (isLibraryBased && !isLibraryBasedCL ) {
40
+ // no publishing for just libraryBased, that goes to App Static
41
+ }
42
+ else {
39
43
 
44
+ console.log(`\tPublish to:\t ${chalk.bold.green(`${pegaServer.server}`)} `);
45
+ // console.log("\t---------------------");
40
46
  console.log(`\tRuleSet:\t ${chalk.bold.green(`${pegaServer.rulesetName}`)}`);
41
47
  console.log(`\tRuleSet Version: ${chalk.bold.green(`${pegaServer.rulesetVersion}`)}`);
42
48
  console.log("");
@@ -28,6 +28,10 @@ describe(`createAll list deleteAll local: ${serverDir} - ${compType}` , () => {
28
28
  // make non libraryBased
29
29
  isLibraryBasedCL = false;
30
30
  tasksConfigJSON['libraryModeCL'] = isLibraryBasedCL;
31
+
32
+ // delete if exists
33
+ delete tasksConfigJSON['libraryMode'];
34
+
31
35
  compType = isLibraryBasedCL ? "library" : "original";
32
36
  fs.writeFileSync(tasksConfigDir, JSON.stringify(tasksConfigJSON, null, 4), { encoding: 'utf8' });
33
37
 
@@ -27,6 +27,10 @@ describe(`create buildAll deleteAll local: ${serverDir} - ${compType}`, () => {
27
27
  // make non libraryBased
28
28
  isLibraryBasedCL = false;
29
29
  tasksConfigJSON['libraryModeCL'] = isLibraryBasedCL;
30
+
31
+ // delete if exists
32
+ delete tasksConfigJSON['libraryMode'];
33
+
30
34
  compType = isLibraryBasedCL ? "library" : "original";
31
35
  fs.writeFileSync(tasksConfigDir, JSON.stringify(tasksConfigJSON, null, 4), { encoding: 'utf8' });
32
36
 
@@ -29,6 +29,10 @@ describe(`create library delete Library: ${serverDir} - ${compType}`, () => {
29
29
  // make non libraryBased
30
30
  isLibraryBasedCL = false;
31
31
  tasksConfigJSON['libraryModeCL'] = isLibraryBasedCL;
32
+
33
+ // delete if exists
34
+ delete tasksConfigJSON['libraryMode'];
35
+
32
36
  compType = isLibraryBasedCL ? "library" : "original";
33
37
  fs.writeFileSync(tasksConfigDir, JSON.stringify(tasksConfigJSON, null, 4), { encoding: 'utf8' });
34
38
 
@@ -12,21 +12,26 @@ const packageJSONDir = path.resolve('../../..', 'package.json');
12
12
  const packageJSONData = fs.readFileSync(packageJSONDir, { encoding: 'utf8'});
13
13
  let packageJSON = JSON.parse(packageJSONData);
14
14
 
15
- let isLibraryBasedCL = tasksConfigJSON['librayModeCL'];
16
- const savedLibraryBased = isLibraryBasedCL;
15
+
16
+ let isLibraryBasedCL = tasksConfigJSON['libraryModeCL'];
17
+ const savedLibraryBasedCL = isLibraryBasedCL;
17
18
  const savedOrganization = packageJSON.organization;
18
19
 
19
20
  const serverType = tasksConfigJSON['server-config'].serverType;
20
21
  const serverDir = serverType === 'launchpad' ? 'Launchpad' : 'Constellation';
21
22
  let compType = isLibraryBasedCL ? "library" : "original";
22
23
 
23
- describe(`createLib createAll list deleteLib: ${serverDir} - ${compType}`, () => {
24
+ describe(`create list delete: ${serverDir} - ${compType}`, () => {
24
25
 
25
26
  beforeAll( async() => {
26
27
 
27
28
  // make non libraryBased
28
29
  isLibraryBasedCL = false;
29
- tasksConfigJSON['librayModeCL'] = isLibraryBasedCL;
30
+ tasksConfigJSON['libraryModeCL'] = isLibraryBasedCL;
31
+
32
+ // delete if exists
33
+ delete tasksConfigJSON['libraryMode'];
34
+
30
35
  compType = isLibraryBasedCL ? "library" : "original";
31
36
  fs.writeFileSync(tasksConfigDir, JSON.stringify(tasksConfigJSON, null, 4), { encoding: 'utf8' });
32
37
 
@@ -48,8 +53,8 @@ describe(`createLib createAll list deleteLib: ${serverDir} - ${compType}`, () =>
48
53
  afterAll( async() => {
49
54
 
50
55
  //restore
51
- isLibraryBasedCL = savedLibraryBased
52
- tasksConfigJSON['librayModeCL'] = isLibraryBasedCL;
56
+ isLibraryBasedCL = savedLibraryBasedCL;
57
+ tasksConfigJSON['libraryModeCL'] = isLibraryBasedCL;
53
58
 
54
59
  fs.writeFileSync(tasksConfigDir, JSON.stringify(tasksConfigJSON, null, 4), { encoding: 'utf8' });
55
60
 
@@ -27,6 +27,10 @@ describe(`create publish deleteAll local: ${serverDir} - ${compType}`, () => {
27
27
  // make non libraryBased
28
28
  isLibraryBasedCL = false;
29
29
  tasksConfigJSON['libraryModeCL'] = isLibraryBasedCL;
30
+
31
+ // delete if exists
32
+ delete tasksConfigJSON['libraryMode'];
33
+
30
34
  compType = isLibraryBasedCL ? "library" : "original";
31
35
  fs.writeFileSync(tasksConfigDir, JSON.stringify(tasksConfigJSON, null, 4), { encoding: 'utf8' });
32
36
 
@@ -27,6 +27,10 @@ describe(`create publish delete local: ${serverDir} - ${compType}`, () => {
27
27
  // make non libraryBased
28
28
  isLibraryBasedCL = false;
29
29
  tasksConfigJSON['libraryModeCL'] = isLibraryBasedCL;
30
+
31
+ // delete if exists
32
+ delete tasksConfigJSON['libraryMode'];
33
+
30
34
  compType = isLibraryBasedCL ? "library" : "original";
31
35
  fs.writeFileSync(tasksConfigDir, JSON.stringify(tasksConfigJSON, null, 4), { encoding: 'utf8' });
32
36
 
@@ -27,6 +27,10 @@ describe(`create rename delete local: ${serverDir} - ${compType}`, () => {
27
27
  // make non libraryBased
28
28
  isLibraryBasedCL = false;
29
29
  tasksConfigJSON['libraryModeCL'] = isLibraryBasedCL;
30
+
31
+ // delete if exists
32
+ delete tasksConfigJSON['libraryMode'];
33
+
30
34
  compType = isLibraryBasedCL ? "library" : "original";
31
35
  fs.writeFileSync(tasksConfigDir, JSON.stringify(tasksConfigJSON, null, 4), { encoding: 'utf8' });
32
36
 
@@ -152,7 +152,7 @@ describe(`createLib create validate deleteLib: ${serverDir} - ${compType}` , ()
152
152
  // // remove it
153
153
  // fs.rmdirSync(fileDir, { recursive: true });
154
154
  // }
155
- }, 10000);
155
+ }, 30000);
156
156
 
157
157
  it('npm run create Local details', async () => {
158
158
  const fileName = 'MyTestDetails';
@@ -184,7 +184,7 @@ describe(`createLib create validate deleteLib: ${serverDir} - ${compType}` , ()
184
184
  // // remove it
185
185
  // fs.rmdirSync(fileDir, { recursive: true });
186
186
  // }
187
- }, 10000);
187
+ }, 30000);
188
188
 
189
189
  it(`npm run validate Pega_DXIL_MyTestText - ${isLibraryBasedCL}`, async() => {
190
190
 
@@ -205,7 +205,7 @@ describe(`createLib create validate deleteLib: ${serverDir} - ${compType}` , ()
205
205
  expect(stdout).toContain('Pega_DXIL_MyTestPage schema is valid');
206
206
  expect(stdout).toContain('Pega_DXIL_MyTestDetails schema is valid');
207
207
 
208
- expect(stdout).toContain('Validation compile...');
208
+ expect(stdout).toContain('Validation via build library...');
209
209
  expect(stdout).toContain('Done.');
210
210
 
211
211
  }, 200000);
@@ -12,22 +12,23 @@ const packageJSONDir = path.resolve('../../..', 'package.json');
12
12
  const packageJSONData = fs.readFileSync(packageJSONDir, { encoding: 'utf8'});
13
13
  let packageJSON = JSON.parse(packageJSONData);
14
14
 
15
- let isLibraryBased = tasksConfigJSON['libraryMode'];
16
- const savedLibraryBased = isLibraryBased;
15
+ let isLibraryBasedCL = tasksConfigJSON['libraryModeCL'];
16
+ const savedLibraryBasedCL = isLibraryBasedCL;
17
+
17
18
  const savedOrganization = packageJSON.organization;
18
19
 
19
20
  const serverType = tasksConfigJSON['server-config'].serverType;
20
21
  const serverDir = serverType === 'launchpad' ? 'Launchpad' : 'Constellation';
21
- let compType = isLibraryBased ? "library" : "original";
22
+ let compType = isLibraryBasedCL ? "library" : "original";
22
23
 
23
24
  describe(`promote revert webpack: ${serverDir} - ${compType}`, () => {
24
25
 
25
26
  beforeAll( async() => {
26
27
 
27
28
  // make non libraryBased
28
- isLibraryBased = false;
29
- tasksConfigJSON['libraryMode'] = isLibraryBased;
30
- compType = isLibraryBased ? "library" : "original";
29
+ isLibraryBasedCL = false;
30
+ tasksConfigJSON['libraryModeCL'] = isLibraryBasedCL;
31
+ compType = isLibraryBasedCL ? "library" : "original";
31
32
  fs.writeFileSync(tasksConfigDir, JSON.stringify(tasksConfigJSON, null, 4), { encoding: 'utf8' });
32
33
 
33
34
  // make organzation Pega
@@ -48,8 +49,8 @@ describe(`promote revert webpack: ${serverDir} - ${compType}`, () => {
48
49
  afterAll( async() => {
49
50
 
50
51
  //restore
51
- isLibraryBased = savedLibraryBased
52
- tasksConfigJSON['libraryMode'] = isLibraryBased;
52
+ isLibraryBasedCL = savedLibraryBasedCL
53
+ tasksConfigJSON['libraryModeCL'] = isLibraryBasedCL;
53
54
 
54
55
  fs.writeFileSync(tasksConfigDir, JSON.stringify(tasksConfigJSON, null, 4), { encoding: 'utf8' });
55
56