@pega/custom-dx-components 0.242.28 → 0.242.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.
Files changed (39) 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-comp/helper.js +6 -4
  5. package/src/tasks/bundle/builder/index.js +8 -6
  6. package/src/tasks/create/index.js +4 -2
  7. package/src/tasks/create-all/index.js +5 -3
  8. package/src/tasks/create-lib/helper.js +1 -1
  9. package/src/tasks/create-lib/index.js +4 -6
  10. package/src/tasks/create-version/helper.js +2 -1
  11. package/src/tasks/create-version/index.js +10 -6
  12. package/src/tasks/delete/index.js +1 -1
  13. package/src/tasks/delete-all/index.js +1 -1
  14. package/src/tasks/delete-lib/index.js +55 -32
  15. package/src/tasks/delete-pub/index.js +3 -2
  16. package/src/tasks/delete-version/index.js +45 -0
  17. package/src/tasks/export-archive/helper.js +85 -0
  18. package/src/tasks/export-archive/index.js +224 -0
  19. package/src/tasks/import-archive/helper.js +51 -0
  20. package/src/tasks/import-archive/index.js +301 -0
  21. package/src/tasks/index.js +5 -0
  22. package/src/tasks/init/template/package.json.mustache +20 -12
  23. package/src/tasks/list/helper.js +2 -2
  24. package/src/tasks/list/index.js +1 -1
  25. package/src/tasks/list-lib/index.js +8 -10
  26. package/src/tasks/list-pub/index.js +3 -3
  27. package/src/tasks/move/helper.js +56 -0
  28. package/src/tasks/move/index.js +441 -0
  29. package/src/tasks/promote-webpack/index.js +2 -3
  30. package/src/tasks/publish/index.js +1 -2
  31. package/src/tasks/publish-all/index.js +2 -2
  32. package/src/tasks/publish-lib/index.js +8 -4
  33. package/src/tasks/rename-lib/index.js +2 -3
  34. package/src/tasks/revert-webpack/index.js +2 -3
  35. package/src/tasks/show-status/index.js +2 -3
  36. package/src/tasks/store/index.js +53 -0
  37. package/src/tasks/switch-lib/index.js +4 -4
  38. package/src/tasks/switch-version/index.js +10 -6
  39. package/src/util.js +229 -177
@@ -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***************************************************************');