@pega/custom-dx-components 0.242.27 → 0.242.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.
Files changed (40) hide show
  1. package/package.json +1 -1
  2. package/src/cli.js +30 -0
  3. package/src/constants.js +3 -2
  4. package/src/tasks/build-all/index.js +14 -1
  5. package/src/tasks/build-comp/helper.js +6 -4
  6. package/src/tasks/build-comp/index.js +12 -1
  7. package/src/tasks/bundle/builder/index.js +8 -6
  8. package/src/tasks/create/index.js +4 -2
  9. package/src/tasks/create-all/index.js +5 -3
  10. package/src/tasks/create-lib/index.js +4 -6
  11. package/src/tasks/create-version/helper.js +1 -0
  12. package/src/tasks/create-version/index.js +10 -6
  13. package/src/tasks/delete/index.js +1 -1
  14. package/src/tasks/delete-all/index.js +1 -1
  15. package/src/tasks/delete-lib/index.js +55 -32
  16. package/src/tasks/delete-pub/index.js +3 -2
  17. package/src/tasks/delete-version/index.js +45 -0
  18. package/src/tasks/export-archive/helper.js +85 -0
  19. package/src/tasks/export-archive/index.js +224 -0
  20. package/src/tasks/import-archive/helper.js +51 -0
  21. package/src/tasks/import-archive/index.js +301 -0
  22. package/src/tasks/index.js +5 -0
  23. package/src/tasks/init/template/package.json.mustache +20 -13
  24. package/src/tasks/list/helper.js +2 -2
  25. package/src/tasks/list/index.js +1 -1
  26. package/src/tasks/list-lib/index.js +8 -10
  27. package/src/tasks/list-pub/index.js +5 -5
  28. package/src/tasks/move/helper.js +56 -0
  29. package/src/tasks/move/index.js +441 -0
  30. package/src/tasks/promote-webpack/index.js +2 -3
  31. package/src/tasks/publish/index.js +1 -2
  32. package/src/tasks/publish-all/index.js +2 -2
  33. package/src/tasks/publish-lib/index.js +8 -4
  34. package/src/tasks/rename-lib/index.js +2 -3
  35. package/src/tasks/revert-webpack/index.js +2 -3
  36. package/src/tasks/show-status/index.js +2 -3
  37. package/src/tasks/store/index.js +53 -0
  38. package/src/tasks/switch-lib/index.js +4 -4
  39. package/src/tasks/switch-version/index.js +10 -6
  40. package/src/util.js +231 -179
@@ -21,8 +21,6 @@ import {
21
21
  BUILDER_DIR_FILE_PATH
22
22
  } from '../../constants.js';
23
23
 
24
- const isLibraryBased = getLibraryBased();
25
-
26
24
 
27
25
  export const copyWebPack = async () => {
28
26
  addDebugLog("copyWebPack","", "");
@@ -94,8 +92,9 @@ addDebugLog("copyWebPack","", "");
94
92
 
95
93
 
96
94
  export default async options => {
95
+ const isLibraryBased = getLibraryBased();
97
96
  if (isLibraryBased) {
98
- console.log(`Command only supported for ${chalk.bold.green('non library based')} components.`)
97
+ console.log(`Command only supported for ${chalk.bold.green('non library mode')} components.`)
99
98
  process.exit();
100
99
  }
101
100
 
@@ -11,12 +11,11 @@ import { getPublishComponentQuestions, publishComponentToServer, zipComponent }
11
11
  import { default as buildLibrary } from '../build-lib/index.js';
12
12
  import { default as publishLibrary } from '../publish-lib/index.js';
13
13
 
14
- const isLibraryBased = getLibraryBased();
15
-
16
14
  export default async options => {
17
15
 
18
16
  await showVersion();
19
17
  await checkLibraryAndArchives();
18
+ const isLibraryBased = getLibraryBased();
20
19
 
21
20
  if (isLibraryBased) {
22
21
 
@@ -14,7 +14,6 @@ import {
14
14
  cleanUp
15
15
  } from './helper.js';
16
16
 
17
- const isLibraryBased = getLibraryBased();
18
17
 
19
18
  export function getCustomTasks(componentKey, sourceMap, devBuild, content, options) {
20
19
  addDebugLog("getCustomTasks", `componentKey: ${componentKey}, sourceMap: ${sourceMap}, devBuild: ${devBuild}`, "");
@@ -64,8 +63,9 @@ addDebugLog("getCustomTasks", `componentKey: ${componentKey}, sourceMap: ${sourc
64
63
  }
65
64
 
66
65
  export default async options => {
66
+ const isLibraryBased = getLibraryBased();
67
67
  if (isLibraryBased) {
68
- console.log(`Command only supported for ${chalk.bold.green('non library based')} components.`)
68
+ console.log(`Command only supported for ${chalk.bold.green('non library mode')} components.`)
69
69
  process.exit();
70
70
  }
71
71
 
@@ -11,8 +11,6 @@ import { publishLib, listLibJSONResponse, deleteLibVersion } from '@pega/constel
11
11
  import { getLibraryVersionQuestion } from './helper.js';
12
12
 
13
13
 
14
- const isLibraryBased = getLibraryBased();
15
-
16
14
  export function getCustomTasks(componentKey, sourceMap, devBuild, options) {
17
15
  addDebugLog("getCustomTasks", `componentKey: ${componentKey}, sourceMap: ${sourceMap}, devBuild: ${devBuild}`, "");
18
16
 
@@ -63,11 +61,16 @@ addDebugLog("publishNewLibraryAsync", `libraryName: ${libraryName}, version: ${v
63
61
 
64
62
  if (checkDeleted ) {
65
63
  console.log(chalk.yellow(`Verifying library has been deleted..`));
66
- let libExists = await doesLibraryExist(libraryName, version);
64
+ let libExists = true;
67
65
  let count = 0;
68
66
  while (libExists) {
67
+
68
+ // sleep a second and try again
69
+ await new Promise(r => setTimeout(r, 1000));
70
+
69
71
  // keep checking until no longer exists
70
72
  libExists = await doesLibraryExist(libraryName, version);
73
+
71
74
  count ++;
72
75
 
73
76
  if (count > 100) {
@@ -88,8 +91,9 @@ addDebugLog("deleteLib", "services end", "");
88
91
 
89
92
 
90
93
  export default async (options) => {
94
+ const isLibraryBased = getLibraryBased();
91
95
  if (!isLibraryBased) {
92
- console.log(`Command only supported for ${chalk.bold.green('library based')} components.`)
96
+ console.log(`Command only supported for ${chalk.bold.green('library mode')} components.`)
93
97
  process.exit();
94
98
  }
95
99
 
@@ -34,8 +34,6 @@ export const DXCB_CONFIG_INTERNAL_JSON_FILENAME = 'src/dxcb.config.json';
34
34
  const currentDirectory = process.cwd();
35
35
  const pegaConfigJsonPath = join(currentDirectory, TASKS_CONFIG_JSON_FILENAME);
36
36
 
37
- const isLibraryBased = getLibraryBased();
38
-
39
37
  import {
40
38
  convertIntoPascalCase,
41
39
  getComponentDirectoryPath,
@@ -243,8 +241,9 @@ addDebugLog("renameComponent", `library: ${library}, organization: ${organizatio
243
241
  };
244
242
 
245
243
  export default async options => {
244
+ const isLibraryBased = getLibraryBased();
246
245
  if (!isLibraryBased) {
247
- console.log(`Command only supported for ${chalk.bold.green('library based')} components.`);
246
+ console.log(`Command only supported for ${chalk.bold.green('library mode')} components.`);
248
247
  process.exit();
249
248
  }
250
249
 
@@ -6,8 +6,6 @@ import chalk from 'chalk';
6
6
  import { showVersion, updateUseWebPackPromotion, getLibraryBased, addDebugLog } from '../../util.js';
7
7
  import { WEBPACK_CONFIG_JS_FILENAME } from '../../constants.js';
8
8
 
9
- const isLibraryBased = getLibraryBased();
10
-
11
9
  export const renamePromotedWebPack = async () => {
12
10
  addDebugLog("renamePromotedWebPack","", "");
13
11
  // call this function from top level
@@ -28,8 +26,9 @@ addDebugLog("renamePromotedWebPack","", "");
28
26
  };
29
27
 
30
28
  export default async () => {
29
+ const isLibraryBased = getLibraryBased();
31
30
  if (isLibraryBased) {
32
- console.log(`Command only supported for ${chalk.bold.green('non library based')} components.`);
31
+ console.log(`Command only supported for ${chalk.bold.green('non library mode')} components.`);
33
32
  process.exit();
34
33
  }
35
34
 
@@ -5,8 +5,6 @@ import chalk from 'chalk';
5
5
 
6
6
  import { showVersion, getLibraryBased, addDebugLog, getConfigDefaults, getComponents, checkLibraryAndArchives } from '../../util.js';
7
7
 
8
- const isLibraryBased = getLibraryBased();
9
-
10
8
  export const showCurrentStatus = async () => {
11
9
 
12
10
  const configDefaults = await getConfigDefaults();
@@ -27,8 +25,9 @@ export const showCurrentStatus = async () => {
27
25
 
28
26
 
29
27
  export default async options => {
28
+ const isLibraryBased = getLibraryBased();
30
29
  if (!isLibraryBased) {
31
- console.log(`Command only supported for ${chalk.bold.green('library based')} components.`);
30
+ console.log(`Command only supported for ${chalk.bold.green('library mode')} components.`);
32
31
  process.exit();
33
32
  }
34
33
 
@@ -0,0 +1,53 @@
1
+
2
+ import { Listr } from 'listr2';
3
+ import chalk from 'chalk';
4
+
5
+ import {
6
+
7
+ showVersion,
8
+ addDebugLog,
9
+ checkLibraryAndArchives,
10
+ getConfigDefaults,
11
+ getLibraryBased,
12
+ zipVersionAndArchive
13
+ } from '../../util.js';
14
+
15
+ export default async options => {
16
+ await showVersion();
17
+ await checkLibraryAndArchives();
18
+
19
+ addDebugLog("storeComponents", "", "+");
20
+
21
+ const isLibraryBased = getLibraryBased();
22
+ if (!isLibraryBased) {
23
+ console.log(`Command only supported for ${chalk.bold.green('library mode')} components.`)
24
+ process.exit();
25
+ }
26
+
27
+ console.log(chalk.bold.yellow('\nBe sure to SAVE all changes before storing, or changes will NOT be stored.'));
28
+
29
+
30
+ console.log("");
31
+ const confDef = getConfigDefaults();
32
+ const tasks = new Listr(
33
+ [
34
+ {
35
+ title: `Store ${confDef.displayLibVersion}`,
36
+ task: async () => {
37
+ await zipVersionAndArchive(confDef.currentOrgLib, confDef.buildVersion);
38
+ }
39
+ }
40
+ ],
41
+ { concurrent: false, exitOnError: true }
42
+ );
43
+
44
+ await tasks.run().catch(err => {
45
+ console.log(chalk.bold.red(err.toString()));
46
+ addDebugLog("storeComponents", "", "-");
47
+ process.exit(1);
48
+ });
49
+ console.log(chalk.greenBright('\nComponents Stored'));
50
+
51
+ addDebugLog("storeComponents", "", "-");
52
+
53
+ };
@@ -21,11 +21,11 @@ import {
21
21
  import { getSwitchLibraryComponentQuestions, getSwitchVersionComponentQuestions } from './helper.js';
22
22
  import { showCurrentStatus } from '../show-status/index.js';
23
23
 
24
- const isLibraryBased = getLibraryBased();
25
24
 
26
25
  export default async options => {
26
+ const isLibraryBased = getLibraryBased();
27
27
  if (!isLibraryBased) {
28
- console.log(`Command only supported for ${chalk.bold.green('library based')} components.`);
28
+ console.log(`Command only supported for ${chalk.bold.green('library mode')} components.`);
29
29
  process.exit();
30
30
  }
31
31
 
@@ -77,13 +77,13 @@ addDebugLog("switchLibrary", "", "+");
77
77
  const tasks = new Listr(
78
78
  [
79
79
  {
80
- title: `Archive ${orgLib.displayLibVersion}`,
80
+ title: `Storing ${orgLib.displayLibVersion}`,
81
81
  task: async () => {
82
82
  await zipVersionAndArchive(existingOrgLib, oldVersion);
83
83
  }
84
84
  },
85
85
  {
86
- title: `Restore ${newOrgLib}/${newVersion}`,
86
+ title: `Restoring ${newOrgLib}/${newVersion}`,
87
87
  task: async () => {
88
88
  await restoreFromArchive(switchToFileName, newOrgLib, newVersion);
89
89
  }
@@ -15,17 +15,18 @@ import {
15
15
  restoreFromArchive,
16
16
  checkLibraryAndArchives,
17
17
  getConfigDefaults,
18
- getHaveDependencyDifference
18
+ getHaveDependencyDifference,
19
+ forceDefaultsUpdate
19
20
  } from '../../util.js';
20
21
 
21
22
  import { getSwitchVersionComponentQuestions } from './helper.js';
23
+ import { showCurrentStatus } from '../show-status/index.js';
22
24
 
23
25
 
24
- const isLibraryBased = getLibraryBased();
25
-
26
26
  export default async options => {
27
+ const isLibraryBased = getLibraryBased();
27
28
  if (!isLibraryBased) {
28
- console.log(`Command only supported for ${chalk.bold.green('library based')} components.`);
29
+ console.log(`Command only supported for ${chalk.bold.green('library mode')} components.`);
29
30
  process.exit();
30
31
  }
31
32
 
@@ -71,13 +72,13 @@ addDebugLog("switchVersion", "", "+");
71
72
  const tasks = new Listr(
72
73
  [
73
74
  {
74
- title: `Archive ${orgLib.displayLibVersion}`,
75
+ title: `Storing ${orgLib.displayLibVersion}`,
75
76
  task: async () => {
76
77
  await zipVersionAndArchive(existingOrgLib, oldVersion);
77
78
  }
78
79
  },
79
80
  {
80
- title: `Restore ${existingOrgLib}/${newVersion}`,
81
+ title: `Restoring ${existingOrgLib}/${newVersion}`,
81
82
  task: async () => {
82
83
  await restoreFromArchive(switchToFileName, existingOrgLib, newVersion);
83
84
  }
@@ -113,6 +114,9 @@ addDebugLog("switchVersion", "", "+");
113
114
 
114
115
  console.log(`${chalk.bold.green(`\nSwitched to ${orgLib.currentOrgLib}/${newVersion}!\n`)}`);
115
116
 
117
+ await forceDefaultsUpdate();
118
+ await showCurrentStatus();
119
+
116
120
  if (getHaveDependencyDifference()) {
117
121
 
118
122
  console.log('\n***************************************************************');