@automattic/vip 2.3.0 → 2.6.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 CHANGED
@@ -94,12 +94,15 @@ gh pr list --search "is:merged sort:updated-desc closed:>$LAST_RELEASE_DATE" | s
94
94
 
95
95
  Then, let's publish:
96
96
 
97
+ 1. Make sure master branch is up to date `git pull`
97
98
  1. Set the version (via `npm version minor` or `npm version major` or `npm version patch`)
98
99
  1. For most regular releases, this will be `npm version minor`.
99
100
  1. Push the tag to GitHub (`git push --tags`)
101
+ 1. Push the master branch `git push`
100
102
  1. Make sure you're part of the Automattic organization in npm
101
103
  1. Publish the release to npm (`npm run publish-please --access public`)
102
104
  1. Edit [the release on GitHub](https://github.com/Automattic/vip/releases) to include a description of the changes and publish (this can just copy the details from the changelog).
105
+ 1. Push `master` changes (mostly the version bump) to `develop` (`git checkout develop && git merge master` )
103
106
 
104
107
  Once released, it's worth running `npm i -g @automattic/vip` to install / upgrade the released version to make sure everything looks good.
105
108
 
package/README.md CHANGED
@@ -27,6 +27,36 @@ By default, we record information about the usage of this tool using an in-house
27
27
 
28
28
  ## Changelog
29
29
 
30
+ ### 2.6.0 (23 November 2021)
31
+ - #921 [dev-env] Introuces update to change existing environment
32
+ - #928 [dev-env] Switch lando to use our fork
33
+ - #927 [dev-env] Handles user already exists during sql import
34
+ - #925 [dev-env] Fix the issue with dev-env update
35
+ - #924 FORNO-985 Increase SQL Import limit for unlaunched sites to 100GB
36
+ - #923 FORNO-943 Fixes a bug which prevents displaying SQL Import error messages
37
+ - #922 Update eslint-config-wpvip commit hash to c6605d1
38
+ - #873 Pin dependencies
39
+
40
+ ### 2.5.0 (9 November 2021)
41
+ - #919 [dev-env] Expose lando core logs
42
+ - #916 [dev-env] Save instance data state
43
+ - #914 [dev-env] update help wording for dev env
44
+ - #915 Add warning message when an envvar is set/deleted
45
+
46
+ ### 2.4.0 (5 November 2021)
47
+ - #913 [dev-env] No login required for dev-env
48
+ - #911 Adds more release instructions
49
+
50
+ ### 2.3.1 (2 November 2021)
51
+ - Fixes an issue with the 2.3.0 where the intended changes didn't get published correctly.
52
+
53
+ ### 2.3.0 (2 November 2021)
54
+ - #908 [dev-env] Custom user permissions setup
55
+ - #897 [dev-env] Primary domain prompt for primary domain redirect
56
+ - #902 [dev-env] Delete file permissions
57
+ - #900 Clarify CONTRIBUTING guidelines
58
+ - #905 Update contribution steps
59
+
30
60
  ### 2.2.0 (27 October 2021)
31
61
 
32
62
  New: Environment variables command
@@ -16,8 +16,10 @@ services:
16
16
  command: sleep infinity
17
17
  volumes:
18
18
  - devtools:/dev-tools
19
+ - scripts:/scripts
19
20
  volumes:
20
21
  devtools: {}
22
+ scripts:
21
23
 
22
24
  nginx:
23
25
  type: compose
@@ -40,12 +42,20 @@ services:
40
42
  XDEBUG: <%= xdebug ? 'enable' : 'disable' %>
41
43
  STATSD: <%= statsd ? 'enable' : 'disable' %>
42
44
 
45
+ LANDO_NO_USER_PERMS: 'enable'
46
+
47
+
43
48
  volumes:
44
49
  - type: volume
45
50
  source: devtools
46
51
  target: /dev-tools
47
52
  volume:
48
53
  nocopy: true
54
+ - type: volume
55
+ source: scripts
56
+ target: /scripts
57
+ volume:
58
+ nocopy: true
49
59
  <% wpVolumes() %>
50
60
  run:
51
61
  - sh /dev-tools/setup.sh database root "http://<%= siteSlug %>.vipdev.lndo.site/" "<%= wpTitle %>" <% if ( multisite ) { %> <%= siteSlug %>.vipdev.lndo.site <% } %>
@@ -117,6 +127,11 @@ services:
117
127
  command: sh -c "rsync -a /wp/ /shared/; chown www-data -R /shared; sleep infinity"
118
128
  volumes:
119
129
  - ./wordpress:/shared
130
+ - type: volume
131
+ source: scripts
132
+ target: /scripts
133
+ volume:
134
+ nocopy: true
120
135
 
121
136
  <% if ( muPlugins.mode == 'image' ) { %>
122
137
  mu-plugins:
@@ -126,6 +141,11 @@ services:
126
141
  command: sh /run.sh
127
142
  volumes:
128
143
  - mu-plugins:/shared
144
+ - type: volume
145
+ source: scripts
146
+ target: /scripts
147
+ volume:
148
+ nocopy: true
129
149
  volumes:
130
150
  mu-plugins: {}
131
151
  <% } %>
@@ -82,6 +82,10 @@ async function deleteEnvVarCommand(arg, opt) {
82
82
  });
83
83
  await (0, _tracker.trackEvent)('envvar_delete_command_success', trackingParams);
84
84
  console.log(_chalk.default.green(`Successfully deleted environment variable ${JSON.stringify(name)}`));
85
+
86
+ if (!opt.skipConfirmation) {
87
+ console.log(_chalk.default.bgYellow(_chalk.default.bold('Important:')), 'Updates to environment variables will not be available until the application’s next deploy.');
88
+ }
85
89
  }
86
90
 
87
91
  (0, _command.default)({
@@ -101,6 +101,10 @@ async function setEnvVarCommand(arg, opt) {
101
101
  });
102
102
  await (0, _tracker.trackEvent)('envvar_set_command_success', trackingParams);
103
103
  console.log(_chalk.default.green(`Successfully set environment variable ${JSON.stringify(name)}`));
104
+
105
+ if (!opt.skipConfirmation) {
106
+ console.log(_chalk.default.bgYellow(_chalk.default.bold('Important:')), 'Updates to environment variables will not be available until the application’s next deploy.');
107
+ }
104
108
  }
105
109
 
106
110
  (0, _command.default)({
@@ -50,23 +50,14 @@ const examples = [{
50
50
  usage: `${_devEnvironment.DEV_ENVIRONMENT_FULL_COMMAND} create --multisite --wordpress "5.8" --client-code "~/git/my_code"`,
51
51
  description: 'Creates a local multisite dev environment using WP 5.8 and client code is expected to be in "~/git/my_code"'
52
52
  }];
53
- (0, _command.default)().option('slug', 'Custom name of the dev environment').option('title', 'Title for the WordPress site (default: "VIP Dev")').option('multisite', 'Enable multisite install', undefined, value => {
53
+ const cmd = (0, _command.default)().option('slug', 'Custom name of the dev environment').option('title', 'Title for the WordPress site').option('multisite', 'Enable multisite install', undefined, value => {
54
54
  var _value$toLowerCase;
55
55
 
56
56
  return 'false' !== (value === null || value === void 0 ? void 0 : (_value$toLowerCase = value.toLowerCase) === null || _value$toLowerCase === void 0 ? void 0 : _value$toLowerCase.call(value));
57
- }).option('wordpress', 'Use a specific WordPress version or local directory (default: last stable)').option(['u', 'mu-plugins'], 'Use a specific mu-plugins changeset or local directory (default: "auto": last commit in master)').option('client-code', 'Use the client code from a local directory or VIP skeleton (default: use the VIP skeleton)').option('statsd', 'Enable statsd component. By default it is disabled', undefined, value => {
58
- var _value$toLowerCase2;
59
-
60
- return 'false' !== (value === null || value === void 0 ? void 0 : (_value$toLowerCase2 = value.toLowerCase) === null || _value$toLowerCase2 === void 0 ? void 0 : _value$toLowerCase2.call(value));
61
- }).option('phpmyadmin', 'Enable PHPMyAdmin component. By default it is disabled', undefined, value => {
62
- var _value$toLowerCase3;
63
-
64
- return 'false' !== (value === null || value === void 0 ? void 0 : (_value$toLowerCase3 = value.toLowerCase) === null || _value$toLowerCase3 === void 0 ? void 0 : _value$toLowerCase3.call(value));
65
- }).option('xdebug', 'Enable XDebug. By default it is disabled', undefined, value => {
66
- var _value$toLowerCase4;
67
-
68
- return 'false' !== (value === null || value === void 0 ? void 0 : (_value$toLowerCase4 = value.toLowerCase) === null || _value$toLowerCase4 === void 0 ? void 0 : _value$toLowerCase4.call(value));
69
- }).option('elasticsearch', 'Explicitly choose Elasticsearch version to use').option('mariadb', 'Explicitly choose MariaDB version to use').option('media-redirect-domain', 'Domain to redirect for missing media files. This can be used to still have images without the need to import them locally.').examples(examples).argv(process.argv, async (arg, opt) => {
57
+ });
58
+ (0, _devEnvironmentCli.addDevEnvConfigurationOptions)(cmd);
59
+ cmd.examples(examples);
60
+ cmd.argv(process.argv, async (arg, opt) => {
70
61
  const slug = (0, _devEnvironmentCli.getEnvironmentName)(opt);
71
62
  debug('Args: ', arg, 'Options: ', opt);
72
63
 
@@ -79,11 +70,12 @@ const examples = [{
79
70
  exit.withError(messageToShow);
80
71
  }
81
72
 
82
- let appInfo = {};
73
+ let defaultOptions = {};
83
74
 
84
75
  try {
85
76
  if (opt.app) {
86
- appInfo = await (0, _devEnvironmentCore.getApplicationInformation)(opt.app, opt.env);
77
+ const appInfo = await (0, _devEnvironmentCore.getApplicationInformation)(opt.app, opt.env);
78
+ defaultOptions = (0, _devEnvironmentCli.getOptionsFromAppInfo)(appInfo);
87
79
  }
88
80
  } catch (error) {
89
81
  const message = `failed to fetch application "${opt.app}" information`;
@@ -91,17 +83,11 @@ const examples = [{
91
83
  console.log(_chalk.default.yellow('Warning:'), message);
92
84
  }
93
85
 
94
- const instanceData = await (0, _devEnvironmentCli.promptForArguments)(opt, appInfo);
95
- const instanceDataWithSlug = { ...instanceData,
96
- siteSlug: slug,
97
- statsd: opt.statsd || false,
98
- phpmyadmin: opt.phpmyadmin || false,
99
- xdebug: opt.xdebug || false,
100
- mediaRedirectDomain: opt.mediaRedirectDomain || ''
101
- };
86
+ const instanceData = await (0, _devEnvironmentCli.promptForArguments)(opt, defaultOptions);
87
+ instanceData.siteSlug = slug;
102
88
 
103
89
  try {
104
- await (0, _devEnvironmentCore.createEnvironment)(instanceDataWithSlug);
90
+ await (0, _devEnvironmentCore.createEnvironment)(instanceData);
105
91
  await (0, _devEnvironmentCore.printEnvironmentInfo)(slug);
106
92
  const message = '\n' + _chalk.default.green('✓') + ` environment created.\n\nTo start it please run:\n\n${startCommand}\n`;
107
93
  console.log(message);
@@ -12,6 +12,8 @@
12
12
 
13
13
  var _fs = _interopRequireDefault(require("fs"));
14
14
 
15
+ var _chalk = _interopRequireDefault(require("chalk"));
16
+
15
17
  var _command = _interopRequireDefault(require("../lib/cli/command"));
16
18
 
17
19
  var _devEnvironmentCli = require("../lib/dev-environment/dev-environment-cli");
@@ -62,8 +64,17 @@ const examples = [{
62
64
 
63
65
  const cacheArg = ['wp', 'cache', 'flush'];
64
66
  await (0, _devEnvironmentCore.exec)(slug, cacheArg);
65
- const addUserArg = ['wp', 'user', 'create', 'vipgo', 'vipgo@go-vip.net', '--user_pass=password', '--role=administrator'];
66
- await (0, _devEnvironmentCore.exec)(slug, addUserArg);
67
+
68
+ try {
69
+ const addUserArg = ['wp', 'user', 'create', 'vipgo', 'vipgo@go-vip.net', '--user_pass=password', '--role=administrator'];
70
+ await (0, _devEnvironmentCore.exec)(slug, addUserArg);
71
+ } catch (exception) {
72
+ if ((exception.message || '').includes('is already registered')) {
73
+ console.log(_chalk.default.bold(_chalk.default.green('Success: ')) + 'Skipping user vipgo provisioning');
74
+ } else {
75
+ throw exception;
76
+ }
77
+ }
67
78
  } catch (error) {
68
79
  (0, _devEnvironmentCli.handleCLIException)(error);
69
80
  }
@@ -0,0 +1,80 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ *
5
+ * @format
6
+ */
7
+
8
+ /**
9
+ * External dependencies
10
+ */
11
+ "use strict";
12
+
13
+ var _debug = _interopRequireDefault(require("debug"));
14
+
15
+ var _chalk = _interopRequireDefault(require("chalk"));
16
+
17
+ var _command = _interopRequireDefault(require("../lib/cli/command"));
18
+
19
+ var _devEnvironmentCli = require("../lib/dev-environment/dev-environment-cli");
20
+
21
+ var _devEnvironment = require("../lib/constants/dev-environment");
22
+
23
+ var _devEnvironmentCore = require("../lib/dev-environment/dev-environment-core");
24
+
25
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
26
+
27
+ /**
28
+ * Internal dependencies
29
+ */
30
+ const debug = (0, _debug.default)('@automattic/vip:bin:dev-environment');
31
+ const examples = [{
32
+ usage: `${_devEnvironment.DEV_ENVIRONMENT_FULL_COMMAND} update`,
33
+ description: 'Retriggers setup wizard in order to change environment configuration'
34
+ }];
35
+ const cmd = (0, _command.default)().option('slug', 'Custom name of the dev environment');
36
+ (0, _devEnvironmentCli.addDevEnvConfigurationOptions)(cmd);
37
+ cmd.examples(examples);
38
+ cmd.argv(process.argv, async (arg, opt) => {
39
+ const slug = (0, _devEnvironmentCli.getEnvironmentName)(opt);
40
+
41
+ try {
42
+ const environmentAlreadyExists = (0, _devEnvironmentCore.doesEnvironmentExist)(slug);
43
+
44
+ if (!environmentAlreadyExists) {
45
+ throw new Error(_devEnvironment.DEV_ENVIRONMENT_NOT_FOUND);
46
+ }
47
+
48
+ const currentInstanceData = (0, _devEnvironmentCore.readEnvironmentData)(slug);
49
+ debug('Read instance data', currentInstanceData);
50
+ const preselectedOptions = {
51
+ // Title and multisite can't be changed during update
52
+ title: currentInstanceData.wpTitle,
53
+ multisite: currentInstanceData.multisite,
54
+ ...opt
55
+ };
56
+ const defaultOptions = {
57
+ clientCode: currentInstanceData.clientCode.dir || currentInstanceData.clientCode.tag || 'latest',
58
+ muPlugins: currentInstanceData.muPlugins.dir || currentInstanceData.muPlugins.tag || 'latest',
59
+ wordpress: currentInstanceData.wordpress.tag,
60
+ elasticsearch: currentInstanceData.elasticsearch,
61
+ mariadb: currentInstanceData.mariadb,
62
+ statsd: currentInstanceData.statsd,
63
+ phpmyadmin: currentInstanceData.phpmyadmin,
64
+ xdebug: currentInstanceData.xdebug,
65
+ mediaRedirectDomain: currentInstanceData.mediaRedirectDomain
66
+ };
67
+ const instanceData = await (0, _devEnvironmentCli.promptForArguments)(preselectedOptions, defaultOptions);
68
+ instanceData.siteSlug = slug;
69
+ await (0, _devEnvironmentCore.updateEnvironment)(instanceData);
70
+ const message = '\n' + _chalk.default.green('✓') + ' environment updated. Restart environment for changes to take an affect.';
71
+ console.log(message);
72
+ } catch (error) {
73
+ if ('ENOENT' === error.code) {
74
+ const message = 'Environment was created before update was supported.\n\nTo update environment please destroy it and create a new one.';
75
+ (0, _devEnvironmentCli.handleCLIException)(new Error(message));
76
+ } else {
77
+ (0, _devEnvironmentCli.handleCLIException)(error);
78
+ }
79
+ }
80
+ });
@@ -20,4 +20,4 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
20
20
 
21
21
  (0, _command.default)({
22
22
  requiredArgs: 1
23
- }).command('create', 'Create a new local dev environment').command('start', 'Start a local dev environment').command('stop', 'Stop a local dev environment').command('destroy', 'Remove containers, networks, volumes and configuration files of a local dev environment').command('info', 'Provides basic info about one or multiple local dev environments').command('exec', 'Execute an operation on a dev environment').command('import', 'Import data into a local WordPress environment').argv(process.argv);
23
+ }).command('create', 'Create a new local dev environment').command('update', 'Update an already created local dev environment').command('start', 'Start a local dev environment').command('stop', 'Stop a local dev environment').command('destroy', 'Remove containers, networks, volumes and configuration files of a local dev environment').command('info', 'Provides basic info about one or multiple local dev environments').command('exec', 'Execute an operation on a dev environment').command('import', 'Import data into a local WordPress environment').argv(process.argv);
@@ -495,7 +495,8 @@ Processing the SQL import for your environment...
495
495
  id: app.id,
496
496
  environmentId: env.id,
497
497
  basename: basename,
498
- md5: md5
498
+ md5: md5,
499
+ searchReplace: []
499
500
  };
500
501
 
501
502
  if (searchReplace) {
package/dist/bin/vip.js CHANGED
@@ -15,7 +15,7 @@ var _debug = _interopRequireDefault(require("debug"));
15
15
 
16
16
  var _config = _interopRequireDefault(require("../../config/config.json"));
17
17
 
18
- var _command = _interopRequireDefault(require("../lib/cli/command"));
18
+ var _command = _interopRequireWildcard(require("../lib/cli/command"));
19
19
 
20
20
  var _token = _interopRequireDefault(require("../lib/token"));
21
21
 
@@ -23,6 +23,10 @@ var _tracker = require("../lib/tracker");
23
23
 
24
24
  var _rollbar = require("../lib/rollbar");
25
25
 
26
+ 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); }
27
+
28
+ 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; }
29
+
26
30
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
31
 
28
32
  /**
@@ -52,9 +56,10 @@ const rootCmd = async function () {
52
56
  let token = await _token.default.get();
53
57
  const isHelpCommand = process.argv.some(arg => arg === 'help' || arg === '-h' || arg === '--help');
54
58
  const isLogoutCommand = process.argv.some(arg => arg === 'logout');
59
+ const isDevEnvCommandWithoutEnv = process.argv.some(arg => arg === 'dev-env') && !(0, _command.containsAppEnvArgument)(process.argv);
55
60
  debug('Argv:', process.argv);
56
61
 
57
- if (isLogoutCommand || isHelpCommand || token && token.valid()) {
62
+ if (isLogoutCommand || isHelpCommand || isDevEnvCommandWithoutEnv || token && token.valid()) {
58
63
  runCmd();
59
64
  } else {
60
65
  console.log();
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = _default;
7
7
  exports.getEnvIdentifier = getEnvIdentifier;
8
+ exports.containsAppEnvArgument = containsAppEnvArgument;
8
9
 
9
10
  var _args = _interopRequireDefault(require("args"));
10
11
 
@@ -587,4 +588,9 @@ function getEnvIdentifier(env) {
587
588
  }
588
589
 
589
590
  return identifier;
591
+ }
592
+
593
+ function containsAppEnvArgument(argv) {
594
+ const parsedAlias = (0, _envAlias.parseEnvAliasFromArgv)(argv);
595
+ return !!(parsedAlias.app || parsedAlias.env || argv.includes('--app') || argv.includes('--env'));
590
596
  }
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.DEV_ENVIRONMENT_COMPONENTS = exports.DEV_ENVIRONMENT_PROMPT_INTRO = exports.DEV_ENVIRONMENT_DEFAULTS = exports.DEV_ENVIRONMENT_FULL_COMMAND = exports.DEV_ENVIRONMENT_SUBCOMMAND = void 0;
6
+ exports.DEV_ENVIRONMENT_COMPONENTS = exports.DEV_ENVIRONMENT_NOT_FOUND = exports.DEV_ENVIRONMENT_PROMPT_INTRO = exports.DEV_ENVIRONMENT_DEFAULTS = exports.DEV_ENVIRONMENT_FULL_COMMAND = exports.DEV_ENVIRONMENT_SUBCOMMAND = void 0;
7
7
  const DEV_ENVIRONMENT_SUBCOMMAND = 'dev-env';
8
8
  exports.DEV_ENVIRONMENT_SUBCOMMAND = DEV_ENVIRONMENT_SUBCOMMAND;
9
9
  const DEV_ENVIRONMENT_FULL_COMMAND = `vip ${DEV_ENVIRONMENT_SUBCOMMAND}`;
@@ -17,5 +17,7 @@ const DEV_ENVIRONMENT_DEFAULTS = {
17
17
  exports.DEV_ENVIRONMENT_DEFAULTS = DEV_ENVIRONMENT_DEFAULTS;
18
18
  const DEV_ENVIRONMENT_PROMPT_INTRO = 'This is a wizard to help you set up your local dev environment.\n\n' + 'Sensible default values were pre-selected for convenience. ' + 'You may also choose to create multiple environments with different settings using the --slug option.\n\n';
19
19
  exports.DEV_ENVIRONMENT_PROMPT_INTRO = DEV_ENVIRONMENT_PROMPT_INTRO;
20
+ const DEV_ENVIRONMENT_NOT_FOUND = 'Environment not found.';
21
+ exports.DEV_ENVIRONMENT_NOT_FOUND = DEV_ENVIRONMENT_NOT_FOUND;
20
22
  const DEV_ENVIRONMENT_COMPONENTS = ['wordpress', 'muPlugins', 'clientCode'];
21
23
  exports.DEV_ENVIRONMENT_COMPONENTS = DEV_ENVIRONMENT_COMPONENTS;
@@ -8,11 +8,13 @@ exports.getEnvironmentName = getEnvironmentName;
8
8
  exports.getEnvironmentStartCommand = getEnvironmentStartCommand;
9
9
  exports.printTable = printTable;
10
10
  exports.processComponentOptionInput = processComponentOptionInput;
11
+ exports.getOptionsFromAppInfo = getOptionsFromAppInfo;
11
12
  exports.promptForArguments = promptForArguments;
12
13
  exports.resolvePath = resolvePath;
13
14
  exports.promptForText = promptForText;
14
15
  exports.promptForBoolean = promptForBoolean;
15
16
  exports.promptForComponent = promptForComponent;
17
+ exports.addDevEnvConfigurationOptions = addDevEnvConfigurationOptions;
16
18
 
17
19
  var _chalk = _interopRequireDefault(require("chalk"));
18
20
 
@@ -30,6 +32,8 @@ var _os = _interopRequireDefault(require("os"));
30
32
 
31
33
  var _devEnvironment = require("../constants/dev-environment");
32
34
 
35
+ var _types = require("./types");
36
+
33
37
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
34
38
 
35
39
  /**
@@ -50,7 +54,7 @@ const DEFAULT_SLUG = 'vip-local';
50
54
  function handleCLIException(exception) {
51
55
  const errorPrefix = _chalk.default.red('Error:');
52
56
 
53
- if ('Environment not found.' === exception.message) {
57
+ if (_devEnvironment.DEV_ENVIRONMENT_NOT_FOUND === exception.message) {
54
58
  const createCommand = _chalk.default.bold(_devEnvironment.DEV_ENVIRONMENT_FULL_COMMAND + ' create');
55
59
 
56
60
  const message = `Environment doesn't exist.\n\n\nTo create a new environment run:\n\n${createCommand}\n`;
@@ -121,49 +125,89 @@ function processComponentOptionInput(passedParam, allowLocal) {
121
125
  };
122
126
  }
123
127
 
124
- async function promptForArguments(providedOptions, appInfo) {
125
- var _appInfo$environment;
128
+ function getOptionsFromAppInfo(appInfo) {
129
+ var _appInfo$environment, _appInfo$environment2, _appInfo$environment3;
130
+
131
+ if (!appInfo) {
132
+ return {};
133
+ }
134
+
135
+ return {
136
+ title: ((_appInfo$environment = appInfo.environment) === null || _appInfo$environment === void 0 ? void 0 : _appInfo$environment.name) || appInfo.name,
137
+ multisite: !!(appInfo !== null && appInfo !== void 0 && (_appInfo$environment2 = appInfo.environment) !== null && _appInfo$environment2 !== void 0 && _appInfo$environment2.isMultisite),
138
+ mediaRedirectDomain: (_appInfo$environment3 = appInfo.environment) === null || _appInfo$environment3 === void 0 ? void 0 : _appInfo$environment3.primaryDomain
139
+ };
140
+ }
141
+ /**
142
+ * Prompt for arguments
143
+ * @param {InstanceOptions} preselectedOptions - options to be used without prompt
144
+ * @param {InstanceOptions} defaultOptions - options to be used as default values for prompt
145
+ * @returns {any} instance data
146
+ */
147
+
126
148
 
127
- debug('Provided options', providedOptions);
149
+ async function promptForArguments(preselectedOptions, defaultOptions) {
150
+ debug('Provided preselected', preselectedOptions, 'and default', defaultOptions);
128
151
  console.log(_devEnvironment.DEV_ENVIRONMENT_PROMPT_INTRO);
129
- const name = (appInfo === null || appInfo === void 0 ? void 0 : (_appInfo$environment = appInfo.environment) === null || _appInfo$environment === void 0 ? void 0 : _appInfo$environment.name) || (appInfo === null || appInfo === void 0 ? void 0 : appInfo.name);
130
152
  let multisiteText = 'Multisite';
131
153
  let multisiteDefault = _devEnvironment.DEV_ENVIRONMENT_DEFAULTS.multisite;
132
154
 
133
- if (appInfo !== null && appInfo !== void 0 && appInfo.environment) {
134
- var _appInfo$environment2;
135
-
136
- const isEnvMultisite = !!(appInfo !== null && appInfo !== void 0 && (_appInfo$environment2 = appInfo.environment) !== null && _appInfo$environment2 !== void 0 && _appInfo$environment2.isMultisite);
137
- multisiteText += ` (${name} ${isEnvMultisite ? 'IS' : 'is NOT'} multisite)`;
138
- multisiteDefault = isEnvMultisite;
155
+ if (defaultOptions.title) {
156
+ multisiteText += ` (${defaultOptions.title} ${defaultOptions.multisite ? 'IS' : 'is NOT'} multisite)`;
157
+ multisiteDefault = defaultOptions.multisite;
139
158
  }
140
159
 
141
160
  const instanceData = {
142
- wpTitle: providedOptions.title || (await promptForText('WordPress site title', name || _devEnvironment.DEV_ENVIRONMENT_DEFAULTS.title)),
143
- multisite: 'multisite' in providedOptions ? providedOptions.multisite : await promptForBoolean(multisiteText, multisiteDefault),
144
- elasticsearch: providedOptions.elasticsearch || _devEnvironment.DEV_ENVIRONMENT_DEFAULTS.elasticsearchVersion,
145
- mariadb: providedOptions.mariadb || _devEnvironment.DEV_ENVIRONMENT_DEFAULTS.mariadbVersion,
161
+ wpTitle: preselectedOptions.title || (await promptForText('WordPress site title', defaultOptions.title || _devEnvironment.DEV_ENVIRONMENT_DEFAULTS.title)),
162
+ multisite: 'multisite' in preselectedOptions ? preselectedOptions.multisite : await promptForBoolean(multisiteText, !!multisiteDefault),
163
+ elasticsearch: preselectedOptions.elasticsearch || defaultOptions.elasticsearch || _devEnvironment.DEV_ENVIRONMENT_DEFAULTS.elasticsearchVersion,
164
+ mariadb: preselectedOptions.mariadb || defaultOptions.mariadb || _devEnvironment.DEV_ENVIRONMENT_DEFAULTS.mariadbVersion,
165
+ mediaRedirectDomain: preselectedOptions.mediaRedirectDomain || '',
146
166
  wordpress: {},
147
167
  muPlugins: {},
148
- clientCode: {}
168
+ clientCode: {},
169
+ statsd: false,
170
+ phpmyadmin: false,
171
+ xdebug: false
149
172
  };
150
173
 
174
+ if (!instanceData.mediaRedirectDomain && defaultOptions.mediaRedirectDomain) {
175
+ const mediaRedirectPromptText = `Would you like to redirect to ${defaultOptions.mediaRedirectDomain} for missing media files?`;
176
+ const setMediaRedirectDomain = await promptForBoolean(mediaRedirectPromptText, true);
177
+
178
+ if (setMediaRedirectDomain) {
179
+ instanceData.mediaRedirectDomain = defaultOptions.mediaRedirectDomain;
180
+ }
181
+ }
182
+
151
183
  for (const component of _devEnvironment.DEV_ENVIRONMENT_COMPONENTS) {
152
- const option = providedOptions[component];
153
- instanceData[component] = await processComponent(component, option);
184
+ const option = preselectedOptions[component];
185
+ const defaultValue = defaultOptions[component];
186
+ instanceData[component] = await processComponent(component, option, defaultValue);
154
187
  }
155
188
 
189
+ for (const service of ['statsd', 'phpmyadmin', 'xdebug']) {
190
+ if (service in preselectedOptions) {
191
+ instanceData[service] = preselectedOptions[service];
192
+ } else if (service in defaultOptions) {
193
+ instanceData[service] = defaultOptions[service];
194
+ }
195
+ }
196
+
197
+ debug('Instance data after prompts', instanceData);
156
198
  return instanceData;
157
199
  }
158
200
 
159
- async function processComponent(component, option) {
201
+ async function processComponent(component, preselectedValue, defaultValue) {
202
+ debug(`processing a component '${component}', with preselected/deafault - ${preselectedValue}/${defaultValue}`);
160
203
  let result = null;
161
204
  const allowLocal = component !== 'wordpress';
205
+ const defaultObject = defaultValue ? processComponentOptionInput(defaultValue, allowLocal) : null;
162
206
 
163
- if (option) {
164
- result = processComponentOptionInput(option, allowLocal);
207
+ if (preselectedValue) {
208
+ result = processComponentOptionInput(preselectedValue, allowLocal);
165
209
  } else {
166
- result = await promptForComponent(component, allowLocal);
210
+ result = await promptForComponent(component, allowLocal, defaultObject);
167
211
  }
168
212
 
169
213
  while ('local' === ((_result = result) === null || _result === void 0 ? void 0 : _result.mode)) {
@@ -181,7 +225,7 @@ async function processComponent(component, option) {
181
225
  } else {
182
226
  const message = `Provided path "${resolvedPath}" does not point to a valid or existing directory.`;
183
227
  console.log(_chalk.default.yellow('Warning:'), message);
184
- result = await promptForComponent(component, allowLocal);
228
+ result = await promptForComponent(component, allowLocal, defaultObject);
185
229
  }
186
230
  }
187
231
 
@@ -211,7 +255,7 @@ async function promptForText(message, initial) {
211
255
  initial,
212
256
  validate: nonEmptyValidator
213
257
  });
214
- return result.input.trim();
258
+ return ((result === null || result === void 0 ? void 0 : result.input) || '').trim();
215
259
  }
216
260
 
217
261
  async function promptForBoolean(message, initial) {
@@ -228,19 +272,19 @@ const componentDisplayNames = {
228
272
  clientCode: 'site-code'
229
273
  };
230
274
 
231
- async function promptForComponent(component, allowLocal) {
232
- debug(`Prompting for ${component}`);
275
+ async function promptForComponent(component, allowLocal, defaultObject) {
276
+ debug(`Prompting for ${component} with default:`, defaultObject);
233
277
  const componentDisplayName = componentDisplayNames[component] || component;
234
- const choices = [];
278
+ const modChoices = [];
235
279
 
236
280
  if (allowLocal) {
237
- choices.push({
281
+ modChoices.push({
238
282
  message: `local folder - where you already have ${componentDisplayName} code`,
239
283
  value: 'local'
240
284
  });
241
285
  }
242
286
 
243
- choices.push({
287
+ modChoices.push({
244
288
  message: 'image - that gets automatically fetched',
245
289
  value: 'image'
246
290
  });
@@ -250,14 +294,18 @@ async function promptForComponent(component, allowLocal) {
250
294
  initialMode = 'local';
251
295
  }
252
296
 
297
+ if (defaultObject !== null && defaultObject !== void 0 && defaultObject.mode) {
298
+ initialMode = defaultObject.mode;
299
+ }
300
+
253
301
  let modeResult = initialMode;
254
- const selectMode = choices.length > 1;
302
+ const selectMode = modChoices.length > 1;
255
303
 
256
304
  if (selectMode) {
257
- const initialModeIndex = choices.findIndex(choice => choice.value === initialMode);
305
+ const initialModeIndex = modChoices.findIndex(choice => choice.value === initialMode);
258
306
  const select = new _enquirer.Select({
259
307
  message: `How would you like to source ${componentDisplayName}`,
260
- choices,
308
+ choices: modChoices,
261
309
  initial: initialModeIndex
262
310
  });
263
311
  modeResult = await select.run();
@@ -266,38 +314,61 @@ async function promptForComponent(component, allowLocal) {
266
314
  const messagePrefix = selectMode ? '\t' : `${componentDisplayName} - `;
267
315
 
268
316
  if ('local' === modeResult) {
269
- const directoryPath = await promptForText(`${messagePrefix}What is a path to your local ${componentDisplayName}`, '');
317
+ const directoryPath = await promptForText(`${messagePrefix}What is a path to your local ${componentDisplayName}`, (defaultObject === null || defaultObject === void 0 ? void 0 : defaultObject.dir) || '');
270
318
  return {
271
319
  mode: modeResult,
272
320
  dir: directoryPath
273
321
  };
274
- }
275
-
276
- if ('inherit' === modeResult) {
277
- return {
278
- mode: modeResult
279
- };
280
- } // image
322
+ } // image with selection
281
323
 
282
324
 
283
325
  if (component === 'wordpress') {
284
326
  const message = `${messagePrefix}Which version would you like`;
327
+ const tagChoices = getWordpressImageTags();
328
+ let initialTagIndex = 0;
329
+
330
+ if (defaultObject !== null && defaultObject !== void 0 && defaultObject.tag) {
331
+ const defaultTagIndex = tagChoices.indexOf(defaultObject.tag);
332
+
333
+ if (defaultTagIndex !== -1) {
334
+ initialTagIndex = defaultTagIndex;
335
+ }
336
+ }
337
+
285
338
  const selectTag = new _enquirer.Select({
286
339
  message,
287
- choices: getWordpressImageTags()
340
+ choices: tagChoices,
341
+ initial: initialTagIndex
288
342
  });
289
343
  const tag = await selectTag.run();
290
344
  return {
291
345
  mode: modeResult,
292
346
  tag
293
347
  };
294
- }
348
+ } // image
349
+
295
350
 
296
351
  return {
297
352
  mode: modeResult
298
353
  };
299
354
  }
300
355
 
356
+ function addDevEnvConfigurationOptions(command) {
357
+ return command.option('wordpress', 'Use a specific WordPress version').option(['u', 'mu-plugins'], 'Use a specific mu-plugins changeset or local directory').option('client-code', 'Use the client code from a local directory or VIP skeleton').option('statsd', 'Enable statsd component. By default it is disabled', undefined, value => {
358
+ var _value$toLowerCase;
359
+
360
+ return 'false' !== (value === null || value === void 0 ? void 0 : (_value$toLowerCase = value.toLowerCase) === null || _value$toLowerCase === void 0 ? void 0 : _value$toLowerCase.call(value));
361
+ }).option('phpmyadmin', 'Enable PHPMyAdmin component. By default it is disabled', undefined, value => {
362
+ var _value$toLowerCase2;
363
+
364
+ return 'false' !== (value === null || value === void 0 ? void 0 : (_value$toLowerCase2 = value.toLowerCase) === null || _value$toLowerCase2 === void 0 ? void 0 : _value$toLowerCase2.call(value));
365
+ }).option('xdebug', 'Enable XDebug. By default it is disabled', undefined, value => {
366
+ var _value$toLowerCase3;
367
+
368
+ return 'false' !== (value === null || value === void 0 ? void 0 : (_value$toLowerCase3 = value.toLowerCase) === null || _value$toLowerCase3 === void 0 ? void 0 : _value$toLowerCase3.call(value));
369
+ }).option('elasticsearch', 'Explicitly choose Elasticsearch version to use').option('mariadb', 'Explicitly choose MariaDB version to use').option('media-redirect-domain', 'Domain to redirect for missing media files. This can be used to still have images without the need to import them locally.');
370
+ }
371
+
301
372
  function getWordpressImageTags() {
302
373
  return ['5.8.1', '5.8', '5.7.3', '5.7.2'];
303
374
  }
@@ -6,11 +6,13 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.startEnvironment = startEnvironment;
7
7
  exports.stopEnvironment = stopEnvironment;
8
8
  exports.createEnvironment = createEnvironment;
9
+ exports.updateEnvironment = updateEnvironment;
9
10
  exports.destroyEnvironment = destroyEnvironment;
10
11
  exports.printAllEnvironmentsInfo = printAllEnvironmentsInfo;
11
12
  exports.printEnvironmentInfo = printEnvironmentInfo;
12
13
  exports.exec = exec;
13
14
  exports.doesEnvironmentExist = doesEnvironmentExist;
15
+ exports.readEnvironmentData = readEnvironmentData;
14
16
  exports.getEnvironmentPath = getEnvironmentPath;
15
17
  exports.getApplicationInformation = getApplicationInformation;
16
18
  exports.resolveImportPath = resolveImportPath;
@@ -42,6 +44,8 @@ var _devEnvironmentCli = require("./dev-environment-cli");
42
44
 
43
45
  var _app = _interopRequireDefault(require("../api/app"));
44
46
 
47
+ var _devEnvironment = require("../constants/dev-environment");
48
+
45
49
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
46
50
 
47
51
  /**
@@ -64,6 +68,7 @@ const nginxFileTemplatePath = _path.default.join(__dirname, '..', '..', '..', 'a
64
68
 
65
69
  const landoFileName = '.lando.yml';
66
70
  const nginxFileName = 'extra.conf';
71
+ const instanceDataFileName = 'instance_data.json';
67
72
  const homeDirPathInsideContainers = '/user';
68
73
  const uploadPathString = 'uploads';
69
74
  const nginxPathString = 'nginx';
@@ -76,7 +81,7 @@ async function startEnvironment(slug, options) {
76
81
  const environmentExists = _fs.default.existsSync(instancePath);
77
82
 
78
83
  if (!environmentExists) {
79
- throw new Error('Environment not found.');
84
+ throw new Error(_devEnvironment.DEV_ENVIRONMENT_NOT_FOUND);
80
85
  }
81
86
 
82
87
  if (options.skipRebuild) {
@@ -96,7 +101,7 @@ async function stopEnvironment(slug) {
96
101
  const environmentExists = _fs.default.existsSync(instancePath);
97
102
 
98
103
  if (!environmentExists) {
99
- throw new Error('Environment not found.');
104
+ throw new Error(_devEnvironment.DEV_ENVIRONMENT_NOT_FOUND);
100
105
  }
101
106
 
102
107
  await (0, _devEnvironmentLando.landoStop)(instancePath);
@@ -104,7 +109,7 @@ async function stopEnvironment(slug) {
104
109
 
105
110
  async function createEnvironment(instanceData) {
106
111
  const slug = instanceData.siteSlug;
107
- debug('Will start an environment', slug, 'with instanceData: ', instanceData);
112
+ debug('Will create an environment', slug, 'with instanceData: ', instanceData);
108
113
  const instancePath = getEnvironmentPath(slug);
109
114
  debug('Instance path for', slug, 'is:', instancePath);
110
115
 
@@ -114,12 +119,36 @@ async function createEnvironment(instanceData) {
114
119
  throw new Error('Environment already exists.');
115
120
  }
116
121
 
122
+ const preProcessedInstanceData = preProcessInstanceData(instanceData);
123
+ await prepareLandoEnv(preProcessedInstanceData, instancePath);
124
+ }
125
+
126
+ async function updateEnvironment(instanceData) {
127
+ const slug = instanceData.siteSlug;
128
+ debug('Will update an environment', slug, 'with instanceData: ', instanceData);
129
+ const instancePath = getEnvironmentPath(slug);
130
+ debug('Instance path for', slug, 'is:', instancePath);
131
+
132
+ const alreadyExists = _fs.default.existsSync(instancePath);
133
+
134
+ if (!alreadyExists) {
135
+ throw new Error('Environment doesn\'t exist.');
136
+ }
137
+
138
+ const preProcessedInstanceData = preProcessInstanceData(instanceData);
139
+ await prepareLandoEnv(preProcessedInstanceData, instancePath);
140
+ }
141
+
142
+ function preProcessInstanceData(instanceData) {
143
+ const newInstanceData = { ...instanceData
144
+ };
145
+
117
146
  if (instanceData.mediaRedirectDomain && !instanceData.mediaRedirectDomain.match(/^http/)) {
118
147
  // We need to make sure the redirect is an absolute path
119
- instanceData.mediaRedirectDomain = `https://${instanceData.mediaRedirectDomain}`;
148
+ newInstanceData.mediaRedirectDomain = `https://${instanceData.mediaRedirectDomain}`;
120
149
  }
121
150
 
122
- await prepareLandoEnv(instanceData, instancePath);
151
+ return newInstanceData;
123
152
  }
124
153
 
125
154
  async function destroyEnvironment(slug, removeFiles) {
@@ -130,7 +159,7 @@ async function destroyEnvironment(slug, removeFiles) {
130
159
  const environmentExists = _fs.default.existsSync(instancePath);
131
160
 
132
161
  if (!environmentExists) {
133
- throw new Error('Environment not found.');
162
+ throw new Error(_devEnvironment.DEV_ENVIRONMENT_NOT_FOUND);
134
163
  }
135
164
 
136
165
  const landoFilePath = _path.default.join(instancePath, landoFileName);
@@ -169,7 +198,7 @@ async function printEnvironmentInfo(slug) {
169
198
  const environmentExists = _fs.default.existsSync(instancePath);
170
199
 
171
200
  if (!environmentExists) {
172
- throw new Error('Environment not found.');
201
+ throw new Error(_devEnvironment.DEV_ENVIRONMENT_NOT_FOUND);
173
202
  }
174
203
 
175
204
  const appInfo = await (0, _devEnvironmentLando.landoInfo)(instancePath);
@@ -184,7 +213,7 @@ async function exec(slug, args) {
184
213
  const environmentExists = _fs.default.existsSync(instancePath);
185
214
 
186
215
  if (!environmentExists) {
187
- throw new Error('Environment not found.');
216
+ throw new Error(_devEnvironment.DEV_ENVIRONMENT_NOT_FOUND);
188
217
  }
189
218
 
190
219
  const command = args.shift();
@@ -204,9 +233,21 @@ function doesEnvironmentExist(slug) {
204
233
  return _fs.default.existsSync(instancePath);
205
234
  }
206
235
 
236
+ function readEnvironmentData(slug) {
237
+ debug('Will try to get instance data for environment', slug);
238
+ const instancePath = getEnvironmentPath(slug);
239
+
240
+ const instanceDataTargetPath = _path.default.join(instancePath, instanceDataFileName);
241
+
242
+ const instanceDataString = _fs.default.readFileSync(instanceDataTargetPath, 'utf8');
243
+
244
+ return JSON.parse(instanceDataString);
245
+ }
246
+
207
247
  async function prepareLandoEnv(instanceData, instancePath) {
208
248
  const landoFile = await _ejs.default.renderFile(landoFileTemplatePath, instanceData);
209
249
  const nginxFile = await _ejs.default.renderFile(nginxFileTemplatePath, instanceData);
250
+ const instanceDataFile = JSON.stringify(instanceData);
210
251
 
211
252
  const landoFileTargetPath = _path.default.join(instancePath, landoFileName);
212
253
 
@@ -214,6 +255,8 @@ async function prepareLandoEnv(instanceData, instancePath) {
214
255
 
215
256
  const nginxFileTargetPath = _path.default.join(nginxFolderPath, nginxFileName);
216
257
 
258
+ const instanceDataTargetPath = _path.default.join(instancePath, instanceDataFileName);
259
+
217
260
  _fs.default.mkdirSync(instancePath, {
218
261
  recursive: true
219
262
  });
@@ -226,8 +269,11 @@ async function prepareLandoEnv(instanceData, instancePath) {
226
269
 
227
270
  _fs.default.writeFileSync(nginxFileTargetPath, nginxFile);
228
271
 
272
+ _fs.default.writeFileSync(instanceDataTargetPath, instanceDataFile);
273
+
229
274
  debug(`Lando file created in ${landoFileTargetPath}`);
230
275
  debug(`Nginx file created in ${nginxFileTargetPath}`);
276
+ debug(`Instance data file created in ${instanceDataTargetPath}`);
231
277
  }
232
278
 
233
279
  function getAllEnvironmentNames() {
@@ -276,7 +322,10 @@ async function getApplicationInformation(appId, envType) {
276
322
  name,
277
323
  type,
278
324
  branch,
279
- isMultisite
325
+ isMultisite,
326
+ primaryDomain {
327
+ name
328
+ }
280
329
  }`;
281
330
  const queryResult = await (0, _app.default)(appId, fieldsQuery);
282
331
  const appData = {};
@@ -297,11 +346,14 @@ async function getApplicationInformation(appId, envType) {
297
346
  }
298
347
 
299
348
  if (envData) {
349
+ var _envData$primaryDomai;
350
+
300
351
  appData.environment = {
301
352
  name: envData.name,
302
353
  branch: envData.branch,
303
354
  type: envData.type,
304
- isMultisite: envData.isMultisite
355
+ isMultisite: envData.isMultisite,
356
+ primaryDomain: ((_envData$primaryDomai = envData.primaryDomain) === null || _envData$primaryDomai === void 0 ? void 0 : _envData$primaryDomai.name) || ''
305
357
  };
306
358
  }
307
359
  }
@@ -42,14 +42,16 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
42
42
  /**
43
43
  * This file will hold all the interactions with lando library
44
44
  */
45
- const debug = (0, _debug.default)('@automattic/vip:bin:dev-environment-lando');
45
+ const DEBUG_KEY = '@automattic/vip:bin:dev-environment-lando';
46
+ const debug = (0, _debug.default)(DEBUG_KEY);
46
47
 
47
48
  function getLandoConfig() {
48
49
  const landoPath = _path.default.join(__dirname, '..', '..', '..', 'node_modules', 'lando');
49
50
 
50
51
  debug(`Getting lando config, using path '${landoPath}' for plugins`);
52
+ const logLevelConsole = (process.env.DEBUG || '').includes(DEBUG_KEY) ? 'debug' : 'warn';
51
53
  return {
52
- logLevelConsole: 'warn',
54
+ logLevelConsole,
53
55
  landoFile: '.lando.yml',
54
56
  preLandoFiles: ['.lando.base.yml', '.lando.dist.yml', '.lando.upstream.yml'],
55
57
  postLandoFiles: ['.lando.local.yml'],
@@ -0,0 +1 @@
1
+ "use strict";
@@ -16,7 +16,7 @@ var _fileSize = require("../constants/file-size");
16
16
  /**
17
17
  * Internal dependencies
18
18
  */
19
- const SQL_IMPORT_FILE_SIZE_LIMIT = 10 * _fileSize.GB_IN_BYTES;
19
+ const SQL_IMPORT_FILE_SIZE_LIMIT = 100 * _fileSize.GB_IN_BYTES;
20
20
  exports.SQL_IMPORT_FILE_SIZE_LIMIT = SQL_IMPORT_FILE_SIZE_LIMIT;
21
21
  const SQL_IMPORT_FILE_SIZE_LIMIT_LAUNCHED = 350 * _fileSize.MB_IN_BYTES;
22
22
  exports.SQL_IMPORT_FILE_SIZE_LIMIT_LAUNCHED = SQL_IMPORT_FILE_SIZE_LIMIT_LAUNCHED;
@@ -345,7 +345,7 @@ ${maybeExitPrompt}
345
345
 
346
346
  let failedImportStep;
347
347
 
348
- if (jobCreationTime && (importStepProgress === null || importStepProgress === void 0 ? void 0 : importStepProgress.started_at) * 1000 > jobCreationTime) {
348
+ if (jobCreationTime && (importStepProgress === null || importStepProgress === void 0 ? void 0 : importStepProgress.started_at) * 1000 >= jobCreationTime) {
349
349
  // The contents of the `import_progress` meta are pertinent to the most recent import job
350
350
  failedImportStep = importStepProgress.steps.find(step => (step === null || step === void 0 ? void 0 : step.result) === 'failed' && 1000 * (step === null || step === void 0 ? void 0 : step.started_at) > new Date(createdAt).getTime());
351
351
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/vip",
3
- "version": "2.3.0",
3
+ "version": "2.6.0",
4
4
  "description": "The VIP Javascript library & CLI",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -16,6 +16,7 @@
16
16
  "vip-config-envvar-set": "dist/bin/vip-config-envvar-set.js",
17
17
  "vip-dev-env": "dist/bin/vip-dev-env.js",
18
18
  "vip-dev-env-create": "dist/bin/vip-dev-env-create.js",
19
+ "vip-dev-env-update": "dist/bin/vip-dev-env-update.js",
19
20
  "vip-dev-env-destroy": "dist/bin/vip-dev-env-destroy.js",
20
21
  "vip-dev-env-exec": "dist/bin/vip-dev-env-exec.js",
21
22
  "vip-dev-env-import": "dist/bin/vip-dev-env-import.js",
@@ -75,7 +76,7 @@
75
76
  "devDependencies": {
76
77
  "@babel/cli": "7.15.7",
77
78
  "@babel/core": "7.14.0",
78
- "@babel/eslint-parser": "^7.13.14",
79
+ "@babel/eslint-parser": "7.13.14",
79
80
  "@babel/plugin-transform-modules-commonjs": "7.14.0",
80
81
  "@babel/preset-env": "7.14.1",
81
82
  "@babel/preset-flow": "7.13.13",
@@ -84,14 +85,14 @@
84
85
  "babel-plugin-module-resolver": "4.1.0",
85
86
  "core-js": "3.12.0",
86
87
  "eslint": "7.32.0",
87
- "eslint-config-wpvip": "github:automattic/eslint-config-wpvip#d0aa883",
88
+ "eslint-config-wpvip": "github:automattic/eslint-config-wpvip#c6605d1",
88
89
  "eslint-plugin-flowtype": "5.7.2",
89
90
  "eslint-plugin-import": "2.22.1",
90
91
  "eslint-plugin-jest": "24.3.6",
91
92
  "eslint-plugin-json": "3.0.0",
92
93
  "eslint-plugin-jsx-a11y": "6.4.1",
93
94
  "eslint-plugin-no-async-foreach": "0.1.1",
94
- "eslint-plugin-react": "^7.26.0",
95
+ "eslint-plugin-react": "7.26.0",
95
96
  "eslint-plugin-wpcalypso": "5.0.0",
96
97
  "flow-bin": "0.150.0",
97
98
  "jest": "27.2.1",
@@ -115,7 +116,7 @@
115
116
  "ini": "2.0.0",
116
117
  "json2csv": "5.0.6",
117
118
  "jwt-decode": "2.2.0",
118
- "lando": "git+https://github.com/lando/cli.git#v3.4.3",
119
+ "lando": "git+https://github.com/Automattic/lando-cli.git#v3.5.1-patch2021_11_22",
119
120
  "node-fetch": "^2.6.1",
120
121
  "opn": "5.5.0",
121
122
  "rollbar": "2.22.0",