@pega/custom-dx-components 0.242.49 → 0.242.51

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.242.49",
3
+ "version": "0.242.51",
4
4
  "description": "Utility for building custom UI components",
5
5
  "bin": "./bin/index.js",
6
6
  "scripts": {
@@ -100,7 +100,7 @@
100
100
  },
101
101
  "devDependencies": {
102
102
  "@pega/configs": "^0.15.1",
103
- "@pega/custom-dx-components": "~0.242.49",
103
+ "@pega/custom-dx-components": "~0.242.51",
104
104
  "@pega/pcore-pconnect-typedefs": "~3.2.0-alpha.1",
105
105
  "@storybook/addon-actions": "^7.6.19",
106
106
  "@storybook/addon-essentials": "^7.6.19",
package/src/util.js CHANGED
@@ -1508,6 +1508,28 @@ export const unZipFromArchive = async (fileName) => {
1508
1508
  };
1509
1509
 
1510
1510
 
1511
+ export const updateComponentTaskConfig = async () => {
1512
+ const currentDirectory = process.cwd();
1513
+ const tempDirectory = join(currentDirectory, TEMP_PATH);
1514
+
1515
+ const tempConfigPath = join(tempDirectory, TASKS_CONFIG_JSON_FILENAME);
1516
+ const currentConfigPath = join(currentDirectory, TASKS_CONFIG_JSON_FILENAME);
1517
+
1518
+ const contents = fs.readFileSync(tempConfigPath);
1519
+ const originalContents = fs.readFileSync(currentConfigPath);
1520
+
1521
+ let contentsData = JSON.parse(contents);
1522
+ let originalContentsData = JSON.parse(originalContents);
1523
+
1524
+ // only copy "components" from archived task.config and "devBuild"
1525
+ // that way, your current tasks.config isn't messed up
1526
+ originalContentsData["server-config"].devBuild = contentsData["server-config"].devBuild;
1527
+ originalContentsData["component"] = contentsData["component"];
1528
+
1529
+ fs.writeFileSync(currentConfigPath, JSON.stringify(originalContentsData, null, 4), { encoding: 'utf8' });
1530
+
1531
+ }
1532
+
1511
1533
  export const restoreDependenciesFromPackage = async () => {
1512
1534
  const currentDirectory = process.cwd();
1513
1535
  const tempDirectory = join(currentDirectory, TEMP_PATH);
@@ -1598,16 +1620,14 @@ export const restoreFromArchive = async (fileName, orgLibName, version) => {
1598
1620
 
1599
1621
  await unZipFromArchive(archFileName);
1600
1622
 
1601
- const tempConfigPath = join(tempDirectory, TASKS_CONFIG_JSON_FILENAME);
1602
- const currentConfigPath = join(currentDirectory, TASKS_CONFIG_JSON_FILENAME);
1623
+
1603
1624
  const tempPackagePath = join (tempDirectory, PACKAGE_JSON_FILENAME);
1604
1625
  const currentPackagePath = join(currentDirectory, PACKAGE_JSON_FILENAME);
1605
1626
  const tempDirectoryComponents = join(tempDirectory, "src", "components");
1606
1627
  const currentComponentsPath = join(currentDirectory, "src", "components");
1607
1628
 
1608
-
1609
- let contents = fs.readFileSync(tempConfigPath);
1610
- fs.writeFileSync(currentConfigPath, contents);
1629
+ // take your current tasks.config and update with component and devBuild from saved tasks.config
1630
+ await updateComponentTaskConfig();
1611
1631
 
1612
1632
  // restore package json dependencies
1613
1633
  await restoreDependenciesFromPackage();