@automattic/vip 2.9.5 → 2.10.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/CONTRIBUTING.md +2 -11
- package/README.md +10 -0
- package/dist/bin/vip-dev-env-create.js +8 -1
- package/dist/bin/vip-dev-env-destroy.js +6 -7
- package/dist/bin/vip-dev-env-exec.js +6 -1
- package/dist/bin/vip-dev-env-import-media.js +6 -1
- package/dist/bin/vip-dev-env-import-sql.js +6 -1
- package/dist/bin/vip-dev-env-info.js +9 -1
- package/dist/bin/vip-dev-env-list.js +9 -1
- package/dist/bin/vip-dev-env-start.js +11 -1
- package/dist/bin/vip-dev-env-update.js +7 -2
- package/dist/lib/dev-environment/dev-environment-cli.js +36 -1
- package/dist/lib/dev-environment/dev-environment-core.js +4 -2
- package/dist/lib/dev-environment/dev-environment-lando.js +18 -3
- package/dist/lib/tracker.js +3 -4
- package/npm-shrinkwrap.json +1 -1
- package/package.json +1 -1
package/CONTRIBUTING.md
CHANGED
|
@@ -44,21 +44,12 @@ Our release flow for VIP CLI follows this pattern:
|
|
|
44
44
|
- Include a Changelog for all npm version releases, including any minor or major versions
|
|
45
45
|
- This is a public repository. Please do not include any internal links in PRs, changelogs, testing instructions, etc.
|
|
46
46
|
- Merge changes from your feature branch to the `develop` branch
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
- Any team member that is part of our NPM organization can release new minor or major versions, but please have a Customer Experience (Pâtisserie) team member look over the changes first.
|
|
47
|
+
- If you are ready to release your changes publicly, merge your changes from the `develop` branch to the `master` branch. All changes that are not ready to be public should be feature flagged or stay in the `develop` branch to avoid conflicts when releasing urgent fixes (not recommended).
|
|
48
|
+
- Finally, release your changes as a new minor or major NPM version. Ping in the #vip-platform-patisserie channel to notify folks of a new release, but please feel free to release your changes without any blockers from the team. Any team member that is part of the Automattic NPM organization can release a new version; if you aren't a member, generic credentials are available in the Secret Store.
|
|
50
49
|
|
|
51
50
|
### Changelogs
|
|
52
51
|
Changelogs allow customers to keep up with all the changes happening across our VIP Platform. Changelogs for VIP CLI are posted to the [VIP Cloud Changelog P2](https://wpvipchangelog.wordpress.com/), along with the repository’s `README.md`.
|
|
53
52
|
|
|
54
|
-
### Release Schedule
|
|
55
|
-
|
|
56
|
-
The VIP Customer Experience squad conducts releases on Tuesdays from 4AM to 5PM Pacific Time (US). Releases are regular but do not happen every Tuesday. Please coordinate with the VIP Customer Experience squad if you'd like to lead your own release.
|
|
57
|
-
|
|
58
|
-
As part of the release process, our squad merges changes from the `develop` branch to the `master` branch. Therefore, do not merge changes into `develop` unless it is ready for release (or use a feature flag to disable it).
|
|
59
|
-
|
|
60
|
-
Fixes for urgent or breaking bugs may be merged straight to the `master` branch and released publicly via `npm` at any time outside of our release window. All other changes should participate in our release window.
|
|
61
|
-
|
|
62
53
|
## Releasing / Publishing
|
|
63
54
|
|
|
64
55
|
### Pre-publish Checks
|
package/README.md
CHANGED
|
@@ -26,6 +26,16 @@ By default, we record information about the usage of this tool using an in-house
|
|
|
26
26
|
|
|
27
27
|
## Changelog
|
|
28
28
|
|
|
29
|
+
### 2.10.0 (4 May 2022)
|
|
30
|
+
|
|
31
|
+
- #1021 [dev-env] Add login info and documentation link to `dev-env info`
|
|
32
|
+
- #1023 [dev-env] Skip the trunk from the prompt about the latest available WordPress versions
|
|
33
|
+
- #1019 [dev-env] Unifies lando and other dev-env debug logs
|
|
34
|
+
- #1018 [dev-env] enable lando debug on `--debug`
|
|
35
|
+
- #1017 [dev-env] Adding tracking for create and destroy sub commands
|
|
36
|
+
- #1016 [dev-env] Adding tracking for start sub command
|
|
37
|
+
- #1020 [dev-env] More tracking
|
|
38
|
+
|
|
29
39
|
### 2.9.5 (26 April 2022)
|
|
30
40
|
|
|
31
41
|
- #1005 [dev-env] updateWordPress image improvements
|
|
@@ -14,6 +14,8 @@ var _debug = _interopRequireDefault(require("debug"));
|
|
|
14
14
|
|
|
15
15
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
16
16
|
|
|
17
|
+
var _tracker = require("../lib/tracker");
|
|
18
|
+
|
|
17
19
|
var _command = _interopRequireDefault(require("../lib/cli/command"));
|
|
18
20
|
|
|
19
21
|
var exit = _interopRequireWildcard(require("../lib/cli/exit"));
|
|
@@ -60,6 +62,10 @@ cmd.examples(examples);
|
|
|
60
62
|
cmd.argv(process.argv, async (arg, opt) => {
|
|
61
63
|
const slug = (0, _devEnvironmentCli.getEnvironmentName)(opt);
|
|
62
64
|
debug('Args: ', arg, 'Options: ', opt);
|
|
65
|
+
const trackingInfo = {
|
|
66
|
+
slug
|
|
67
|
+
};
|
|
68
|
+
await (0, _tracker.trackEvent)('dev_env_create_command_execute', trackingInfo);
|
|
63
69
|
|
|
64
70
|
const startCommand = _chalk.default.bold((0, _devEnvironmentCli.getEnvironmentStartCommand)(opt));
|
|
65
71
|
|
|
@@ -91,7 +97,8 @@ cmd.argv(process.argv, async (arg, opt) => {
|
|
|
91
97
|
await (0, _devEnvironmentCore.printEnvironmentInfo)(slug);
|
|
92
98
|
const message = '\n' + _chalk.default.green('✓') + ` environment created.\n\nTo start it please run:\n\n${startCommand}\n`;
|
|
93
99
|
console.log(message);
|
|
100
|
+
await (0, _tracker.trackEvent)('dev_env_create_command_success', trackingInfo);
|
|
94
101
|
} catch (error) {
|
|
95
|
-
|
|
102
|
+
await (0, _devEnvironmentCli.handleCLIException)(error, 'dev_env_create_command_error', trackingInfo);
|
|
96
103
|
}
|
|
97
104
|
});
|
|
@@ -14,9 +14,9 @@ var _debug = _interopRequireDefault(require("debug"));
|
|
|
14
14
|
|
|
15
15
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _tracker = require("../lib/tracker");
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _command = _interopRequireDefault(require("../lib/cli/command"));
|
|
20
20
|
|
|
21
21
|
var _devEnvironmentCore = require("../lib/dev-environment/dev-environment-core");
|
|
22
22
|
|
|
@@ -24,10 +24,6 @@ var _devEnvironmentCli = require("../lib/dev-environment/dev-environment-cli");
|
|
|
24
24
|
|
|
25
25
|
var _devEnvironment = require("../lib/constants/dev-environment");
|
|
26
26
|
|
|
27
|
-
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); }
|
|
28
|
-
|
|
29
|
-
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; }
|
|
30
|
-
|
|
31
27
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
32
28
|
|
|
33
29
|
/**
|
|
@@ -43,6 +39,8 @@ const examples = [{
|
|
|
43
39
|
}];
|
|
44
40
|
(0, _command.default)().option('slug', 'Custom name of the dev environment').option('soft', 'Keep config files needed to start an environment intact').examples(examples).argv(process.argv, async (arg, opt) => {
|
|
45
41
|
const slug = (0, _devEnvironmentCli.getEnvironmentName)(opt);
|
|
42
|
+
const trackingInfo = (0, _devEnvironmentCli.getEnvTrackingInfo)(slug);
|
|
43
|
+
await (0, _tracker.trackEvent)('dev_env_destroy_command_execute', trackingInfo);
|
|
46
44
|
debug('Args: ', arg, 'Options: ', opt);
|
|
47
45
|
|
|
48
46
|
try {
|
|
@@ -50,7 +48,8 @@ const examples = [{
|
|
|
50
48
|
await (0, _devEnvironmentCore.destroyEnvironment)(slug, removeFiles);
|
|
51
49
|
const message = _chalk.default.green('✓') + ' Environment destroyed.\n';
|
|
52
50
|
console.log(message);
|
|
51
|
+
await (0, _tracker.trackEvent)('dev_env_destroy_command_success', trackingInfo);
|
|
53
52
|
} catch (error) {
|
|
54
|
-
|
|
53
|
+
await (0, _devEnvironmentCli.handleCLIException)(error, 'dev_env_destroy_command_error', trackingInfo);
|
|
55
54
|
}
|
|
56
55
|
});
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
*/
|
|
15
15
|
"use strict";
|
|
16
16
|
|
|
17
|
+
var _tracker = require("../lib/tracker");
|
|
18
|
+
|
|
17
19
|
var _command = _interopRequireDefault(require("../lib/cli/command"));
|
|
18
20
|
|
|
19
21
|
var _devEnvironmentCli = require("../lib/dev-environment/dev-environment-cli");
|
|
@@ -38,6 +40,8 @@ const examples = [{
|
|
|
38
40
|
wildcardCommand: true
|
|
39
41
|
}).option('slug', 'Custom name of the dev environment').examples(examples).argv(process.argv, async (unmatchedArgs, opt) => {
|
|
40
42
|
const slug = (0, _devEnvironmentCli.getEnvironmentName)(opt);
|
|
43
|
+
const trackingInfo = (0, _devEnvironmentCli.getEnvTrackingInfo)(slug);
|
|
44
|
+
await (0, _tracker.trackEvent)('dev_env_exec_command_execute', trackingInfo);
|
|
41
45
|
|
|
42
46
|
try {
|
|
43
47
|
// to avoid confusion let's enforce -- as a splitter for arguments for this command and wp itself
|
|
@@ -55,7 +59,8 @@ const examples = [{
|
|
|
55
59
|
}
|
|
56
60
|
|
|
57
61
|
await (0, _devEnvironmentCore.exec)(slug, arg);
|
|
62
|
+
await (0, _tracker.trackEvent)('dev_env_exec_command_success', trackingInfo);
|
|
58
63
|
} catch (error) {
|
|
59
|
-
(0, _devEnvironmentCli.handleCLIException)(error);
|
|
64
|
+
(0, _devEnvironmentCli.handleCLIException)(error, 'dev_env_exec_command_error', trackingInfo);
|
|
60
65
|
}
|
|
61
66
|
});
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
*/
|
|
15
15
|
"use strict";
|
|
16
16
|
|
|
17
|
+
var _tracker = require("../lib/tracker");
|
|
18
|
+
|
|
17
19
|
var _command = _interopRequireDefault(require("../lib/cli/command"));
|
|
18
20
|
|
|
19
21
|
var _devEnvironmentCli = require("../lib/dev-environment/dev-environment-cli");
|
|
@@ -36,10 +38,13 @@ const examples = [{
|
|
|
36
38
|
}).examples(examples).option('slug', 'Custom name of the dev environment').argv(process.argv, async (unmatchedArgs, opt) => {
|
|
37
39
|
const [filePath] = unmatchedArgs;
|
|
38
40
|
const slug = (0, _devEnvironmentCli.getEnvironmentName)(opt);
|
|
41
|
+
const trackingInfo = (0, _devEnvironmentCli.getEnvTrackingInfo)(slug);
|
|
42
|
+
await (0, _tracker.trackEvent)('dev_env_import_media_command_execute', trackingInfo);
|
|
39
43
|
|
|
40
44
|
try {
|
|
41
45
|
await (0, _devEnvironmentCore.importMediaPath)(slug, filePath);
|
|
46
|
+
await (0, _tracker.trackEvent)('dev_env_import_media_command_success', trackingInfo);
|
|
42
47
|
} catch (error) {
|
|
43
|
-
(0, _devEnvironmentCli.handleCLIException)(error);
|
|
48
|
+
(0, _devEnvironmentCli.handleCLIException)(error, 'dev_env_import_media_command_error', trackingInfo);
|
|
44
49
|
}
|
|
45
50
|
});
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
|
|
13
13
|
var _fs = _interopRequireDefault(require("fs"));
|
|
14
14
|
|
|
15
|
+
var _tracker = require("../lib/tracker");
|
|
16
|
+
|
|
15
17
|
var _command = _interopRequireDefault(require("../lib/cli/command"));
|
|
16
18
|
|
|
17
19
|
var _devEnvironmentCli = require("../lib/dev-environment/dev-environment-cli");
|
|
@@ -49,6 +51,8 @@ const examples = [{
|
|
|
49
51
|
inPlace
|
|
50
52
|
} = opt;
|
|
51
53
|
const slug = (0, _devEnvironmentCli.getEnvironmentName)(opt);
|
|
54
|
+
const trackingInfo = (0, _devEnvironmentCli.getEnvTrackingInfo)(slug);
|
|
55
|
+
await (0, _tracker.trackEvent)('dev_env_import_sql_command_execute', trackingInfo);
|
|
52
56
|
|
|
53
57
|
try {
|
|
54
58
|
const {
|
|
@@ -71,7 +75,8 @@ const examples = [{
|
|
|
71
75
|
await (0, _devEnvironmentCore.exec)(slug, cacheArg);
|
|
72
76
|
const addUserArg = ['wp', 'dev-env-add-admin', '--username=vipgo', '--password=password'];
|
|
73
77
|
await (0, _devEnvironmentCore.exec)(slug, addUserArg);
|
|
78
|
+
await (0, _tracker.trackEvent)('dev_env_import_sql_command_success', trackingInfo);
|
|
74
79
|
} catch (error) {
|
|
75
|
-
(0, _devEnvironmentCli.handleCLIException)(error);
|
|
80
|
+
(0, _devEnvironmentCli.handleCLIException)(error, 'dev_env_import_sql_command_error', trackingInfo);
|
|
76
81
|
}
|
|
77
82
|
});
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
|
|
13
13
|
var _debug = _interopRequireDefault(require("debug"));
|
|
14
14
|
|
|
15
|
+
var _tracker = require("../lib/tracker");
|
|
16
|
+
|
|
15
17
|
var _command = _interopRequireDefault(require("../lib/cli/command"));
|
|
16
18
|
|
|
17
19
|
var _devEnvironmentCore = require("../lib/dev-environment/dev-environment-core");
|
|
@@ -38,6 +40,10 @@ const examples = [{
|
|
|
38
40
|
}];
|
|
39
41
|
(0, _command.default)().option('slug', 'Custom name of the dev environment').option('all', 'Show Info for all local dev environments').examples(examples).argv(process.argv, async (arg, opt) => {
|
|
40
42
|
const slug = (0, _devEnvironmentCli.getEnvironmentName)(opt);
|
|
43
|
+
const trackingInfo = opt.all ? {
|
|
44
|
+
all: true
|
|
45
|
+
} : (0, _devEnvironmentCli.getEnvTrackingInfo)(slug);
|
|
46
|
+
await (0, _tracker.trackEvent)('dev_env_info_command_execute', trackingInfo);
|
|
41
47
|
debug('Args: ', arg, 'Options: ', opt);
|
|
42
48
|
|
|
43
49
|
try {
|
|
@@ -46,7 +52,9 @@ const examples = [{
|
|
|
46
52
|
} else {
|
|
47
53
|
await (0, _devEnvironmentCore.printEnvironmentInfo)(slug);
|
|
48
54
|
}
|
|
55
|
+
|
|
56
|
+
await (0, _tracker.trackEvent)('dev_env_info_command_success', trackingInfo);
|
|
49
57
|
} catch (error) {
|
|
50
|
-
(0, _devEnvironmentCli.handleCLIException)(error);
|
|
58
|
+
(0, _devEnvironmentCli.handleCLIException)(error, 'dev_env_info_command_error', trackingInfo);
|
|
51
59
|
}
|
|
52
60
|
});
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
*/
|
|
15
15
|
"use strict";
|
|
16
16
|
|
|
17
|
+
var _tracker = require("../lib/tracker");
|
|
18
|
+
|
|
17
19
|
var _command = _interopRequireDefault(require("../lib/cli/command"));
|
|
18
20
|
|
|
19
21
|
var _devEnvironmentCore = require("../lib/dev-environment/dev-environment-core");
|
|
@@ -29,9 +31,15 @@ const examples = [{
|
|
|
29
31
|
description: 'Return information about all local dev environments'
|
|
30
32
|
}];
|
|
31
33
|
(0, _command.default)().examples(examples).argv(process.argv, async () => {
|
|
34
|
+
const trackingInfo = {
|
|
35
|
+
all: true
|
|
36
|
+
};
|
|
37
|
+
await (0, _tracker.trackEvent)('dev_env_list_command_execute', trackingInfo);
|
|
38
|
+
|
|
32
39
|
try {
|
|
33
40
|
await (0, _devEnvironmentCore.printAllEnvironmentsInfo)();
|
|
41
|
+
await (0, _tracker.trackEvent)('dev_env_list_command_success', trackingInfo);
|
|
34
42
|
} catch (error) {
|
|
35
|
-
(0, _devEnvironmentCli.handleCLIException)(error);
|
|
43
|
+
(0, _devEnvironmentCli.handleCLIException)(error, 'dev_env_list_command_error', trackingInfo);
|
|
36
44
|
}
|
|
37
45
|
});
|
|
@@ -16,6 +16,8 @@ var _debug = _interopRequireDefault(require("debug"));
|
|
|
16
16
|
|
|
17
17
|
var _child_process = require("child_process");
|
|
18
18
|
|
|
19
|
+
var _tracker = require("../lib/tracker");
|
|
20
|
+
|
|
19
21
|
var _command = _interopRequireDefault(require("../lib/cli/command"));
|
|
20
22
|
|
|
21
23
|
var _devEnvironmentCore = require("../lib/dev-environment/dev-environment-core");
|
|
@@ -37,7 +39,10 @@ const examples = [{
|
|
|
37
39
|
description: 'Starts a local dev environment'
|
|
38
40
|
}];
|
|
39
41
|
(0, _command.default)().option('slug', 'Custom name of the dev environment').option('skip-rebuild', 'Only start stopped services').examples(examples).argv(process.argv, async (arg, opt) => {
|
|
42
|
+
const startProcessing = new Date();
|
|
40
43
|
const slug = (0, _devEnvironmentCli.getEnvironmentName)(opt);
|
|
44
|
+
const trackingInfo = (0, _devEnvironmentCli.getEnvTrackingInfo)(slug);
|
|
45
|
+
await (0, _tracker.trackEvent)('dev_env_start_command_execute', trackingInfo);
|
|
41
46
|
debug('Args: ', arg, 'Options: ', opt);
|
|
42
47
|
const options = {
|
|
43
48
|
skipRebuild: !!opt.skipRebuild
|
|
@@ -60,7 +65,12 @@ const examples = [{
|
|
|
60
65
|
}
|
|
61
66
|
|
|
62
67
|
await (0, _devEnvironmentCore.startEnvironment)(slug, options);
|
|
68
|
+
const processingTime = new Date() - startProcessing;
|
|
69
|
+
const successTrackingInfo = { ...trackingInfo,
|
|
70
|
+
processingTime
|
|
71
|
+
};
|
|
72
|
+
await (0, _tracker.trackEvent)('dev_env_start_command_success', successTrackingInfo);
|
|
63
73
|
} catch (error) {
|
|
64
|
-
(0, _devEnvironmentCli.handleCLIException)(error);
|
|
74
|
+
await (0, _devEnvironmentCli.handleCLIException)(error, 'dev_env_start_command_error', trackingInfo);
|
|
65
75
|
}
|
|
66
76
|
});
|
|
@@ -14,6 +14,8 @@ var _debug = _interopRequireDefault(require("debug"));
|
|
|
14
14
|
|
|
15
15
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
16
16
|
|
|
17
|
+
var _tracker = require("../lib/tracker");
|
|
18
|
+
|
|
17
19
|
var _command = _interopRequireDefault(require("../lib/cli/command"));
|
|
18
20
|
|
|
19
21
|
var _devEnvironmentCli = require("../lib/dev-environment/dev-environment-cli");
|
|
@@ -37,6 +39,8 @@ const cmd = (0, _command.default)().option('slug', 'Custom name of the dev envir
|
|
|
37
39
|
cmd.examples(examples);
|
|
38
40
|
cmd.argv(process.argv, async (arg, opt) => {
|
|
39
41
|
const slug = (0, _devEnvironmentCli.getEnvironmentName)(opt);
|
|
42
|
+
const trackingInfo = (0, _devEnvironmentCli.getEnvTrackingInfo)(slug);
|
|
43
|
+
await (0, _tracker.trackEvent)('dev_env_update_command_execute', trackingInfo);
|
|
40
44
|
|
|
41
45
|
try {
|
|
42
46
|
const environmentAlreadyExists = (0, _devEnvironmentCore.doesEnvironmentExist)(slug);
|
|
@@ -72,12 +76,13 @@ cmd.argv(process.argv, async (arg, opt) => {
|
|
|
72
76
|
await (0, _devEnvironmentCore.updateEnvironment)(instanceData);
|
|
73
77
|
const message = '\n' + _chalk.default.green('✓') + ' environment updated. Restart environment for changes to take an affect.';
|
|
74
78
|
console.log(message);
|
|
79
|
+
await (0, _tracker.trackEvent)('dev_env_update_command_success', trackingInfo);
|
|
75
80
|
} catch (error) {
|
|
76
81
|
if ('ENOENT' === error.code) {
|
|
77
82
|
const message = 'Environment was created before update was supported.\n\nTo update environment please destroy it and create a new one.';
|
|
78
|
-
(0, _devEnvironmentCli.handleCLIException)(new Error(message));
|
|
83
|
+
(0, _devEnvironmentCli.handleCLIException)(new Error(message), 'dev_env_update_command_error', trackingInfo);
|
|
79
84
|
} else {
|
|
80
|
-
(0, _devEnvironmentCli.handleCLIException)(error);
|
|
85
|
+
(0, _devEnvironmentCli.handleCLIException)(error, 'dev_env_update_command_error', trackingInfo);
|
|
81
86
|
}
|
|
82
87
|
}
|
|
83
88
|
});
|
|
@@ -17,6 +17,7 @@ exports.promptForPhpVersion = promptForPhpVersion;
|
|
|
17
17
|
exports.promptForComponent = promptForComponent;
|
|
18
18
|
exports.addDevEnvConfigurationOptions = addDevEnvConfigurationOptions;
|
|
19
19
|
exports.getTagChoices = getTagChoices;
|
|
20
|
+
exports.getEnvTrackingInfo = getEnvTrackingInfo;
|
|
20
21
|
|
|
21
22
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
22
23
|
|
|
@@ -32,6 +33,8 @@ var _path = _interopRequireDefault(require("path"));
|
|
|
32
33
|
|
|
33
34
|
var _os = _interopRequireDefault(require("os"));
|
|
34
35
|
|
|
36
|
+
var _tracker = require("../tracker");
|
|
37
|
+
|
|
35
38
|
var _devEnvironment = require("../constants/dev-environment");
|
|
36
39
|
|
|
37
40
|
var _devEnvironmentCore = require("./dev-environment-core");
|
|
@@ -53,7 +56,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
53
56
|
const debug = (0, _debug.default)('@automattic/vip:bin:dev-environment');
|
|
54
57
|
const DEFAULT_SLUG = 'vip-local';
|
|
55
58
|
|
|
56
|
-
function handleCLIException(exception) {
|
|
59
|
+
async function handleCLIException(exception, trackKey, trackBaseInfo = {}) {
|
|
57
60
|
const errorPrefix = _chalk.default.red('Error:');
|
|
58
61
|
|
|
59
62
|
if (_devEnvironment.DEV_ENVIRONMENT_NOT_FOUND === exception.message) {
|
|
@@ -67,6 +70,17 @@ function handleCLIException(exception) {
|
|
|
67
70
|
message = message.replace('ERROR: ', '');
|
|
68
71
|
console.log(errorPrefix, message);
|
|
69
72
|
|
|
73
|
+
if (trackKey) {
|
|
74
|
+
try {
|
|
75
|
+
const errorTrackingInfo = { ...trackBaseInfo,
|
|
76
|
+
error: message
|
|
77
|
+
};
|
|
78
|
+
await (0, _tracker.trackEvent)(trackKey, errorTrackingInfo);
|
|
79
|
+
} catch (trackException) {
|
|
80
|
+
console.log(errorPrefix, `Failed to record track event ${trackKey}`, trackException.message);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
70
84
|
if (!process.env.DEBUG) {
|
|
71
85
|
console.log(`Please re-run the command with "--debug ${_chalk.default.bold('@automattic/vip:bin:dev-environment')}" appended to it and provide the stack trace on the support ticket.`);
|
|
72
86
|
console.log(_chalk.default.bold('\nExample:\n'));
|
|
@@ -450,4 +464,25 @@ async function getTagChoices() {
|
|
|
450
464
|
value: version.tag
|
|
451
465
|
};
|
|
452
466
|
});
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
function getEnvTrackingInfo(slug) {
|
|
470
|
+
try {
|
|
471
|
+
const envData = (0, _devEnvironmentCore.readEnvironmentData)(slug);
|
|
472
|
+
const result = {
|
|
473
|
+
slug
|
|
474
|
+
};
|
|
475
|
+
|
|
476
|
+
for (const key of Object.keys(envData)) {
|
|
477
|
+
// track doesnt like camelCase
|
|
478
|
+
const snakeCasedKey = key.replace(/[A-Z]/g, letter => `_${letter.toLowerCase()}`);
|
|
479
|
+
result[snakeCasedKey] = envData[key];
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
return result;
|
|
483
|
+
} catch (err) {
|
|
484
|
+
return {
|
|
485
|
+
slug
|
|
486
|
+
};
|
|
487
|
+
}
|
|
453
488
|
}
|
|
@@ -494,9 +494,11 @@ async function updateWordPressImage(slug) {
|
|
|
494
494
|
} // sort
|
|
495
495
|
|
|
496
496
|
|
|
497
|
-
versions.sort((before, after) => before.tag < after.tag ? 1 : -1); // Newest WordPress Image
|
|
497
|
+
versions.sort((before, after) => before.tag < after.tag ? 1 : -1); // Newest WordPress Image but that is not trunk
|
|
498
498
|
|
|
499
|
-
const newestWordPressImage = versions
|
|
499
|
+
const newestWordPressImage = versions.find(({
|
|
500
|
+
tag
|
|
501
|
+
}) => tag !== 'trunk');
|
|
500
502
|
console.log('The most recent WordPress version available is: ' + _chalk.default.green(newestWordPressImage.tag)); // If the currently used version is the most up to date: exit.
|
|
501
503
|
|
|
502
504
|
if (currentWordPressTag === newestWordPressImage.tag) {
|
|
@@ -44,7 +44,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
44
44
|
/**
|
|
45
45
|
* This file will hold all the interactions with lando library
|
|
46
46
|
*/
|
|
47
|
-
const DEBUG_KEY = '@automattic/vip:bin:dev-environment
|
|
47
|
+
const DEBUG_KEY = '@automattic/vip:bin:dev-environment';
|
|
48
48
|
const debug = (0, _debug.default)(DEBUG_KEY);
|
|
49
49
|
let landoConfRoot;
|
|
50
50
|
/**
|
|
@@ -67,7 +67,9 @@ function getLandoConfig() {
|
|
|
67
67
|
const landoPath = _path.default.join(__dirname, '..', '..', '..', 'node_modules', 'lando');
|
|
68
68
|
|
|
69
69
|
debug(`Getting lando config, using path '${landoPath}' for plugins`);
|
|
70
|
-
const
|
|
70
|
+
const isLandoDebugSelected = (process.env.DEBUG || '').includes(DEBUG_KEY);
|
|
71
|
+
const isAllDebugSelected = process.env.DEBUG === '*';
|
|
72
|
+
const logLevelConsole = isAllDebugSelected || isLandoDebugSelected ? 'debug' : 'warn';
|
|
71
73
|
return {
|
|
72
74
|
logLevelConsole,
|
|
73
75
|
landoFile: '.lando.yml',
|
|
@@ -153,6 +155,8 @@ async function landoDestroy(instancePath) {
|
|
|
153
155
|
}
|
|
154
156
|
|
|
155
157
|
async function landoInfo(instancePath) {
|
|
158
|
+
var _app$info$find;
|
|
159
|
+
|
|
156
160
|
const lando = new _lando.default(getLandoConfig());
|
|
157
161
|
await lando.bootstrap();
|
|
158
162
|
const app = lando.getApp(instancePath);
|
|
@@ -163,13 +167,24 @@ async function landoInfo(instancePath) {
|
|
|
163
167
|
const reachableServices = app.info.filter(service => service.urls.length);
|
|
164
168
|
reachableServices.forEach(service => appInfo[`${service.service} urls`] = service.urls);
|
|
165
169
|
const isUp = await isEnvUp(app);
|
|
170
|
+
const frontEndUrl = (_app$info$find = app.info.find(service => 'nginx' === service.service)) === null || _app$info$find === void 0 ? void 0 : _app$info$find.urls[0];
|
|
166
171
|
const extraService = await getExtraServicesConnections(lando, app);
|
|
167
172
|
appInfo = { ...appInfo,
|
|
168
173
|
...extraService
|
|
169
174
|
};
|
|
170
175
|
appInfo.status = isUp ? _chalk.default.green('UP') : _chalk.default.yellow('DOWN'); // Drop vipdev prefix
|
|
171
176
|
|
|
172
|
-
appInfo.name = appInfo.name.replace(/^vipdev/, '');
|
|
177
|
+
appInfo.name = appInfo.name.replace(/^vipdev/, ''); // Add login information
|
|
178
|
+
|
|
179
|
+
if (frontEndUrl) {
|
|
180
|
+
const loginUrl = `${frontEndUrl}wp-admin/`;
|
|
181
|
+
appInfo['Login URL'] = loginUrl;
|
|
182
|
+
appInfo['Default username'] = 'vipgo';
|
|
183
|
+
appInfo['Default password'] = 'password';
|
|
184
|
+
} // Add documentation link
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
appInfo.Documentation = 'https://docs.wpvip.com/technical-references/vip-local-development-environment/tips/';
|
|
173
188
|
return appInfo;
|
|
174
189
|
}
|
|
175
190
|
|
package/dist/lib/tracker.js
CHANGED
|
@@ -49,16 +49,15 @@ async function getInstance() {
|
|
|
49
49
|
return analytics;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
analytics = init();
|
|
52
|
+
analytics = await init();
|
|
53
53
|
return analytics;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
async function trackEvent(...args) {
|
|
57
|
-
await _token.default.uuid();
|
|
58
|
-
|
|
59
57
|
try {
|
|
58
|
+
await _token.default.uuid();
|
|
60
59
|
const client = await getInstance();
|
|
61
|
-
return client.trackEvent(...args);
|
|
60
|
+
return await client.trackEvent(...args);
|
|
62
61
|
} catch (err) {
|
|
63
62
|
debug('trackEvent() failed', err);
|
|
64
63
|
}
|
package/npm-shrinkwrap.json
CHANGED