generator-easy-ui5 3.8.0 → 3.8.1

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/README.md CHANGED
@@ -104,9 +104,27 @@ yo easy-ui5 [project|library] <sub-generator-id>
104
104
  If you are running Easy UI5 behind a coporate proxy, just use the default proxy environment variables for Node.js to configure your corporate proxy:
105
105
 
106
106
  - `HTTP_PROXY`: Specify the value to use as the HTTP proxy for all connections, e.g., `HTTP_PROXY="http://proxy.mycompany.com:8080/"`.
107
- - `HTTPS_PROXY`: Specify the value to use as the HTTPS proxy for all connections, e.g., `HTTPS_PROXY="https://proxy.mycompany.com:8080/"`.
107
+ - `HTTPS_PROXY`: Specify the value to use as the HTTPS proxy for all connections, e.g., `HTTPS_PROXY="http://proxy.mycompany.com:8080/"`.
108
108
  - `NO_PROXY`: Define the hosts that should bypass the proxy, e.g., `NO_PROXY="localhost,.mycompany.com,192.168.6.254:80"`.
109
109
 
110
+ In addition, Easy UI5 also supports proxy configuration from the `.npmrc` configuration:
111
+
112
+ ```text
113
+ http-proxy=http://proxy.mycompany.com:8080/
114
+ https-proxy=http://proxy.mycompany.com:8080/
115
+ proxy=http://proxy.mycompany.com:8080/
116
+ no-proxy=localhost,.mycompany.com,192.168.6.254:80
117
+ ```
118
+
119
+ This configuration is shared with npm itself since this proxy configuration is used to download the packages from npm.
120
+
121
+ Proxies can be passed as env variables or as npm config options. The highest precedence have the `GLOBAL_AGENT_*` env variables before the regular env variables followed by the npm configuration options, e.g.:
122
+
123
+ 1. env: `GLOBAL_AGENT_HTTP_PROXY`
124
+ 2. env: `HTTP_PROXY`
125
+ 3. npm: `http-proxy`
126
+ 4. npm: `proxy`
127
+
110
128
  ## How to obtain support
111
129
 
112
130
  Please use the GitHub bug tracking system to post questions, bug reports or to create pull requests.
@@ -15,29 +15,33 @@ import { Octokit } from "@octokit/rest";
15
15
  import { throttling } from "@octokit/plugin-throttling";
16
16
  const MyOctokit = Octokit.plugin(throttling);
17
17
  import spawn from "cross-spawn";
18
+ import nodeFetch from "node-fetch";
18
19
 
19
20
  const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
20
21
 
21
- // apply proxy settings to GLOBAL_AGENT to support the proxy configuration
22
- // provided via the standard Node.js environment varibales (used for fetch API)
23
- let HTTP_PROXY, HTTPS_PROXY, NO_PROXY;
24
- if (global?.GLOBAL_AGENT) {
25
- HTTP_PROXY = global.GLOBAL_AGENT.HTTP_PROXY = process.env.HTTP_PROXY || process.env.http_proxy;
26
- HTTPS_PROXY = global.GLOBAL_AGENT.HTTPS_PROXY = process.env.HTTPS_PROXY || process.env.https_proxy;
27
- NO_PROXY = global.GLOBAL_AGENT.NO_PROXY = process.env.NO_PROXY || process.env.no_proxy;
28
- }
29
-
30
22
  // helper to retrieve config entries from npm
31
23
  // --> npm config set easy-ui5_addGhOrg XYZ
32
- const NPM_CONFIG_PREFIX = "easy-ui5_";
33
24
  let npmConfig;
34
- const getNPMConfig = (configName) => {
25
+ const getNPMConfig = (configName, prefix = "easy-ui5_") => {
35
26
  if (!npmConfig) {
36
27
  npmConfig = libnpmconfig.read();
37
28
  }
38
- return npmConfig && npmConfig[`${NPM_CONFIG_PREFIX}${configName}`];
29
+ return npmConfig && npmConfig[`${prefix}${configName}`];
39
30
  };
40
31
 
32
+ // apply proxy settings to GLOBAL_AGENT to support the proxy configuration for node-fetch using the GLOBAL_AGENT
33
+ // ==> the configuration is derived from the environment variables ([GLOBAL_AGENT_](HTTP|HTTPS|NO)_PROXY) and the npm config ((http|https|no)-proxy)
34
+ // ==> empty values will allow to override the more general proxy settings and make the proxy value undefined
35
+ let HTTP_PROXY, HTTPS_PROXY, NO_PROXY;
36
+ if (global?.GLOBAL_AGENT) {
37
+ HTTP_PROXY = process.env.GLOBAL_AGENT_HTTP_PROXY ?? process.env.HTTP_PROXY ?? process.env.http_proxy ?? getNPMConfig("http-proxy", "") ?? getNPMConfig("proxy", "");
38
+ global.GLOBAL_AGENT.HTTP_PROXY = HTTP_PROXY = HTTP_PROXY || global.GLOBAL_AGENT.HTTP_PROXY;
39
+ HTTPS_PROXY = process.env.GLOBAL_AGENT_HTTPS_PROXY ?? process.env.HTTPS_PROXY ?? process.env.https_proxy ?? getNPMConfig("https-proxy", "") ?? getNPMConfig("proxy", "");
40
+ global.GLOBAL_AGENT.HTTPS_PROXY = HTTPS_PROXY = HTTPS_PROXY || global.GLOBAL_AGENT.HTTPS_PROXY;
41
+ NO_PROXY = process.env.GLOBAL_AGENT_NO_PROXY ?? process.env.NO_PROXY ?? process.env.no_proxy ?? getNPMConfig("no-proxy", "");
42
+ global.GLOBAL_AGENT.NO_PROXY = NO_PROXY = NO_PROXY || global.GLOBAL_AGENT.NO_PROXY;
43
+ }
44
+
41
45
  // the command line options of the generator
42
46
  const generatorOptions = {
43
47
  pluginsHome: {
@@ -265,7 +269,7 @@ export default class extends Generator {
265
269
  });
266
270
  generator.branch = repoInfo.data.default_branch;
267
271
  } catch (e) {
268
- console.error(`Generator "${owner}/${repo}!${dir}${branch ? "#" + branch : ""}" not found! Run with --verbose for details!`);
272
+ console.error(`Generator "${owner}/${repo}!${dir}${branch ? "#" + branch : ""}" not found! Run with --verbose for details!\n(Hint: ${e.message})`);
269
273
  if (this.options.verbose) {
270
274
  console.error(e);
271
275
  }
@@ -283,7 +287,9 @@ export default class extends Generator {
283
287
  });
284
288
  commitSHA = reqBranch.data.commit.sha;
285
289
  } catch (ex) {
286
- console.error(chalk.red(`Failed to retrieve the branch "${generator.branch}" for repository "${generator.name}" for "${generator.org}" organization! Run with --verbose for details!`));
290
+ console.error(
291
+ chalk.red(`Failed to retrieve the branch "${generator.branch}" for repository "${generator.name}" for "${generator.org}" organization! Run with --verbose for details!\n(Hint: ${e.message})`)
292
+ );
287
293
  if (this.options.verbose) {
288
294
  console.error(chalk.red(ex.message));
289
295
  }
@@ -405,6 +411,13 @@ export default class extends Generator {
405
411
  // define the options for the Octokit API
406
412
  const octokitOptions = {
407
413
  userAgent: `${this.rootGeneratorName()}:${this.rootGeneratorVersion()}`,
414
+ request: {
415
+ fetch: (_url, _options) => {
416
+ return nodeFetch(_url, {
417
+ ..._options,
418
+ });
419
+ },
420
+ },
408
421
  auth: this.options.ghAuthToken,
409
422
  baseUrl: this.options.ghBaseUrl,
410
423
  throttle: {
@@ -555,7 +568,7 @@ export default class extends Generator {
555
568
  };
556
569
  });
557
570
  } catch (e) {
558
- console.error("Failed to connect to bestofui5.org to retrieve all available generators! Run with --verbose for details!");
571
+ console.error(`Failed to connect to bestofui5.org to retrieve all available generators! Run with --verbose for details!\n(Hint: ${e.message})`);
559
572
  if (this.options.verbose) {
560
573
  console.error(e);
561
574
  }
@@ -566,7 +579,7 @@ export default class extends Generator {
566
579
  try {
567
580
  availGenerators = await listGeneratorsForOrg(this.options.ghOrg, this.options.subGeneratorPrefix, this.options.ghThreshold);
568
581
  } catch (e) {
569
- console.error(`Failed to connect to GitHub to retrieve all available generators for "${this.options.ghOrg}" organization! Run with --verbose for details!`);
582
+ console.error(`Failed to connect to GitHub to retrieve all available generators for "${this.options.ghOrg}" organization! Run with --verbose for details!\n(Hint: ${e.message})`);
570
583
  if (this.options.verbose) {
571
584
  console.error(e);
572
585
  }
@@ -585,7 +598,7 @@ export default class extends Generator {
585
598
  try {
586
599
  availGenerators = availGenerators.concat(await listGeneratorsForUser(this.options.addGhOrg, this.options.addSubGeneratorPrefix, this.options.ghThreshold));
587
600
  } catch (e1) {
588
- console.error(`Failed to connect to GitHub to retrieve additional generators for organization or user "${this.options.addGhOrg}"! Run with --verbose for details!`);
601
+ console.error(`Failed to connect to GitHub to retrieve additional generators for organization or user "${this.options.addGhOrg}"! Run with --verbose for details!\n(Hint: ${e.message})`);
589
602
  if (this.options.verbose) {
590
603
  console.error(e1);
591
604
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generator-easy-ui5",
3
- "version": "3.8.0",
3
+ "version": "3.8.1",
4
4
  "description": "Generator for UI5-based project",
5
5
  "main": "generators/app/index.js",
6
6
  "type": "module",
@@ -55,6 +55,7 @@
55
55
  "colors": "^1.4.0",
56
56
  "glob": "^10.3.10",
57
57
  "libnpmconfig": "^1.2.1",
58
+ "node-fetch": "^3.3.2",
58
59
  "rimraf": "^5.0.5",
59
60
  "yeoman-environment": "^3.19.3",
60
61
  "yeoman-generator": "^5.10.0",
Binary file