@pega/custom-dx-components 0.242.58 → 0.242.60

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.58",
3
+ "version": "0.242.60",
4
4
  "description": "Utility for building custom UI components",
5
5
  "bin": "./bin/index.js",
6
6
  "scripts": {
@@ -101,8 +101,11 @@ export const updateSavedExportFilePath = async(filePath) => {
101
101
  }
102
102
 
103
103
  if (filePath.indexOf(defaultPath) === 0) {
104
- // same starting path, so we can save the relative
105
- const relativePath = filePath.replace(defaultPath.concat(path.sep), "");
104
+ let relativePath = "";
105
+ if (filePath !== defaultPath) {
106
+ // same starting path, so we can save the relative
107
+ relativePath = filePath.replace(defaultPath.concat("/"), "");
108
+ }
106
109
 
107
110
  await setConfigExportRelativePath(relativePath);
108
111
  await forceDefaultsUpdate();
@@ -112,8 +115,13 @@ export const updateSavedExportFilePath = async(filePath) => {
112
115
  else {
113
116
  // mac
114
117
  if (filePath.indexOf(defaultPath) === 0) {
115
- // same starting path, so we can save the relative
116
- const relativePath = filePath.replace(defaultPath.concat("/"), "");
118
+
119
+ let relativePath = "";
120
+ if (filePath !== defaultPath) {
121
+ // same starting path, so we can save the relative
122
+ relativePath = filePath.replace(defaultPath.concat("/"), "");
123
+ }
124
+
117
125
 
118
126
  await setConfigExportRelativePath(relativePath);
119
127
  await forceDefaultsUpdate();
@@ -287,8 +287,12 @@ export const updateSavedFilePath = async(filePath) => {
287
287
  }
288
288
 
289
289
  if (filePath.indexOf(defaultPath) === 0) {
290
- // same starting path, so we can save the relative
291
- const relativePath = filePath.replace(defaultPath.concat(path.sep), "");
290
+
291
+ let relativePath = "";
292
+ if (filePath !== defaultPath) {
293
+ // same starting path, so we can save the relative
294
+ relativePath = filePath.replace(defaultPath.concat("/"), "");
295
+ }
292
296
 
293
297
  await setConfigImportRelativePath(relativePath);
294
298
  await forceDefaultsUpdate();
@@ -298,8 +302,12 @@ export const updateSavedFilePath = async(filePath) => {
298
302
  else {
299
303
  // mac
300
304
  if (filePath.indexOf(defaultPath) === 0) {
301
- // same starting path, so we can save the relative
302
- const relativePath = filePath.replace(defaultPath.concat("/"), "");
305
+
306
+ let relativePath = "";
307
+ if (filePath !== defaultPath) {
308
+ // same starting path, so we can save the relative
309
+ relativePath = filePath.replace(defaultPath.concat("/"), "");
310
+ }
303
311
 
304
312
  await setConfigImportRelativePath(relativePath);
305
313
  await forceDefaultsUpdate();
@@ -54,15 +54,40 @@ export const updateSavedFilePath = async(filePath) => {
54
54
 
55
55
  let defaultPath = join(path.sep, arPathParts[0], arPathParts[1], arPathParts[2]);
56
56
 
57
- if (filePath.indexOf(defaultPath) === 0) {
58
- // same starting path, so we can save the relative
59
- const relativePath = filePath.replace(defaultPath.concat("/"), "");
57
+ if (path.sep != "/") {
58
+ // windows
59
+ if (defaultPath.indexOf(path.sep) === 0) {
60
+ // if start with \\, then remove
61
+ defaultPath = defaultPath.substring(1);
62
+ }
63
+
64
+ if (filePath.indexOf(defaultPath) === 0) {
65
+
66
+ let relativePath = "";
67
+ if (filePath !== defaultPath) {
68
+ // same starting path, so we can save the relative
69
+ relativePath = filePath.replace(defaultPath.concat("/"), "");
70
+ }
60
71
 
61
- if (relativePath != configDef.importRelativePath) {
62
72
  await setConfigImportRelativePath(relativePath);
63
73
  await forceDefaultsUpdate();
74
+
64
75
  }
76
+ }
77
+ else {
78
+ // mac
79
+ if (filePath.indexOf(defaultPath) === 0) {
65
80
 
81
+ let relativePath = "";
82
+ if (filePath !== defaultPath) {
83
+ // same starting path, so we can save the relative
84
+ relativePath = filePath.replace(defaultPath.concat("/"), "");
85
+ }
66
86
 
87
+ await setConfigImportRelativePath(relativePath);
88
+ await forceDefaultsUpdate();
89
+
90
+ }
67
91
  }
92
+
68
93
  }
@@ -284,7 +284,7 @@ addDebugLog("getFolderList", `filePath: ${filePath}`, "");
284
284
  if (fs.existsSync(filePath)) {
285
285
  return fs
286
286
  .readdirSync(filePath, { withFileTypes: true })
287
- .filter(dirent => dirent.isDirectory())
287
+ .filter(dirent => dirent.isDirectory() && !dirent.name.startsWith("."))
288
288
  .map(dirent => dirent.name);
289
289
  }
290
290
  else {
@@ -101,8 +101,8 @@
101
101
  },
102
102
  "devDependencies": {
103
103
  "@pega/configs": "^0.15.1",
104
- "@pega/custom-dx-components": "~0.242.58",
105
- "@pega/pcore-pconnect-typedefs": "~3.2.0-alpha.2",
104
+ "@pega/custom-dx-components": "~0.242.60",
105
+ "@pega/pcore-pconnect-typedefs": "3.2.1",
106
106
  "@storybook/addon-actions": "^7.6.19",
107
107
  "@storybook/addon-essentials": "^7.6.19",
108
108
  "@storybook/addon-knobs": "^7.1.1",
@@ -37,7 +37,7 @@ addDebugLog("restoreConfig", "", "+");
37
37
  },
38
38
  ]);
39
39
 
40
- await restoreTopLevelConfigFilesFromTemplate();
40
+ await restoreTopLevelConfigFilesFromTemplate(false);
41
41
  console.log(chalk.green("Original config files restored."));
42
42
 
43
43
  if (restoreAns.restoreDev) {
package/src/util.js CHANGED
@@ -604,7 +604,7 @@ if (showDebug) addDebugLog("getTemplateConfigFiles", ``, "");
604
604
 
605
605
  }
606
606
 
607
- export const restoreTopLevelConfigFilesFromTemplate = async() => {
607
+ export const restoreTopLevelConfigFilesFromTemplate = async(clearDep = true) => {
608
608
  if (showDebug) addDebugLog("restoreTopLevelConfigFilesFromTemplate", ``, "");
609
609
  // we can't loose devDep that is part of install, so go get the template mustache and push
610
610
  // those in, replacing any changes there, but allowing additional, an keeping it updated
@@ -661,9 +661,10 @@ if (showDebug) addDebugLog("restoreTopLevelConfigFilesFromTemplate", ``, "");
661
661
 
662
662
 
663
663
  // clear out
664
- cData.dependencies = {};
665
- cData.devDependencies = {};
666
-
664
+ if (clearDep) {
665
+ cData.dependencies = {};
666
+ cData.devDependencies = {};
667
+ }
667
668
 
668
669
 
669
670
  const tDep = tData.dependencies;
@@ -860,7 +861,7 @@ if (showDebug) addDebugLog("setConfigImportRelativePath", `importRelativePath: $
860
861
  }
861
862
 
862
863
  export const setConfigExportRelativePath = async (exportRelativePath) => {
863
- if (showDebug) addDebugLog("setConfigImportRelativePath", `exportRelativePath: ${exportRelativePath}`, "");
864
+ if (showDebug) addDebugLog("setConfigExportRelativePath", `exportRelativePath: ${exportRelativePath}`, "");
864
865
  const currentDirectory = process.cwd();
865
866
  const pegaConfigJsonPath = join(currentDirectory, TASKS_CONFIG_JSON_FILENAME);
866
867
  let configData = await getPegaConfig(true);
@@ -1557,10 +1558,13 @@ if (showDebug) addDebugLog("getComponentsConfigs", "", "");
1557
1558
  const componentDirectory = await getComponentDirectoryPath(componentKey, compDir);
1558
1559
  const configPath = join(componentDirectory, 'config.json');
1559
1560
 
1560
- let data = fs.readFileSync(configPath, { encoding: 'utf8' });
1561
+ if (fs.existsSync(configPath)) {
1562
+ let data = fs.readFileSync(configPath, { encoding: 'utf8' });
1563
+
1564
+ data = JSON.parse(data);
1565
+ componentsConfigJSON.push(data);
1566
+ }
1561
1567
 
1562
- data = JSON.parse(data);
1563
- componentsConfigJSON.push(data);
1564
1568
 
1565
1569
  }
1566
1570
  }