@pega/custom-dx-components 0.23.38 → 0.23.40

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.23.38",
3
+ "version": "0.23.40",
4
4
  "description": "Utility for building custom UI components",
5
5
  "bin": "./bin/index.js",
6
6
  "scripts": {
@@ -69,7 +69,7 @@
69
69
  },
70
70
  "devDependencies": {
71
71
  "@pega/configs": "^0.6.0",
72
- "@pega/custom-dx-components": "0.23.38",
72
+ "@pega/custom-dx-components": "0.23.40",
73
73
  "@pega/pcore-pconnect-typedefs": "~2.1.1",
74
74
  "@storybook/addon-actions": "^7.6.7",
75
75
  "@storybook/addon-essentials": "^7.6.7",
@@ -27,7 +27,6 @@
27
27
  "questions_askOnce": "server,authService",
28
28
  "questions_askedOnce": ""
29
29
  },
30
- "usePromotedWebPack": false,
31
30
  "component": {
32
31
  "library": "Extensions",
33
32
  "type": "",
@@ -35,5 +34,6 @@
35
34
  "subtype": "",
36
35
  "description": "",
37
36
  "icon": ""
38
- }
37
+ },
38
+ "usePromotedWebPack": false
39
39
  }
@@ -23,8 +23,6 @@ import {
23
23
 
24
24
 
25
25
 
26
- let redirectFile = "";
27
-
28
26
  export const copyWebPack = async () => {
29
27
 
30
28
  // first check to see if already have the file
@@ -80,13 +78,12 @@ export const copyWebPack = async () => {
80
78
  }
81
79
 
82
80
 
83
-
84
-
85
-
81
+ console.log(chalk.bold.green(`Bundler now using ${newWebPackConfigDir}.`));
82
+ console.log(chalk.bold.green(`Utilize this file for webpack modifications.`));
86
83
 
87
84
  }
88
85
 
89
- redirectFile = newWebPackConfigDir;
86
+
90
87
 
91
88
 
92
89
 
@@ -34,6 +34,7 @@ export const renamePromotedWebPack = async () => {
34
34
  process.exit();
35
35
  }
36
36
 
37
+ console.log(chalk.bold.green("Bundler reverted to using internal webpack.config.js."));
37
38
  console.log(chalk.bold.green(`File ${promoteWebPackDir} marked as not used.`));
38
39
 
39
40
  }
package/src/util.js CHANGED
@@ -25,16 +25,22 @@ import {
25
25
 
26
26
  const access = promisify(fs.access);
27
27
 
28
- export const checkPathAccess = async (path, options = {}) => {
28
+ export const checkPathAccess = async (path, options = {}, throwError = false) => {
29
29
  const { errorMessage } = options;
30
30
 
31
31
  try {
32
32
  await access(path, fs.constants.R_OK);
33
33
  } catch (err) {
34
- const message =
35
- errorMessage || `${chalk.red.bold('ERROR')} Could not able to access path - ${path}`;
36
- console.error(message);
37
- process.exit(1);
34
+ if (throwError) {
35
+ throw new Error(err);
36
+ }
37
+ else {
38
+ const message =
39
+ errorMessage || `${chalk.red.bold('ERROR')} Could not able to access path - ${path}`;
40
+ console.error(message);
41
+ process.exit(1);
42
+ }
43
+
38
44
  }
39
45
  };
40
46
 
@@ -42,7 +48,15 @@ export const getUseWebPackPromotion = async () => {
42
48
  const currentDirectory = process.cwd();
43
49
  const pegaConfigJsonPath = join(currentDirectory, TASKS_CONFIG_JSON_FILENAME);
44
50
 
45
- await checkPathAccess(pegaConfigJsonPath);
51
+ try {
52
+ // force to throw error and not console log
53
+ await checkPathAccess(pegaConfigJsonPath, {}, true);
54
+ }
55
+ catch (ex) {
56
+ // when can't find it, always be false, assume no webpack override.
57
+ // This is IMPORTANT for init (npx install)
58
+ return false;
59
+ }
46
60
 
47
61
  let data = fs.readFileSync(pegaConfigJsonPath, { encoding: 'utf8' });
48
62
  data = JSON.parse(data);