@pega/custom-dx-components 0.242.44 → 0.242.45

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.44",
3
+ "version": "0.242.45",
4
4
  "description": "Utility for building custom UI components",
5
5
  "bin": "./bin/index.js",
6
6
  "scripts": {
@@ -3,7 +3,7 @@ import fs from 'fs';
3
3
  import path from 'path';
4
4
  import { join } from 'path';
5
5
  import { Listr } from 'listr2';
6
- import { addDebugLog, getConfigDefaults, convertIntoPascalCase, getComponents, getComponentDirectoryPath, getDirectoryFiles } from '../../util.js';
6
+ import { addDebugLog, getConfigDefaults, convertIntoPascalCase, getComponents, getComponentDirectoryPath, getDirectoryFiles, setConfigImportRelativePath, forceDefaultsUpdate } from '../../util.js';
7
7
  import { TASKS_CONFIG_JSON_FILENAME, TEMP_PATH, PACKAGE_JSON_FILENAME } from '../../constants.js';
8
8
 
9
9
 
@@ -251,9 +251,11 @@ addDebugLog("getFilePathQuestions", "", "");
251
251
  console.log("\tWindows:\tC:\\Users\\name\\...\n");
252
252
  }
253
253
 
254
+ const configDef = getConfigDefaults();
255
+
254
256
  const currentDirectory = process.cwd();
255
257
  const arPathParts = currentDirectory.split(path.sep);
256
- let defaultPath = join(arPathParts[0], arPathParts[1], arPathParts[2], "Downloads");
258
+ let defaultPath = join(arPathParts[0], arPathParts[1], arPathParts[2], configDef.importRelativePath);
257
259
  if (path.sep === "/") {
258
260
  defaultPath = "/".concat(defaultPath);
259
261
  }
@@ -280,3 +282,23 @@ addDebugLog("getFileNameQuestions", "", "");
280
282
  },
281
283
  ];
282
284
  };
285
+
286
+ export const updateSavedFilePath = async(filePath) => {
287
+ const currentDirectory = process.cwd();
288
+ const arPathParts = currentDirectory.split(path.sep);
289
+ const configDef = getConfigDefaults();
290
+
291
+ let defaultPath = join(path.sep, arPathParts[0], arPathParts[1], arPathParts[2]);
292
+
293
+ if (filePath.indexOf(defaultPath) === 0) {
294
+ // same starting path, so we can save the relative
295
+ const relativePath = filePath.replace(defaultPath.concat("/"), "");
296
+
297
+ if (relativePath != configDef.importRelativePath) {
298
+ await setConfigImportRelativePath(relativePath);
299
+ await forceDefaultsUpdate();
300
+ }
301
+
302
+
303
+ }
304
+ }
@@ -22,7 +22,7 @@ import {
22
22
  cleanUpTemp
23
23
  } from '../../util.js';
24
24
  import { TASKS_CONFIG_JSON_FILENAME, ARCHIVES_PATH, TEMP_PATH } from '../../constants.js';
25
- import { getFilePathQuestions, getFileNameQuestions, updateTempArchive } from './helper.js';
25
+ import { getFilePathQuestions, getFileNameQuestions, updateTempArchive, updateSavedFilePath } from './helper.js';
26
26
 
27
27
  export const DXCB_CONFIG_INTERNAL_JSON_FILENAME = 'src/dxcb.config.json';
28
28
  const currentDirectory = process.cwd();
@@ -381,6 +381,8 @@ export default async options => {
381
381
  process.exit();
382
382
  }
383
383
 
384
+ await updateSavedFilePath(filePath);
385
+
384
386
  const fileNameQuestions = await getFileNameQuestions(zipFileList);
385
387
  const fileNameAnswers = await inquirer.prompt(fileNameQuestions);
386
388
  const {fileName} = fileNameAnswers;
@@ -100,7 +100,7 @@
100
100
  },
101
101
  "devDependencies": {
102
102
  "@pega/configs": "^0.6.0",
103
- "@pega/custom-dx-components": "~0.242.44",
103
+ "@pega/custom-dx-components": "~0.242.45",
104
104
  "@pega/pcore-pconnect-typedefs": "~3.0.0",
105
105
  "@storybook/addon-actions": "^7.6.7",
106
106
  "@storybook/addon-essentials": "^7.6.19",