@pega/custom-dx-components 0.242.22 → 0.242.24

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.
Files changed (41) hide show
  1. package/package.json +2 -2
  2. package/src/constants.js +1 -0
  3. package/src/tasks/authenticate/index.js +1 -1
  4. package/src/tasks/build-all/helper.js +5 -18
  5. package/src/tasks/build-all/index.js +43 -10
  6. package/src/tasks/build-comp/helper.js +6 -2
  7. package/src/tasks/build-comp/index.js +19 -3
  8. package/src/tasks/build-jest-assets/index.js +1 -1
  9. package/src/tasks/build-lib/helper.js +10 -2
  10. package/src/tasks/build-lib/index.js +15 -3
  11. package/src/tasks/bundle/builder/index.js +11 -3
  12. package/src/tasks/bundle/builder/webpack.config.js +3 -1
  13. package/src/tasks/bundle/index.js +3 -1
  14. package/src/tasks/create/index.js +11 -4
  15. package/src/tasks/create-all/index.js +10 -4
  16. package/src/tasks/delete/helper.js +7 -2
  17. package/src/tasks/delete/index.js +6 -2
  18. package/src/tasks/delete-all/helper.js +6 -2
  19. package/src/tasks/delete-all/index.js +7 -2
  20. package/src/tasks/delete-lib/helper.js +6 -1
  21. package/src/tasks/delete-lib/index.js +10 -4
  22. package/src/tasks/init/template/package.json.mustache +1 -2
  23. package/src/tasks/init/template/tasks.config.json +2 -1
  24. package/src/tasks/linter/index.js +4 -0
  25. package/src/tasks/list/helper.js +9 -2
  26. package/src/tasks/list/index.js +10 -2
  27. package/src/tasks/list-lib/helper.js +8 -2
  28. package/src/tasks/list-lib/index.js +12 -3
  29. package/src/tasks/promote-webpack/index.js +7 -2
  30. package/src/tasks/promote-webpack/webpack.config.js +3 -1
  31. package/src/tasks/publish/helper.js +5 -1
  32. package/src/tasks/publish/index.js +6 -2
  33. package/src/tasks/publish-all/helper.js +8 -1
  34. package/src/tasks/publish-all/index.js +8 -2
  35. package/src/tasks/publish-lib/helper.js +4 -2
  36. package/src/tasks/publish-lib/index.js +17 -7
  37. package/src/tasks/rename/index.js +10 -3
  38. package/src/tasks/rename-lib/index.js +23 -5
  39. package/src/tasks/revert-webpack/index.js +5 -2
  40. package/src/tasks/validator/index.js +4 -1
  41. package/src/util.js +135 -5
@@ -4,16 +4,18 @@ import chalk from 'chalk';
4
4
 
5
5
  import validate from '../validator/index.js';
6
6
  import { lintComponent } from '../linter/index.js';
7
- import { getComponentDirectoryPath, showVersion, getC11NB2STokenAndStaticServer, getLocalLibraryVersions, getLibraryBased, deletePublishExtras } from '../../util.js';
7
+ import { getComponentDirectoryPath, showVersion, getC11NB2STokenAndStaticServer, getLocalLibraryVersions, getLibraryBased, deletePublishExtras, addDebugLog } from '../../util.js';
8
8
 
9
9
  import { publishLib, listLibJSONResponse, deleteLibVersion } from '@pega/constellation-dx-components-build-utils/index.js';
10
10
 
11
11
  import { getLibraryVersionQuestion, getOrgLib } from './helper.js';
12
+ import lib from 'webpack-bundle-analyzer';
12
13
  ;
13
14
 
14
15
  const isLibraryBased = await getLibraryBased();
15
16
 
16
17
  export function getCustomTasks(componentKey, sourceMap, devBuild, options) {
18
+ addDebugLog("getCustomTasks", `componentKey: ${componentKey}, sourceMap: ${sourceMap}, devBuild: ${devBuild}`, "");
17
19
 
18
20
  const sDevBuild = devBuild ? '(dev build)' : '';
19
21
  return new Listr(
@@ -41,6 +43,7 @@ export function getCustomTasks(componentKey, sourceMap, devBuild, options) {
41
43
  }
42
44
 
43
45
  export const doesLibraryExist = async (libraryName, libraryVersion) => {
46
+ addDebugLog("doesLibraryExist", `libraryName: ${libraryName}, libraryVersion: ${libraryVersion}`, "");
44
47
 
45
48
  const tokenAndStaticServer = await getC11NB2STokenAndStaticServer();
46
49
  const libList = await listLibJSONResponse(tokenAndStaticServer.C11NB2S, tokenAndStaticServer.appStaticContentServer);
@@ -56,6 +59,7 @@ export const doesLibraryExist = async (libraryName, libraryVersion) => {
56
59
 
57
60
 
58
61
  export const publishNewLibraryAsync = async (libraryName, version, checkDeleted = false) => {
62
+ addDebugLog("publishNewLibraryAsync", `libraryName: ${libraryName}, version: ${version}, checkDeleted: ${checkDeleted} `, "");
59
63
 
60
64
  const tokenAndStaticServer = await getC11NB2STokenAndStaticServer();
61
65
 
@@ -78,7 +82,9 @@ export const publishNewLibraryAsync = async (libraryName, version, checkDeleted
78
82
  }
79
83
 
80
84
  console.log("\nPublishing Library " + chalk.bold.green(`${libraryName}:${version}`) + " to " + chalk.bold.green(`${tokenAndStaticServer.appStaticContentServer}`));
81
- publishLib(libraryName, version, tokenAndStaticServer.C11NB2S, tokenAndStaticServer.appStaticContentServer);
85
+ addDebugLog("publishLib", "services call", "");
86
+ await publishLib(libraryName, version, tokenAndStaticServer.C11NB2S, tokenAndStaticServer.appStaticContentServer);
87
+ addDebugLog("deleteLib", "services end", "");
82
88
 
83
89
  }
84
90
 
@@ -89,7 +95,9 @@ export default async (options) => {
89
95
  process.exit();
90
96
  }
91
97
 
92
- showVersion();
98
+ await showVersion();
99
+
100
+ addDebugLog("publishLibrary", "", "+");
93
101
 
94
102
  let organization;
95
103
  let library;
@@ -203,20 +211,22 @@ export default async (options) => {
203
211
  if (libVersionExists) {
204
212
  if (overrideExisting) {
205
213
  console.log("\nDeleting existing library " + chalk.bold.yellow(`${libraryName}:${version}`) + " ...");
214
+ addDebugLog("deleteLibVersion", `services call: libraryName: ${libraryName}, version: ${version}`, "");
206
215
  await deleteLibVersion(libraryName, version, tokenAndStaticServer.C11NB2S, tokenAndStaticServer.appStaticContentServer);
207
-
216
+ addDebugLog("deleteLibVersion", "services end", "");
208
217
  checkDeleted = true;
209
218
  }
210
219
  else {
211
220
  // don't override, so end
212
221
  console.log(chalk.yellow(`You will need to increment your library version to publish`));
222
+ addDebugLog("publishLibrary", "END", "-");
213
223
  return;
214
224
  }
215
225
  }
216
226
 
217
227
  // need a timeout to give services time to delete the library
218
- setTimeout( function(){ publishNewLibraryAsync(libraryName, version, checkDeleted)}, 700 );
219
-
228
+ // setTimeout( function(){ await publishNewLibraryAsync(libraryName, version, checkDeleted)}, 700 );
229
+ await publishNewLibraryAsync(libraryName, version, checkDeleted);
220
230
  }
221
231
 
222
232
  }
@@ -225,7 +235,7 @@ export default async (options) => {
225
235
  console.log(chalk.bold.redBright(`You need to build library ${libraryName} first.`));
226
236
  }
227
237
 
228
-
238
+ addDebugLog("publishLibrary", "END", "-");
229
239
 
230
240
  return true;
231
241
  };
@@ -7,7 +7,7 @@ import inquirer from 'inquirer';
7
7
  import ncp from 'ncp';
8
8
  import chalk from 'chalk';
9
9
 
10
- import { checkPathAccess, showVersion, getComponentsObj, getDirectoryFiles } from '../../util.js';
10
+ import { checkPathAccess, showVersion, getComponentsObj, getDirectoryFiles, addDebugLog } from '../../util.js';
11
11
  import { TASKS_CONFIG_JSON_FILENAME, COMPONENTS_DIRECTORY_PATH, COMPONENTS_PATH } from '../../constants.js';
12
12
 
13
13
 
@@ -47,6 +47,8 @@ export const updateConfig = async (
47
47
  onlyCompanion = false
48
48
  ) => {
49
49
 
50
+ addDebugLog("updateConfig", `oldComponentKey: ${oldComponentKey}, newComponentKey: ${newComponentKey}`, "");
51
+
50
52
  let configData = fs.readFileSync(join(targetDirectory, "/config.json"), { encoding: 'utf8' });
51
53
  configData = configData && JSON.parse(configData);
52
54
 
@@ -83,6 +85,8 @@ export const updateFile = async (
83
85
  targetDirectory,
84
86
  ) => {
85
87
 
88
+ addDebugLog("updateFile", `fileName: ${fileName}, oldComponentKeyPC: ${oldComponentKeyPC}, newComponentKeyPC: ${newComponentKeyPC}, targetDirectory: ${targetDirectory}`, "");
89
+
86
90
  let fileData = fs.readFileSync(join(targetDirectory, "/", fileName), { encoding: 'utf8' });
87
91
 
88
92
  if (fileData.indexOf(oldComponentKeyPC) >= 0) {
@@ -109,6 +113,7 @@ export const renameComponent = async (
109
113
  onlyCompanion = false
110
114
  ) => {
111
115
 
116
+ addDebugLog("renameComponent", `library: ${library}, organization: ${organization}, componentKey: ${componentKey}`, "");
112
117
 
113
118
  let pegaConfig = await getPegaConfig();
114
119
 
@@ -174,7 +179,9 @@ export const renameComponent = async (
174
179
 
175
180
 
176
181
  export default async options => {
177
- showVersion();
182
+ await showVersion();
183
+
184
+ addDebugLog("rename", "", "+");
178
185
 
179
186
  await checkPathAccess(pegaConfigJsonPath);
180
187
 
@@ -347,6 +354,6 @@ export default async options => {
347
354
  });
348
355
  }
349
356
 
350
-
357
+ addDebugLog("rename", "END", "-");
351
358
 
352
359
  };
@@ -17,7 +17,8 @@ import {
17
17
  deleteLocalLibrary,
18
18
  getC11NB2STokenAndStaticServer,
19
19
  updateComponentDefaultLibrary,
20
- updateDefaultOrganization
20
+ updateDefaultOrganization,
21
+ addDebugLog
21
22
  } from '../../util.js';
22
23
  import {
23
24
  TASKS_CONFIG_JSON_FILENAME,
@@ -39,13 +40,15 @@ import {
39
40
  getPegaConfig,
40
41
  getComponentDefaults,
41
42
  getComponents,
42
- getAboutData,
43
43
  sanitize
44
44
  } from '../../util.js';
45
45
 
46
46
  const copy = promisify(ncp);
47
47
 
48
48
  export const getOrgLib = async () => {
49
+
50
+ addDebugLog("getOrgLib", "", "+");
51
+
49
52
  const defaultPegaConfig = await getPegaServerConfig();
50
53
 
51
54
  await checkPathAccess(pegaConfigJsonPath);
@@ -70,6 +73,9 @@ export const getOrgLib = async () => {
70
73
  componentDefaults.library = library;
71
74
  componentDefaults.organization = organization;
72
75
 
76
+ addDebugLog("getOrgLib", `componentsDefaults: ${JSON.stringify(componentDefaults)}`, "");
77
+ addDebugLog("getOrgLib", "END", "-");
78
+
73
79
  return componentDefaults;
74
80
  };
75
81
 
@@ -89,6 +95,9 @@ export const updateConfig = async (
89
95
  options,
90
96
  onlyCompanion = false
91
97
  ) => {
98
+
99
+ addDebugLog("updateConfig", "", "");
100
+
92
101
  let configData = fs.readFileSync(join(targetDirectory, '/config.json'), { encoding: 'utf8' });
93
102
  configData = configData && JSON.parse(configData);
94
103
 
@@ -114,6 +123,8 @@ export const updateFile = async (
114
123
  newComponentKeyPC,
115
124
  targetDirectory
116
125
  ) => {
126
+
127
+ addDebugLog("updateFile", "", "");
117
128
  let fileData = fs.readFileSync(join(targetDirectory, '/', fileName), { encoding: 'utf8' });
118
129
 
119
130
  if (fileData.indexOf(oldComponentKeyPC) >= 0) {
@@ -124,6 +135,7 @@ export const updateFile = async (
124
135
  };
125
136
 
126
137
  export const renameLibrary = async ({ library, organization }, options) => {
138
+ addDebugLog("renameLibrary", `library: ${library}, organization: ${organization}`, "");
127
139
  const compDef = await getOrgLib();
128
140
  const currentOrganization = compDef.organization;
129
141
  const currentLibrary = compDef.library;
@@ -145,7 +157,7 @@ export const renameLibrary = async ({ library, organization }, options) => {
145
157
  const currentOrgLib = currentOrganization.concat('_').concat(currentLibrary);
146
158
  const newOrgLib = organization.concat('_').concat(library);
147
159
 
148
- // reaname all the components
160
+ // rename all the components
149
161
  const components = await getComponents();
150
162
 
151
163
  let wasDevBuild = false;
@@ -197,7 +209,7 @@ export const renameLibrary = async ({ library, organization }, options) => {
197
209
  // with subdirectories for each version.
198
210
  // If "buildDev", we append to version "-dev". Currently, only "-dev" versions, when published, can be deleted.
199
211
  if (newOrgLib && compVersion) {
200
- localBuildLibrary(organization, library, currentVersion, wasDevBuild);
212
+ await localBuildLibrary(organization, library, currentVersion, wasDevBuild);
201
213
  }
202
214
  };
203
215
 
@@ -215,6 +227,9 @@ export const renameComponent = async (
215
227
  options,
216
228
  onlyCompanion = false
217
229
  ) => {
230
+
231
+ addDebugLog("renameComponent", `library: ${library}, organization: ${organization}, componentKey: ${componentKey}`, "");
232
+
218
233
  let pegaConfig = await getPegaConfig();
219
234
 
220
235
  const newComponentKey = `${organization}_${library}_${componentName}`;
@@ -268,7 +283,8 @@ export default async options => {
268
283
  process.exit();
269
284
  }
270
285
 
271
- showVersion();
286
+ await showVersion();
287
+ addDebugLog("renameLibrary", "", "+");
272
288
 
273
289
  await checkPathAccess(pegaConfigJsonPath);
274
290
 
@@ -346,4 +362,6 @@ export default async options => {
346
362
  );
347
363
  });
348
364
  }
365
+
366
+ addDebugLog("renameLibrary", "END", "-");
349
367
  };
@@ -3,12 +3,13 @@ import path from 'path';
3
3
 
4
4
  import chalk from 'chalk';
5
5
 
6
- import { showVersion, updateUseWebPackPromotion, getLibraryBased } from '../../util.js';
6
+ import { showVersion, updateUseWebPackPromotion, getLibraryBased, addDebugLog } from '../../util.js';
7
7
  import { WEBPACK_CONFIG_JS_FILENAME } from '../../constants.js';
8
8
 
9
9
  const isLibraryBased = await getLibraryBased();
10
10
 
11
11
  export const renamePromotedWebPack = async () => {
12
+ addDebugLog("renamePromotedWebPack","", "");
12
13
  // call this function from top level
13
14
  // fs.copyFileSync("./webpack.config.js", "webpack.config.js")
14
15
 
@@ -32,8 +33,10 @@ export default async () => {
32
33
  process.exit();
33
34
  }
34
35
 
35
- showVersion();
36
+ await showVersion();
37
+ addDebugLog("revertWebPack","", "+");
36
38
 
37
39
  await renamePromotedWebPack();
38
40
  await updateUseWebPackPromotion(false);
41
+ addDebugLog("revertWebPack","END", "-");
39
42
  };
@@ -11,7 +11,8 @@ import {
11
11
  import {
12
12
  getComponentDirectoryPath,
13
13
  getComponents,
14
- getOOTBComponents } from '../../util.js';
14
+ getOOTBComponents,
15
+ addDebugLog } from '../../util.js';
15
16
 
16
17
  const ajv = new Ajv({ allErrors: true });
17
18
 
@@ -314,6 +315,8 @@ const validateOverideSchema = ajv.compile(overrideSchema);
314
315
 
315
316
 
316
317
  export default async (option) => {
318
+ // addDebugLog("validate","", "");
319
+
317
320
  let componentToValidate = null;
318
321
  if (option.params && option.params[3]) {
319
322
  componentToValidate = option.params[3];