@vkontakte/vk-miniapps-deploy 0.1.9 → 0.2.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.
@@ -9,8 +9,6 @@ jobs:
9
9
  steps:
10
10
  - name: Checkout
11
11
  uses: actions/checkout@v4
12
- with:
13
- token: ${{ secrets.DEVTOOLS_GITHUB_TOKEN }}
14
12
 
15
13
  - name: Setting up the repository environment
16
14
  uses: ./.github/actions/setup
package/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ ## v0.2.1
2
+
3
+ - ⚠️ Предупреждение: добавлено сообщение в `postinstall`, информирующее о прекращении поддержки версий ниже `v1.0.0`.
4
+
5
+ ## v0.2.0
6
+
7
+ - Добавили поддержку деплоя через proxy сервер.
8
+
9
+ ## v0.1.9
10
+
11
+ - Добавили усиленную валидацию параметров для `noprompt` режима.
package/README.md CHANGED
@@ -20,6 +20,7 @@ First add this to your scripts section of `package.json`:
20
20
 
21
21
  ```JSON
22
22
  "scripts": {
23
+ "predeploy": "npm run build",
23
24
  "deploy": "vk-miniapps-deploy",
24
25
  "clean-source": "rimraf README.md src webroot package.json"
25
26
  },
@@ -79,3 +80,5 @@ rm ~/.config/configstore/@vkontakte/vk-miniapps-deploy.json
79
80
 
80
81
  [npm]: https://img.shields.io/npm/v/@vkontakte/vk-miniapps-deploy.svg
81
82
  [npm-url]: https://npmjs.com/package/@vkontakte/vk-miniapps-deploy
83
+
84
+ For more details, visit the official [VK Developer Portal](https://dev.vk.com/mini-apps/development/hosting/overview).
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, options);
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(options), 'REQ');
96
+ options && logLine(JSON.stringify(fetchOptions), 'REQ');
89
97
 
90
- const response = await nodeFetch(url, options);
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');
@@ -492,6 +500,10 @@ async function run(cfg) {
492
500
  return await upload(uploadURL, bundleFile).then((r) => {
493
501
  if (r.version) {
494
502
  console.log('Uploaded version ' + r.version + '!');
503
+ console.warn(
504
+ 'WARNING: Versions below 1.0.0 are deprecated. Please upgrade to v1.0.0 or later.',
505
+ );
506
+
495
507
  return getQueue(r.version, cfg);
496
508
  } else {
497
509
  console.error('Upload error:', r);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/vk-miniapps-deploy",
3
- "version": "0.1.9",
3
+ "version": "0.2.1",
4
4
  "description": "Deploy to VK Mini Apps hosting with one simple command",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -9,7 +9,8 @@
9
9
  "lint:eslint": "eslint ./index.js",
10
10
  "lint:prettier": "prettier --check ./index.js",
11
11
  "lint:fix": "eslint ./index.js --fix",
12
- "lint:ci": "yarn lint:eslint && yarn lint:prettier"
12
+ "lint:ci": "yarn lint:eslint && yarn lint:prettier",
13
+ "postinstall": "node -e \"console.warn('WARNING: Versions below 1.0.0 are deprecated. Please upgrade to v1.0.0 or later.')\""
13
14
  },
14
15
  "license": "MIT",
15
16
  "engines": {
@@ -42,6 +43,7 @@
42
43
  "configstore": "^5.0.0",
43
44
  "form-data": "^3.0.0",
44
45
  "fs-extra": "^8.0.1",
46
+ "https-proxy-agent": "^7.0.6",
45
47
  "node-fetch": "^2.6.0",
46
48
  "prompts": "^2.1.0",
47
49
  "require-module": "^0.1.0",