@automattic/vip 2.35.1 → 2.36.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/CHANGELOG.md +29 -0
- package/dist/bin/vip-app-list.js +1 -8
- package/dist/bin/vip-app.js +3 -10
- package/dist/bin/vip-backup-db.js +1 -9
- package/dist/bin/vip-backup.js +0 -8
- package/dist/bin/vip-cache-purge-url.js +6 -16
- package/dist/bin/vip-cache.js +0 -8
- package/dist/bin/vip-config-envvar-delete.js +2 -11
- package/dist/bin/vip-config-envvar-get-all.js +1 -10
- package/dist/bin/vip-config-envvar-get.js +1 -10
- package/dist/bin/vip-config-envvar-list.js +1 -10
- package/dist/bin/vip-config-envvar-set.js +3 -12
- package/dist/bin/vip-config-envvar.js +0 -8
- package/dist/bin/vip-config-software-get.js +3 -12
- package/dist/bin/vip-config-software-update.js +6 -13
- package/dist/bin/vip-config-software.js +0 -8
- package/dist/bin/vip-config.js +0 -8
- package/dist/bin/vip-dev-env-create.js +6 -13
- package/dist/bin/vip-dev-env-destroy.js +3 -10
- package/dist/bin/vip-dev-env-exec.js +2 -6
- package/dist/bin/vip-dev-env-import-media.js +2 -10
- package/dist/bin/vip-dev-env-import-sql.js +3 -11
- package/dist/bin/vip-dev-env-import.js +0 -8
- package/dist/bin/vip-dev-env-info.js +4 -11
- package/dist/bin/vip-dev-env-list.js +3 -11
- package/dist/bin/vip-dev-env-logs.js +3 -10
- package/dist/bin/vip-dev-env-shell.js +3 -10
- package/dist/bin/vip-dev-env-start.js +6 -13
- package/dist/bin/vip-dev-env-stop.js +4 -11
- package/dist/bin/vip-dev-env-sync-sql.js +4 -12
- package/dist/bin/vip-dev-env-sync.js +0 -8
- package/dist/bin/vip-dev-env-update.js +5 -12
- package/dist/bin/vip-dev-env.js +0 -8
- package/dist/bin/vip-export-sql.js +1 -9
- package/dist/bin/vip-export.js +0 -8
- package/dist/bin/vip-import-media-abort.js +7 -13
- package/dist/bin/vip-import-media-status.js +4 -11
- package/dist/bin/vip-import-media.js +5 -11
- package/dist/bin/vip-import-sql-status.js +5 -12
- package/dist/bin/vip-import-sql.js +46 -48
- package/dist/bin/vip-import-validate-files.js +3 -10
- package/dist/bin/vip-import-validate-sql.js +2 -10
- package/dist/bin/vip-import.js +0 -8
- package/dist/bin/vip-logout.js +0 -8
- package/dist/bin/vip-logs.js +10 -22
- package/dist/bin/vip-search-replace.js +2 -9
- package/dist/bin/vip-slowlogs.js +6 -16
- package/dist/bin/vip-sync.js +0 -7
- package/dist/bin/vip-validate-preflight.js +13 -24
- package/dist/bin/vip-validate.js +0 -8
- package/dist/bin/vip-whoami.js +4 -14
- package/dist/bin/vip-wp.js +8 -17
- package/dist/bin/vip.js +10 -18
- package/dist/commands/backup-db.js +15 -31
- package/dist/commands/dev-env-import-sql.js +23 -12
- package/dist/commands/dev-env-sync-sql.js +34 -35
- package/dist/commands/export-sql.js +27 -39
- package/dist/lib/analytics/clients/pendo.js +1 -11
- package/dist/lib/analytics/clients/tracks.js +2 -12
- package/dist/lib/analytics/index.js +1 -11
- package/dist/lib/api/app.js +3 -14
- package/dist/lib/api/cache-purge.js +3 -17
- package/dist/lib/api/feature-flags.js +1 -11
- package/dist/lib/api/http.js +4 -14
- package/dist/lib/api/user.js +1 -13
- package/dist/lib/api.js +8 -23
- package/dist/lib/app-logs/app-logs.js +4 -18
- package/dist/lib/app-slowlogs/app-slowlogs.js +4 -18
- package/dist/lib/app.js +1 -11
- package/dist/lib/backup-storage-availability/backup-storage-availability.js +8 -11
- package/dist/lib/backup-storage-availability/docker-machine-not-found-error.js +1 -3
- package/dist/lib/cli/apiConfig.js +6 -20
- package/dist/lib/cli/command.js +26 -33
- package/dist/lib/cli/config.js +4 -11
- package/dist/lib/cli/envAlias.js +1 -7
- package/dist/lib/cli/exit.js +1 -13
- package/dist/lib/cli/format.js +4 -13
- package/dist/lib/cli/progress.js +2 -13
- package/dist/lib/cli/prompt.js +1 -11
- package/dist/lib/client-file-uploader.js +22 -24
- package/dist/lib/config/software.js +11 -25
- package/dist/lib/constants/dev-environment.js +35 -33
- package/dist/lib/constants/file-size.js +5 -11
- package/dist/lib/constants/vipgo.js +10 -21
- package/dist/lib/dev-environment/dev-environment-cli.js +46 -49
- package/dist/lib/dev-environment/dev-environment-configuration-file.js +14 -26
- package/dist/lib/dev-environment/dev-environment-core.js +30 -43
- package/dist/lib/dev-environment/dev-environment-lando.js +19 -30
- package/dist/lib/dev-environment/docker-utils.js +1 -6
- package/dist/lib/env.js +2 -13
- package/dist/lib/envvar/api-delete.js +1 -11
- package/dist/lib/envvar/api-get-all.js +2 -13
- package/dist/lib/envvar/api-get.js +2 -12
- package/dist/lib/envvar/api-list.js +3 -14
- package/dist/lib/envvar/api-set.js +1 -11
- package/dist/lib/envvar/api.js +8 -46
- package/dist/lib/envvar/input.js +2 -14
- package/dist/lib/envvar/logging.js +3 -13
- package/dist/lib/envvar/read-file.js +1 -13
- package/dist/lib/http/proxy-agent.js +3 -12
- package/dist/lib/keychain/insecure.js +1 -11
- package/dist/lib/keychain/secure.js +1 -11
- package/dist/lib/keychain.js +3 -14
- package/dist/lib/logout.js +2 -7
- package/dist/lib/media-import/media-file-import.js +4 -12
- package/dist/lib/media-import/progress.js +2 -12
- package/dist/lib/media-import/status.js +15 -30
- package/dist/lib/read-file.js +3 -15
- package/dist/lib/search-and-replace.js +9 -21
- package/dist/lib/site-import/db-file-import.js +6 -18
- package/dist/lib/site-import/status.js +19 -36
- package/dist/lib/token.js +5 -16
- package/dist/lib/tracker.js +5 -15
- package/dist/lib/user-error.js +1 -3
- package/dist/lib/utils.js +4 -15
- package/dist/lib/validations/is-multi-site-sql-dump.js +1 -3
- package/dist/lib/validations/is-multi-site.js +6 -17
- package/dist/lib/validations/is-multisite-domain-mapped.js +9 -21
- package/dist/lib/validations/line-by-line.js +5 -15
- package/dist/lib/validations/site-type.js +4 -15
- package/dist/lib/validations/sql.js +33 -15
- package/dist/lib/validations/utils.js +1 -3
- package/dist/lib/vip-import-validate-files.js +2 -9
- package/helpers/check-version.js +1 -0
- package/helpers/prepublishOnly.js +2 -1
- package/npm-shrinkwrap.json +2580 -2973
- package/package.json +30 -32
|
@@ -1,25 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
3
|
+
exports.__esModule = true;
|
|
6
4
|
exports.LIMIT_MAX = void 0;
|
|
7
5
|
exports.getRecentLogs = getRecentLogs;
|
|
8
6
|
var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
|
|
9
7
|
var _api = _interopRequireDefault(require("../../lib/api"));
|
|
10
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* External dependencies
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Internal dependencies
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
const LIMIT_MAX = 5000;
|
|
22
|
-
exports.LIMIT_MAX = LIMIT_MAX;
|
|
9
|
+
const LIMIT_MAX = exports.LIMIT_MAX = 5000;
|
|
23
10
|
const QUERY_ENVIRONMENT_LOGS = (0, _graphqlTag.default)`
|
|
24
11
|
query GetAppLogs(
|
|
25
12
|
$appId: Int
|
|
@@ -44,7 +31,6 @@ const QUERY_ENVIRONMENT_LOGS = (0, _graphqlTag.default)`
|
|
|
44
31
|
}
|
|
45
32
|
`;
|
|
46
33
|
async function getRecentLogs(appId, envId, type, limit, after) {
|
|
47
|
-
var _response$data$app;
|
|
48
34
|
const api = await (0, _api.default)({
|
|
49
35
|
exitOnError: false
|
|
50
36
|
});
|
|
@@ -58,8 +44,8 @@ async function getRecentLogs(appId, envId, type, limit, after) {
|
|
|
58
44
|
after
|
|
59
45
|
}
|
|
60
46
|
});
|
|
61
|
-
const logs =
|
|
62
|
-
if (!
|
|
47
|
+
const logs = response.data.app?.environments?.[0]?.logs;
|
|
48
|
+
if (!logs?.nodes) {
|
|
63
49
|
throw new Error('Unable to query logs');
|
|
64
50
|
}
|
|
65
51
|
return logs;
|
|
@@ -1,25 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
3
|
+
exports.__esModule = true;
|
|
6
4
|
exports.LIMIT_MAX = void 0;
|
|
7
5
|
exports.getRecentSlowlogs = getRecentSlowlogs;
|
|
8
6
|
var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
|
|
9
7
|
var _api = _interopRequireDefault(require("../../lib/api"));
|
|
10
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* External dependencies
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Internal dependencies
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
const LIMIT_MAX = 5000;
|
|
22
|
-
exports.LIMIT_MAX = LIMIT_MAX;
|
|
9
|
+
const LIMIT_MAX = exports.LIMIT_MAX = 5000;
|
|
23
10
|
const QUERY_ENVIRONMENT_SLOWLOGS = (0, _graphqlTag.default)`
|
|
24
11
|
query GetAppLogs($appId: Int, $envId: Int, $limit: Int, $after: String) {
|
|
25
12
|
app(id: $appId) {
|
|
@@ -42,7 +29,6 @@ const QUERY_ENVIRONMENT_SLOWLOGS = (0, _graphqlTag.default)`
|
|
|
42
29
|
}
|
|
43
30
|
`;
|
|
44
31
|
async function getRecentSlowlogs(appId, envId, limit, after) {
|
|
45
|
-
var _response$data$app;
|
|
46
32
|
const api = await (0, _api.default)({
|
|
47
33
|
exitOnError: false
|
|
48
34
|
});
|
|
@@ -55,8 +41,8 @@ async function getRecentSlowlogs(appId, envId, limit, after) {
|
|
|
55
41
|
after
|
|
56
42
|
}
|
|
57
43
|
});
|
|
58
|
-
const slowlogs =
|
|
59
|
-
if (!
|
|
44
|
+
const slowlogs = response.data.app?.environments?.[0]?.slowlogs;
|
|
45
|
+
if (!slowlogs?.nodes) {
|
|
60
46
|
throw new Error('Unable to query slowlogs');
|
|
61
47
|
}
|
|
62
48
|
return slowlogs;
|
package/dist/lib/app.js
CHANGED
|
@@ -1,19 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
3
|
+
exports.__esModule = true;
|
|
6
4
|
exports.isAppNodejs = isAppNodejs;
|
|
7
5
|
exports.isAppWordPress = isAppWordPress;
|
|
8
6
|
var _vipgo = require("./constants/vipgo");
|
|
9
|
-
/**
|
|
10
|
-
* External dependencies
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Internal dependencies
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
7
|
/**
|
|
18
8
|
* Is this a WordPress application?
|
|
19
9
|
*
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
3
|
+
exports.__esModule = true;
|
|
6
4
|
exports.BackupStorageAvailability = void 0;
|
|
7
|
-
var _shelljs = require("shelljs");
|
|
8
|
-
var _path = _interopRequireDefault(require("path"));
|
|
9
|
-
var _xdgBasedir = _interopRequireDefault(require("xdg-basedir"));
|
|
10
|
-
var _os = _interopRequireDefault(require("os"));
|
|
11
5
|
var _checkDiskSpace = _interopRequireDefault(require("check-disk-space"));
|
|
12
6
|
var _enquirer = require("enquirer");
|
|
13
|
-
var
|
|
7
|
+
var _os = _interopRequireDefault(require("os"));
|
|
8
|
+
var _path = _interopRequireDefault(require("path"));
|
|
9
|
+
var _shelljs = require("shelljs");
|
|
10
|
+
var _xdgBasedir = _interopRequireDefault(require("xdg-basedir"));
|
|
14
11
|
var _dockerMachineNotFoundError = require("./docker-machine-not-found-error");
|
|
12
|
+
var _format = require("../cli/format");
|
|
15
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
14
|
const oneGiBInBytes = 1024 * 1024 * 1024;
|
|
17
15
|
class BackupStorageAvailability {
|
|
@@ -20,9 +18,8 @@ class BackupStorageAvailability {
|
|
|
20
18
|
this.archiveSize = archiveSize;
|
|
21
19
|
}
|
|
22
20
|
static createFromDbCopyJob(job) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (!(bytesWrittenMeta !== null && bytesWrittenMeta !== void 0 && bytesWrittenMeta.value)) {
|
|
21
|
+
const bytesWrittenMeta = job.metadata?.find(meta => meta?.name === 'bytesWritten');
|
|
22
|
+
if (!bytesWrittenMeta?.value) {
|
|
26
23
|
throw new Error('Meta not found');
|
|
27
24
|
}
|
|
28
25
|
return new BackupStorageAvailability(Number(bytesWrittenMeta.value));
|
|
@@ -1,28 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
3
|
+
exports.__esModule = true;
|
|
6
4
|
exports.checkFeatureEnabled = checkFeatureEnabled;
|
|
7
5
|
exports.checkIfUserIsVip = checkIfUserIsVip;
|
|
8
6
|
exports.exitWhenFeatureDisabled = exitWhenFeatureDisabled;
|
|
9
|
-
var _tracker = require("../../lib/tracker");
|
|
10
7
|
var exit = _interopRequireWildcard(require("./exit"));
|
|
11
8
|
var featureFlags = _interopRequireWildcard(require("../../lib/api/feature-flags"));
|
|
12
9
|
var _token = _interopRequireDefault(require("../../lib/token"));
|
|
10
|
+
var _tracker = require("../../lib/tracker");
|
|
13
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
function _getRequireWildcardCache(
|
|
15
|
-
function _interopRequireWildcard(
|
|
16
|
-
// @format
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* External dependencies
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Internal dependencies
|
|
24
|
-
*/
|
|
25
|
-
|
|
12
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
13
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
26
14
|
async function checkFeatureEnabled(featureName, exitOnFalse = false) {
|
|
27
15
|
// TODO: eventually let's look at more feature flags coming from the public api,
|
|
28
16
|
// for now, let's see if the user of the CLI is VIP
|
|
@@ -32,9 +20,8 @@ async function checkFeatureEnabled(featureName, exitOnFalse = false) {
|
|
|
32
20
|
});
|
|
33
21
|
let isVIP;
|
|
34
22
|
try {
|
|
35
|
-
var _res$data$me;
|
|
36
23
|
const res = await featureFlags.get();
|
|
37
|
-
if (
|
|
24
|
+
if (res?.data.me?.isVIP !== undefined) {
|
|
38
25
|
isVIP = res.data.me.isVIP;
|
|
39
26
|
} else {
|
|
40
27
|
isVIP = false;
|
|
@@ -60,9 +47,8 @@ async function checkFeatureEnabled(featureName, exitOnFalse = false) {
|
|
|
60
47
|
async function checkIfUserIsVip() {
|
|
61
48
|
const token = await _token.default.get();
|
|
62
49
|
if (token.valid()) {
|
|
63
|
-
var _res$data$me2;
|
|
64
50
|
const res = await featureFlags.get();
|
|
65
|
-
return
|
|
51
|
+
return Boolean(res?.data.me?.isVIP);
|
|
66
52
|
}
|
|
67
53
|
return false;
|
|
68
54
|
}
|
package/dist/lib/cli/command.js
CHANGED
|
@@ -1,37 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
3
|
+
exports.__esModule = true;
|
|
6
4
|
exports.containsAppEnvArgument = containsAppEnvArgument;
|
|
7
5
|
exports.default = _default;
|
|
8
6
|
exports.getEnvIdentifier = getEnvIdentifier;
|
|
9
7
|
var _args = _interopRequireDefault(require("args"));
|
|
10
|
-
var _enquirer = require("enquirer");
|
|
11
8
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
9
|
+
var _debug = _interopRequireDefault(require("debug"));
|
|
10
|
+
var _enquirer = require("enquirer");
|
|
12
11
|
var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
|
|
13
|
-
var
|
|
12
|
+
var _envAlias = require("./envAlias");
|
|
13
|
+
var exit = _interopRequireWildcard(require("./exit"));
|
|
14
|
+
var _format = require("./format");
|
|
14
15
|
var _prompt = require("./prompt");
|
|
16
|
+
var _package = _interopRequireDefault(require("../../../package.json"));
|
|
15
17
|
var _api = _interopRequireDefault(require("../../lib/api"));
|
|
16
18
|
var _app = _interopRequireDefault(require("../../lib/api/app"));
|
|
17
|
-
var _format = require("./format");
|
|
18
|
-
var _package = _interopRequireDefault(require("../../../package.json"));
|
|
19
19
|
var _tracker = require("../../lib/tracker");
|
|
20
|
-
var _envAlias = require("./envAlias");
|
|
21
|
-
var exit = _interopRequireWildcard(require("./exit"));
|
|
22
|
-
var _debug = _interopRequireDefault(require("debug"));
|
|
23
20
|
var _userError = _interopRequireDefault(require("../user-error"));
|
|
24
|
-
function _getRequireWildcardCache(
|
|
25
|
-
function _interopRequireWildcard(
|
|
21
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
22
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
26
23
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
|
-
/**
|
|
28
|
-
* External dependencies
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Internal dependencies
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
24
|
function uncaughtError(err) {
|
|
36
25
|
// Error raised when trying to write to an already closed stream
|
|
37
26
|
if (err.code === 'EPIPE') {
|
|
@@ -113,13 +102,17 @@ _args.default.argv = async function (argv, cb) {
|
|
|
113
102
|
if (this.isDefined(this.sub[0], 'commands')) {
|
|
114
103
|
return {};
|
|
115
104
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
105
|
+
if (process.env.NODE_ENV !== 'test') {
|
|
106
|
+
const {
|
|
107
|
+
default: updateNotifier
|
|
108
|
+
} = await import('update-notifier');
|
|
109
|
+
updateNotifier({
|
|
110
|
+
pkg: _package.default,
|
|
111
|
+
updateCheckInterval: 1000 * 60 * 60 * 24
|
|
112
|
+
}).notify({
|
|
113
|
+
isGlobal: true
|
|
114
|
+
});
|
|
115
|
+
}
|
|
123
116
|
|
|
124
117
|
// `help` and `version` are always defined as subcommands
|
|
125
118
|
const customCommands = this.details.commands.filter(command => {
|
|
@@ -134,7 +127,7 @@ _args.default.argv = async function (argv, cb) {
|
|
|
134
127
|
});
|
|
135
128
|
|
|
136
129
|
// Show help if no args passed
|
|
137
|
-
if (
|
|
130
|
+
if (Boolean(customCommands.length) && !this.sub.length) {
|
|
138
131
|
await (0, _tracker.trackEvent)('command_help_view');
|
|
139
132
|
this.showHelp();
|
|
140
133
|
return {};
|
|
@@ -348,7 +341,7 @@ _args.default.argv = async function (argv, cb) {
|
|
|
348
341
|
value: `${_chalk.default.blueBright(this.sub)}`
|
|
349
342
|
});
|
|
350
343
|
}
|
|
351
|
-
options.skipValidate = Object.prototype.hasOwnProperty.call(options, 'skipValidate') &&
|
|
344
|
+
options.skipValidate = Object.prototype.hasOwnProperty.call(options, 'skipValidate') && Boolean(options.skipValidate) && !['false', 'no'].includes(options.skipValidate);
|
|
352
345
|
if (options.skipValidate) {
|
|
353
346
|
info.push({
|
|
354
347
|
key: 'Pre-Upload Validations',
|
|
@@ -418,17 +411,17 @@ _args.default.argv = async function (argv, cb) {
|
|
|
418
411
|
key: 'Archive URL',
|
|
419
412
|
value: _chalk.default.blue.underline(this.sub)
|
|
420
413
|
});
|
|
421
|
-
options.overwriteExistingFiles = Object.prototype.hasOwnProperty.call(options, 'overwriteExistingFiles') &&
|
|
414
|
+
options.overwriteExistingFiles = Object.prototype.hasOwnProperty.call(options, 'overwriteExistingFiles') && Boolean(options.overwriteExistingFiles) && !['false', 'no'].includes(options.overwriteExistingFiles);
|
|
422
415
|
info.push({
|
|
423
416
|
key: 'Overwrite any existing files',
|
|
424
417
|
value: options.overwriteExistingFiles ? '✅ Yes' : `${_chalk.default.red('x')} No`
|
|
425
418
|
});
|
|
426
|
-
options.importIntermediateImages = Object.prototype.hasOwnProperty.call(options, 'importIntermediateImages') &&
|
|
419
|
+
options.importIntermediateImages = Object.prototype.hasOwnProperty.call(options, 'importIntermediateImages') && Boolean(options.importIntermediateImages) && !['false', 'no'].includes(options.importIntermediateImages);
|
|
427
420
|
info.push({
|
|
428
421
|
key: 'Import intermediate image files',
|
|
429
422
|
value: options.importIntermediateImages ? '✅ Yes' : `${_chalk.default.red('x')} No`
|
|
430
423
|
});
|
|
431
|
-
options.exportFileErrorsToJson = Object.prototype.hasOwnProperty.call(options, 'exportFileErrorsToJson') &&
|
|
424
|
+
options.exportFileErrorsToJson = Object.prototype.hasOwnProperty.call(options, 'exportFileErrorsToJson') && Boolean(options.exportFileErrorsToJson) && !['false', 'no'].includes(options.exportFileErrorsToJson);
|
|
432
425
|
info.push({
|
|
433
426
|
key: 'Export any file errors encountered to a JSON file instead of a plain text file',
|
|
434
427
|
value: options.exportFileErrorsToJson ? '✅ Yes' : `${_chalk.default.red('x')} No`
|
|
@@ -537,5 +530,5 @@ function getEnvIdentifier(env) {
|
|
|
537
530
|
}
|
|
538
531
|
function containsAppEnvArgument(argv) {
|
|
539
532
|
const parsedAlias = (0, _envAlias.parseEnvAliasFromArgv)(argv);
|
|
540
|
-
return
|
|
533
|
+
return Boolean(parsedAlias.app || parsedAlias.env || argv.includes('--app') || argv.includes('--env'));
|
|
541
534
|
}
|
package/dist/lib/cli/config.js
CHANGED
|
@@ -1,27 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
3
|
+
exports.__esModule = true;
|
|
6
4
|
exports.default = void 0;
|
|
7
5
|
var _debug = _interopRequireDefault(require("debug"));
|
|
8
6
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
-
/**
|
|
10
|
-
* External dependencies
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
7
|
const debug = (0, _debug.default)('@automattic/vip:lib:cli:config');
|
|
14
8
|
let configFromFile;
|
|
15
9
|
try {
|
|
16
10
|
// Get `local` config first; this will only exist in dev as it's npmignore-d.
|
|
17
11
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
18
|
-
configFromFile = require(
|
|
12
|
+
configFromFile = require('../../../config/config.local.json');
|
|
19
13
|
debug('Loaded config data from config.local.json');
|
|
20
14
|
} catch {
|
|
21
15
|
// Fall back to `publish` config file.
|
|
22
16
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
23
|
-
configFromFile = require(
|
|
17
|
+
configFromFile = require('../../../config/config.publish.json');
|
|
24
18
|
debug('Loaded config data from config.publish.json');
|
|
25
19
|
}
|
|
26
|
-
var _default = configFromFile;
|
|
27
|
-
exports.default = _default;
|
|
20
|
+
var _default = exports.default = configFromFile;
|
package/dist/lib/cli/envAlias.js
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
3
|
+
exports.__esModule = true;
|
|
6
4
|
exports.isAlias = isAlias;
|
|
7
5
|
exports.parseEnvAlias = parseEnvAlias;
|
|
8
6
|
exports.parseEnvAliasFromArgv = parseEnvAliasFromArgv;
|
|
9
|
-
/**
|
|
10
|
-
* External dependencies
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
7
|
function isAlias(alias) {
|
|
14
8
|
return /^@[A-Za-z0-9.-]+$/.test(alias);
|
|
15
9
|
}
|
package/dist/lib/cli/exit.js
CHANGED
|
@@ -1,22 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
3
|
+
exports.__esModule = true;
|
|
6
4
|
exports.withError = withError;
|
|
7
5
|
var _chalk = require("chalk");
|
|
8
6
|
var _env = _interopRequireDefault(require("../../lib/env"));
|
|
9
7
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
// @format
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* External dependencies
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Internal dependencies
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
8
|
function withError(message) {
|
|
21
9
|
console.error(`${(0, _chalk.red)('Error: ')} ${message.toString().replace(/^Error:\s*/, '')}`);
|
|
22
10
|
|
package/dist/lib/cli/format.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
3
|
+
exports.__esModule = true;
|
|
6
4
|
exports.RunningSprite = exports.RUNNING_SPRITE_GLYPHS = void 0;
|
|
7
5
|
exports.capitalize = capitalize;
|
|
8
6
|
exports.formatBytes = void 0;
|
|
@@ -17,16 +15,10 @@ exports.isJsonObject = isJsonObject;
|
|
|
17
15
|
exports.keyValue = keyValue;
|
|
18
16
|
exports.requoteArgs = requoteArgs;
|
|
19
17
|
exports.table = table;
|
|
18
|
+
var _plainjs = require("@json2csv/plainjs");
|
|
20
19
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
21
|
-
var _json2csv = require("json2csv");
|
|
22
20
|
var _cliTable = _interopRequireDefault(require("cli-table"));
|
|
23
21
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
|
-
// @format
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* External dependencies
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
22
|
function formatData(data, format) {
|
|
31
23
|
if (!data.length) {
|
|
32
24
|
return '';
|
|
@@ -61,7 +53,7 @@ function ids(data) {
|
|
|
61
53
|
}
|
|
62
54
|
function csv(data) {
|
|
63
55
|
const fields = Object.keys(data[0]);
|
|
64
|
-
const parser = new
|
|
56
|
+
const parser = new _plainjs.Parser({
|
|
65
57
|
fields: formatFields(fields)
|
|
66
58
|
});
|
|
67
59
|
return parser.parse(data);
|
|
@@ -138,8 +130,7 @@ function capitalize(str) {
|
|
|
138
130
|
}
|
|
139
131
|
return str[0].toUpperCase() + str.slice(1);
|
|
140
132
|
}
|
|
141
|
-
const RUNNING_SPRITE_GLYPHS = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
142
|
-
exports.RUNNING_SPRITE_GLYPHS = RUNNING_SPRITE_GLYPHS;
|
|
133
|
+
const RUNNING_SPRITE_GLYPHS = exports.RUNNING_SPRITE_GLYPHS = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
143
134
|
class RunningSprite {
|
|
144
135
|
count;
|
|
145
136
|
constructor() {
|
package/dist/lib/cli/progress.js
CHANGED
|
@@ -1,22 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
3
|
+
exports.__esModule = true;
|
|
6
4
|
exports.StepStatus = exports.ProgressTracker = void 0;
|
|
7
5
|
var _nodeOs = require("node:os");
|
|
8
6
|
var _singleLineLog = require("single-line-log");
|
|
9
7
|
var _format = require("../../lib/cli/format");
|
|
10
|
-
/**
|
|
11
|
-
* External dependencies
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Internal dependencies
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
8
|
const PRINT_INTERVAL = process.env.DEBUG ? 5000 : 200; // How often the report is printed. Mainly affects the "spinner" animation.
|
|
19
|
-
let StepStatus = /*#__PURE__*/function (StepStatus) {
|
|
9
|
+
let StepStatus = exports.StepStatus = /*#__PURE__*/function (StepStatus) {
|
|
20
10
|
StepStatus["PENDING"] = "pending";
|
|
21
11
|
StepStatus["RUNNING"] = "running";
|
|
22
12
|
StepStatus["SUCCESS"] = "success";
|
|
@@ -25,7 +15,6 @@ let StepStatus = /*#__PURE__*/function (StepStatus) {
|
|
|
25
15
|
StepStatus["SKIPPED"] = "skipped";
|
|
26
16
|
return StepStatus;
|
|
27
17
|
}({});
|
|
28
|
-
exports.StepStatus = StepStatus;
|
|
29
18
|
const COMPLETED_STEP_SLUGS = [StepStatus.SUCCESS, StepStatus.SKIPPED];
|
|
30
19
|
class ProgressTracker {
|
|
31
20
|
hasFailure;
|
package/dist/lib/cli/prompt.js
CHANGED
|
@@ -1,19 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
3
|
+
exports.__esModule = true;
|
|
6
4
|
exports.confirm = confirm;
|
|
7
5
|
var _enquirer = require("enquirer");
|
|
8
6
|
var _format = require("./format");
|
|
9
|
-
/**
|
|
10
|
-
* External dependencies
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Internal dependencies
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
7
|
async function confirm(values, message, skipPrompt = false) {
|
|
18
8
|
console.log((0, _format.keyValue)(values));
|
|
19
9
|
if (!skipPrompt) {
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
3
|
+
exports.__esModule = true;
|
|
6
4
|
exports.MULTIPART_THRESHOLD = exports.COMPRESS_THRESHOLD = void 0;
|
|
7
5
|
exports.checkFileAccess = checkFileAccess;
|
|
8
6
|
exports.detectCompressedMimeType = detectCompressedMimeType;
|
|
@@ -14,31 +12,21 @@ exports.isFile = isFile;
|
|
|
14
12
|
exports.unzipFile = void 0;
|
|
15
13
|
exports.uploadImportSqlFileToS3 = uploadImportSqlFileToS3;
|
|
16
14
|
exports.uploadParts = uploadParts;
|
|
15
|
+
var _chalk = _interopRequireDefault(require("chalk"));
|
|
16
|
+
var _crypto = require("crypto");
|
|
17
|
+
var _debug = _interopRequireDefault(require("debug"));
|
|
17
18
|
var _fs = require("fs");
|
|
19
|
+
var _nodeFetch = _interopRequireDefault(require("node-fetch"));
|
|
18
20
|
var _promises = require("node:fs/promises");
|
|
21
|
+
var _promises2 = require("node:stream/promises");
|
|
19
22
|
var _os = _interopRequireDefault(require("os"));
|
|
20
23
|
var _path = _interopRequireDefault(require("path"));
|
|
21
|
-
var _nodeFetch = _interopRequireDefault(require("node-fetch"));
|
|
22
|
-
var _chalk = _interopRequireDefault(require("chalk"));
|
|
23
|
-
var _zlib = require("zlib");
|
|
24
|
-
var _crypto = require("crypto");
|
|
25
|
-
var _promises2 = require("node:stream/promises");
|
|
26
24
|
var _stream = require("stream");
|
|
27
25
|
var _xml2js = require("xml2js");
|
|
28
|
-
var
|
|
26
|
+
var _zlib = require("zlib");
|
|
29
27
|
var _http = _interopRequireDefault(require("../lib/api/http"));
|
|
30
28
|
var _fileSize = require("../lib/constants/file-size");
|
|
31
29
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
32
|
-
// @format
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* External dependencies
|
|
36
|
-
*/
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Internal dependencies
|
|
40
|
-
*/
|
|
41
|
-
|
|
42
30
|
// Need to use CommonJS imports here as the `fetch-retry` typedefs are messed up and throwing TypeJS errors when using `import`
|
|
43
31
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
44
32
|
const fetchWithRetry =
|
|
@@ -54,14 +42,12 @@ require('fetch-retry')(_nodeFetch.default, {
|
|
|
54
42
|
const debug = (0, _debug.default)('vip:lib/client-file-uploader');
|
|
55
43
|
|
|
56
44
|
// Files smaller than COMPRESS_THRESHOLD will not be compressed before upload
|
|
57
|
-
const COMPRESS_THRESHOLD = 16 * _fileSize.MB_IN_BYTES;
|
|
45
|
+
const COMPRESS_THRESHOLD = exports.COMPRESS_THRESHOLD = 16 * _fileSize.MB_IN_BYTES;
|
|
58
46
|
|
|
59
47
|
// Files smaller than MULTIPART_THRESHOLD will use `PutObject` vs Multipart Uploads
|
|
60
|
-
exports.
|
|
61
|
-
const MULTIPART_THRESHOLD = 32 * _fileSize.MB_IN_BYTES;
|
|
48
|
+
const MULTIPART_THRESHOLD = exports.MULTIPART_THRESHOLD = 32 * _fileSize.MB_IN_BYTES;
|
|
62
49
|
|
|
63
50
|
// This is how big each part of a Multipart Upload is (except the last / remainder)
|
|
64
|
-
exports.MULTIPART_THRESHOLD = MULTIPART_THRESHOLD;
|
|
65
51
|
const UPLOAD_PART_SIZE = 16 * _fileSize.MB_IN_BYTES;
|
|
66
52
|
|
|
67
53
|
// How many parts will upload at the same time
|
|
@@ -99,9 +85,21 @@ const gzipFile = async (uncompressedFileName, compressedFileName) => {
|
|
|
99
85
|
* @return {Promise} A promise that resolves when the file is unzipped
|
|
100
86
|
*/
|
|
101
87
|
const unzipFile = async (inputFilename, outputFilename) => {
|
|
88
|
+
const mimeType = await detectCompressedMimeType(inputFilename);
|
|
89
|
+
const extractFunctions = {
|
|
90
|
+
'application/gzip': {
|
|
91
|
+
extractor: _zlib.createGunzip
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
const extractionInfo = extractFunctions[mimeType];
|
|
95
|
+
|
|
96
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
97
|
+
if (!extractionInfo) {
|
|
98
|
+
throw new Error(`unsupported file format: ${mimeType}`);
|
|
99
|
+
}
|
|
102
100
|
const source = (0, _fs.createReadStream)(inputFilename);
|
|
103
101
|
const destination = (0, _fs.createWriteStream)(outputFilename);
|
|
104
|
-
await (0, _promises2.pipeline)(source,
|
|
102
|
+
await (0, _promises2.pipeline)(source, extractionInfo.extractor(), destination);
|
|
105
103
|
};
|
|
106
104
|
exports.unzipFile = unzipFile;
|
|
107
105
|
async function getFileMeta(fileName) {
|