@saltcorn/plugins-loader 1.1.0-beta.22 → 1.1.0-beta.25

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.
Files changed (2) hide show
  1. package/download_utils.js +11 -1
  2. package/package.json +3 -2
package/download_utils.js CHANGED
@@ -8,6 +8,14 @@ const { join } = require("path");
8
8
  const { createWriteStream, unlink } = require("fs");
9
9
  const { get } = require("https");
10
10
  const npmFetch = require("npm-registry-fetch");
11
+ const { HttpsProxyAgent } = require("https-proxy-agent");
12
+
13
+ const getFetchProxyOptions = () => {
14
+ if (process.env["HTTPS_PROXY"]) {
15
+ const agent = new HttpsProxyAgent(process.env["HTTPS_PROXY"]);
16
+ return { agent };
17
+ } else return {};
18
+ };
11
19
 
12
20
  const downloadFromGithub = async (plugin, rootFolder, pluginDir) => {
13
21
  const tarballUrl = `https://api.github.com/repos/${plugin.location}/tarball`;
@@ -19,7 +27,8 @@ const downloadFromGithub = async (plugin, rootFolder, pluginDir) => {
19
27
 
20
28
  const downloadFromNpm = async (plugin, rootFolder, pluginDir, pckJson) => {
21
29
  const pkgInfo = await npmFetch.json(
22
- `https://registry.npmjs.org/${plugin.location}`
30
+ `https://registry.npmjs.org/${plugin.location}`,
31
+ getFetchProxyOptions()
23
32
  );
24
33
  const keys = Object.keys(pkgInfo.versions);
25
34
  const latest = keys[keys.length - 1];
@@ -148,4 +157,5 @@ module.exports = {
148
157
  extractTarball,
149
158
  tarballExists,
150
159
  removeTarball,
160
+ getFetchProxyOptions,
151
161
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saltcorn/plugins-loader",
3
- "version": "1.1.0-beta.22",
3
+ "version": "1.1.0-beta.25",
4
4
  "description": "Saltcorn plugin loader",
5
5
  "homepage": "https://saltcorn.com",
6
6
  "scripts": {
@@ -11,7 +11,8 @@
11
11
  "dependencies": {
12
12
  "env-paths": "^2.2.0",
13
13
  "npm-registry-fetch": "17.1.0",
14
- "@saltcorn/data": "1.1.0-beta.22"
14
+ "@saltcorn/data": "1.1.0-beta.25",
15
+ "https-proxy-agent": "^7.0.6"
15
16
  },
16
17
  "author": "Christian Hugo",
17
18
  "license": "MIT",