@automattic/vip 2.8.0-alpha → 2.8.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.
package/README.md CHANGED
@@ -27,6 +27,23 @@ By default, we record information about the usage of this tool using an in-house
27
27
 
28
28
  ## Changelog
29
29
 
30
+ ### 2.8.0 (25 January 2021)
31
+ - #952 FORNO-1047: Fix SQL Import for compressed files
32
+ - #955 Add Error prefix for "Failed to fetch logs" msg
33
+ - #946 Add support for the site logs tailing feature
34
+ - #953 [dev-env] Updated list of available wordpress images for dev-env
35
+ - #933 Update dependency debug to v4.3.3
36
+
37
+ https://github.com/Automattic/vip/releases/tag/v2.8.0
38
+
39
+ ### 2.7.1 (10 January 2021)
40
+ - #950 Switch to npm-shrinkwrap
41
+ - #947 [dev-env] List all dev env alias
42
+ - #944 Add `vip whoami` command
43
+ - #942 Envvar: Show message when there is an attempt to change the New Relic key.
44
+
45
+ https://github.com/Automattic/vip/releases/tag/v2.7.1
46
+
30
47
  ### 2.7.0 (07 December 2021)
31
48
  - #941 [dev-env] Bump lando CLI dependency
32
49
  - #938 Hide roll back message after SQL Import failure for launched sites
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "tracksUserType": "vip:user_id",
3
3
  "tracksAnonUserType": "anon",
4
- "tracksEventPrefix": "vip_cli_dev_",
5
- "environment": "development"
4
+ "tracksEventPrefix": "vip_cli_",
5
+ "environment": "production"
6
6
  }
File without changes
File without changes
@@ -54,6 +54,8 @@ var _progress = require("../lib/cli/progress");
54
54
 
55
55
  var _isMultiSite = require("../lib/validations/is-multi-site");
56
56
 
57
+ var _path = _interopRequireDefault(require("path"));
58
+
57
59
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
58
60
 
59
61
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -367,9 +369,11 @@ const displayPlaybook = ({
367
369
 
368
370
  const {
369
371
  app,
370
- env,
371
- searchReplace,
372
- skipValidate
372
+ env
373
+ } = opts;
374
+ let {
375
+ skipValidate,
376
+ searchReplace
373
377
  } = opts;
374
378
  const {
375
379
  id: envId,
@@ -377,6 +381,14 @@ const displayPlaybook = ({
377
381
  } = env;
378
382
  const [fileName] = arg;
379
383
  const isMultiSite = await (0, _isMultiSite.isMultiSiteInSiteMeta)(appId, envId);
384
+ const fileMeta = await (0, _clientFileUploader.getFileMeta)(fileName);
385
+
386
+ if (fileMeta.isCompressed) {
387
+ console.log(_chalk.default.yellowBright('You are importing a compressed file. Validation and search-replace operation will be skipped.'));
388
+ skipValidate = true;
389
+ searchReplace = undefined;
390
+ }
391
+
380
392
  debug('Options: ', opts);
381
393
  debug('Args: ', arg);
382
394
 
@@ -481,14 +493,15 @@ Processing the SQL import for your environment...
481
493
  try {
482
494
  const {
483
495
  fileMeta: {
484
- basename,
485
- md5
496
+ basename
486
497
  },
498
+ md5,
487
499
  result
488
500
  } = await (0, _clientFileUploader.uploadImportSqlFileToS3)({
489
501
  app,
490
502
  env,
491
503
  fileName: fileNameToUpload,
504
+ fileMeta,
492
505
  progressCallback
493
506
  });
494
507
  startImportVariables.input = {
File without changes
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  /**
4
- * Internal dependencies
4
+ * External dependencies
5
5
  */
6
6
  "use strict";
7
7
 
@@ -13,6 +13,8 @@ exports.followLogs = followLogs;
13
13
  exports.validateInputs = validateInputs;
14
14
  exports.appQuery = void 0;
15
15
 
16
+ var _chalk = _interopRequireDefault(require("chalk"));
17
+
16
18
  var _command = _interopRequireDefault(require("../lib/cli/command"));
17
19
 
18
20
  var _rollbar = require("../lib/rollbar");
@@ -31,6 +33,9 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
31
33
 
32
34
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
33
35
 
36
+ /**
37
+ * Internal dependencies
38
+ */
34
39
  const LIMIT_MIN = 1;
35
40
  const LIMIT_MAX = 5000;
36
41
  const ALLOWED_TYPES = ['app', 'batch'];
@@ -102,14 +107,14 @@ async function followLogs(opt) {
102
107
  }); // If the first request fails we don't want to retry (it's probably not recoverable)
103
108
 
104
109
  if (isFirstRequest) {
105
- console.error('Error fetching initial logs');
110
+ console.error(`${_chalk.default.red('Error:')} Failed to fetch logs.`);
106
111
  break;
107
112
  } // Increase the delay on errors to avoid overloading the server, up to a max of 5 minutes
108
113
 
109
114
 
110
115
  delay += DEFAULT_POLLING_DELAY_IN_SECONDS;
111
116
  delay = Math.min(delay, MAX_POLLING_DELAY_IN_SECONDS);
112
- console.error(`Failed to fetch logs. Trying again in ${delay} seconds`);
117
+ console.error(`${_chalk.default.red('Error:')} Failed to fetch logs. Trying again in ${delay} seconds.`);
113
118
 
114
119
  _rollbar.rollbar.error(error);
115
120
  }
@@ -105,15 +105,11 @@ async function getFileMeta(fileName) {
105
105
  const mimeType = await detectCompressedMimeType(fileName); // TODO Only allow a subset of Mime Types...?
106
106
 
107
107
  const isCompressed = ['application/zip', 'application/gzip'].includes(mimeType);
108
- debug('Calculating file md5 checksum...');
109
- const md5 = await getFileMD5Hash(fileName);
110
- debug(`Calculated file md5 checksum: ${md5}\n`);
111
108
  resolve({
112
109
  basename,
113
110
  fileName,
114
111
  fileSize,
115
- isCompressed,
116
- md5
112
+ isCompressed
117
113
  });
118
114
  });
119
115
  }
@@ -122,9 +118,9 @@ async function uploadImportSqlFileToS3({
122
118
  app,
123
119
  env,
124
120
  fileName,
121
+ fileMeta,
125
122
  progressCallback
126
123
  }) {
127
- const fileMeta = await getFileMeta(fileName);
128
124
  let tmpDir;
129
125
 
130
126
  try {
@@ -152,6 +148,9 @@ async function uploadImportSqlFileToS3({
152
148
  debug(`** Compression resulted in a ${calculation} smaller file 📦 **\n`);
153
149
  }
154
150
 
151
+ debug('Calculating file md5 checksum...');
152
+ const md5 = await getFileMD5Hash(fileName);
153
+ debug(`Calculated file md5 checksum: ${md5}\n`);
155
154
  const result = fileMeta.fileSize < MULTIPART_THRESHOLD ? await uploadUsingPutObject({
156
155
  app,
157
156
  env,
@@ -165,6 +164,7 @@ async function uploadImportSqlFileToS3({
165
164
  });
166
165
  return {
167
166
  fileMeta,
167
+ md5,
168
168
  result
169
169
  };
170
170
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/vip",
3
- "version": "2.7.1",
3
+ "version": "2.8.0",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/vip",
3
- "version": "2.8.0-alpha",
3
+ "version": "2.8.0",
4
4
  "description": "The VIP Javascript library & CLI",
5
5
  "main": "index.js",
6
6
  "bin": {
Binary file