@vkontakte/vk-miniapps-deploy 0.1.9-rc.1 → 0.2.0
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.
|
@@ -42,6 +42,13 @@ body:
|
|
|
42
42
|
description: Если считаете, что из описания ожидаемое поведение непонятно.
|
|
43
43
|
validations:
|
|
44
44
|
required: true
|
|
45
|
+
- type: textarea
|
|
46
|
+
id: actual-behavior
|
|
47
|
+
attributes:
|
|
48
|
+
label: Фактическое поведение
|
|
49
|
+
description: Результат выполнения в текущей реализации.
|
|
50
|
+
validations:
|
|
51
|
+
required: true
|
|
45
52
|
- type: textarea
|
|
46
53
|
id: screenshots
|
|
47
54
|
attributes:
|
package/CHANGELOG.md
ADDED
package/index.js
CHANGED
|
@@ -5,6 +5,7 @@ const prompt = require('prompts');
|
|
|
5
5
|
const nodeFetch = require('node-fetch');
|
|
6
6
|
const { zip } = require('zip-a-folder');
|
|
7
7
|
const fs = require('fs-extra');
|
|
8
|
+
const { HttpsProxyAgent } = require('https-proxy-agent');
|
|
8
9
|
const FormData = require('form-data');
|
|
9
10
|
const Configstore = require('configstore');
|
|
10
11
|
const vault = new Configstore(packageJson.name, {});
|
|
@@ -69,14 +70,21 @@ function getTraceId() {
|
|
|
69
70
|
return crypto.randomBytes(4).toString('hex');
|
|
70
71
|
}
|
|
71
72
|
|
|
73
|
+
function getProxyAgent() {
|
|
74
|
+
const proxy = cfg.proxy_url || process.env.HTTP_PROXY || process.env.HTTPS_PROXY;
|
|
75
|
+
return proxy ? new HttpsProxyAgent(proxy) : undefined;
|
|
76
|
+
}
|
|
77
|
+
|
|
72
78
|
/**
|
|
73
79
|
* @param {nodeFetch.RequestInfo} url
|
|
74
80
|
* @param {nodeFetch.RequestInit} options
|
|
75
81
|
* @returns {Promise<nodeFetch.Response>}
|
|
76
82
|
*/
|
|
77
83
|
async function fetch(url, options) {
|
|
84
|
+
const fetchOptions = { ...options, agent: getProxyAgent() || options?.agent };
|
|
85
|
+
|
|
78
86
|
if (!DEBUG_MODE) {
|
|
79
|
-
return nodeFetch(url,
|
|
87
|
+
return nodeFetch(url, fetchOptions);
|
|
80
88
|
}
|
|
81
89
|
|
|
82
90
|
const traceId = chalk.hex(`#${((Math.random() * 0xffffff) << 0).toString(16)}`)(getTraceId());
|
|
@@ -85,9 +93,9 @@ async function fetch(url, options) {
|
|
|
85
93
|
|
|
86
94
|
try {
|
|
87
95
|
logLine(url, 'REQ');
|
|
88
|
-
options && logLine(JSON.stringify(
|
|
96
|
+
options && logLine(JSON.stringify(fetchOptions), 'REQ');
|
|
89
97
|
|
|
90
|
-
const response = await nodeFetch(url,
|
|
98
|
+
const response = await nodeFetch(url, fetchOptions);
|
|
91
99
|
const body = await response.clone().text();
|
|
92
100
|
|
|
93
101
|
logLine(`${response.status} ${response.statusText}`, 'RESP');
|
|
@@ -428,14 +436,32 @@ async function run(cfg) {
|
|
|
428
436
|
const params = {
|
|
429
437
|
app_id: cfg.app_id,
|
|
430
438
|
environment: environment,
|
|
431
|
-
update_prod: +cfg.update_prod,
|
|
432
|
-
update_dev: +cfg.update_dev,
|
|
433
439
|
};
|
|
434
440
|
|
|
435
441
|
if ('test_group_name' in cfg) {
|
|
436
442
|
params.test_group_name = cfg.test_group_name;
|
|
437
443
|
}
|
|
438
444
|
|
|
445
|
+
if ('update_prod' in cfg) {
|
|
446
|
+
const update_prod = Number(cfg.update_prod);
|
|
447
|
+
|
|
448
|
+
if (update_prod !== 0 && update_prod !== 1) {
|
|
449
|
+
throw new Error('update_prod must be 0 or 1 or boolean.');
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
params.update_prod = update_prod;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
if ('update_dev' in cfg) {
|
|
456
|
+
const update_dev = Number(cfg.update_dev);
|
|
457
|
+
|
|
458
|
+
if (update_dev !== 0 && update_dev !== 1) {
|
|
459
|
+
throw new Error('update_dev must be 0 or 1 or boolean.');
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
params.update_dev = update_dev;
|
|
463
|
+
}
|
|
464
|
+
|
|
439
465
|
const endpointPlatformKeys = Object.keys(cfg.endpoints);
|
|
440
466
|
if (endpointPlatformKeys.length) {
|
|
441
467
|
for (let i = 0; i < endpointPlatformKeys.length; i++) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vkontakte/vk-miniapps-deploy",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Deploy to VK Mini Apps hosting with one simple command",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"configstore": "^5.0.0",
|
|
43
43
|
"form-data": "^3.0.0",
|
|
44
44
|
"fs-extra": "^8.0.1",
|
|
45
|
+
"https-proxy-agent": "^7.0.6",
|
|
45
46
|
"node-fetch": "^2.6.0",
|
|
46
47
|
"prompts": "^2.1.0",
|
|
47
48
|
"require-module": "^0.1.0",
|