@automattic/vip 3.4.2 → 3.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -58,6 +58,9 @@ services:
58
58
  <% } %>
59
59
  <% if ( autologinKey ) { %>
60
60
  VIP_DEV_AUTOLOGIN_KEY: "<%= autologinKey %>"
61
+ <% } %>
62
+ <% if ( cron ) { %>
63
+ ENABLE_CRON: 1
61
64
  <% } %>
62
65
  LANDO_NO_USER_PERMS: 'enable'
63
66
  LANDO_NEEDS_EXEC: 1
@@ -83,6 +86,7 @@ services:
83
86
  --domain "http://<%= siteSlug %>.<%= domain %>/"
84
87
  --title "<%= wpTitle %>"
85
88
  <% if ( multisite ) { %>--ms-domain "<%= siteSlug %>.<%= domain %>" <% if ( multisite === true || multisite === 'subdomain' ) { %>--subdomain <% } %> <% } %>
89
+
86
90
  database:
87
91
  type: compose
88
92
  services:
@@ -120,12 +124,25 @@ services:
120
124
 
121
125
  <% if ( phpmyadmin ) { %>
122
126
  phpmyadmin:
123
- type: phpmyadmin
124
- hosts:
125
- - database
126
- overrides:
127
+ type: compose
128
+ services:
129
+ image: phpmyadmin:5
130
+ command: /docker-entrypoint.sh apache2-foreground
127
131
  environment:
132
+ MYSQL_ROOT_PASSWORD: ''
133
+ PMA_HOSTS: database
134
+ PMA_PORT: 3306
135
+ PMA_USER: root
136
+ PMA_PASSWORD: ''
128
137
  UPLOAD_LIMIT: 4G
138
+ LANDO_NO_USER_PERMS: 1
139
+ LANDO_NEEDS_EXEC: 1
140
+ ports:
141
+ - 127.0.0.1::80
142
+ volumes:
143
+ - pma_www:/var/www/html
144
+ volumes:
145
+ pma_www:
129
146
  <% } %>
130
147
 
131
148
  <% if ( elasticsearch ) { %>
@@ -250,7 +250,7 @@ _args.default.argv = async function (argv, cb) {
250
250
  });
251
251
  exit.withError('Environment production is not allowed for this command');
252
252
  }
253
- const env = options.app.environments.find(cur => getEnvIdentifier(cur) === options.env);
253
+ const env = options.app.environments.find(cur => getEnvIdentifier(cur).toLowerCase() === options.env.toLowerCase());
254
254
  if (!env) {
255
255
  await (0, _tracker.trackEvent)('command_childcontext_param_error', {
256
256
  error: `Invalid child environment (${options.env}) specified`
@@ -32,4 +32,4 @@ const DEV_ENVIRONMENT_DEFAULTS = exports.DEV_ENVIRONMENT_DEFAULTS = {
32
32
  multisite: false,
33
33
  phpVersion: Object.keys(DEV_ENVIRONMENT_PHP_VERSIONS)[0]
34
34
  };
35
- const DEV_ENVIRONMENT_VERSION = exports.DEV_ENVIRONMENT_VERSION = '2.0.3';
35
+ const DEV_ENVIRONMENT_VERSION = exports.DEV_ENVIRONMENT_VERSION = '2.1.0';
@@ -250,13 +250,15 @@ async function promptForArguments(preselectedOptions, defaultOptions, suppressPr
250
250
  xdebugConfig: preselectedOptions.xdebugConfig,
251
251
  siteSlug: '',
252
252
  mailpit: false,
253
- photon: false
253
+ photon: false,
254
+ cron: false
254
255
  };
255
256
  const promptLabels = {
256
257
  xdebug: 'XDebug',
257
258
  phpmyadmin: 'phpMyAdmin',
258
259
  mailpit: 'Mailpit',
259
- photon: 'Photon'
260
+ photon: 'Photon',
261
+ cron: 'Cron'
260
262
  };
261
263
  if (create && !instanceData.mediaRedirectDomain && defaultOptions.mediaRedirectDomain) {
262
264
  const mediaRedirectPromptText = `Would you like to redirect to ${defaultOptions.mediaRedirectDomain} for missing media files?`;
@@ -280,7 +282,7 @@ async function promptForArguments(preselectedOptions, defaultOptions, suppressPr
280
282
  } else {
281
283
  instanceData.elasticsearch = await promptForBoolean('Enable Elasticsearch (needed by Enterprise Search)?', Boolean(defaultOptions.elasticsearch));
282
284
  }
283
- const services = ['phpmyadmin', 'xdebug', 'mailpit', 'photon'];
285
+ const services = ['phpmyadmin', 'xdebug', 'mailpit', 'photon', 'cron'];
284
286
  for (const service of services) {
285
287
  if (service in instanceData) {
286
288
  const preselected = preselectedOptions[service];
@@ -626,7 +628,7 @@ function processVersionOption(value) {
626
628
  const phpVersionsSupported = Object.keys(_devEnvironment.DEV_ENVIRONMENT_PHP_VERSIONS).join(', ');
627
629
  function addDevEnvConfigurationOptions(command) {
628
630
  // We leave the third parameter to undefined on some because the defaults are handled in preProcessInstanceData()
629
- return command.option('wordpress', 'Manage the version of WordPress. Accepts a string value for major versions (6.x). Defaults to the most recent version of WordPress.', undefined, processVersionOption).option(['u', 'mu-plugins'], 'Manage the source for VIP MU plugins. Accepts "demo" (default) for a read-only image of the staging branch, or a path to a built copy of VIP MU plugins on the local machine.').option('app-code', 'Manage the source for application code. Accepts "demo" (default) for a read-only image of WordPress VIP skeleton application code, or a path to a VIP formatted application repo on the local machine.').option('phpmyadmin', 'Enable or disable phpMyAdmin, disabled by default. Accepts "y" (default value) to enable or "n" to disable. When enabled, refer to the value of "PHPMYADMIN URLS" in the information output for a local environment for the URL to access phpMyAdmin.', undefined, processBooleanOption).option('xdebug', 'Enable or disable XDebug, disabled by default. Accepts "y" (default value) to enable or "n" to disable.', undefined, processBooleanOption).option('xdebug_config', 'Override some default configuration settings for Xdebug. Accepts a string value that is assigned to the XDEBUG_CONFIG environment variable.').option('elasticsearch', 'Enable or disable Elasticsearch (required by Enterprise Search), disabled by default. Accepts "y" (default value) to enable or "n" to disable.', undefined, processBooleanOption).option(['r', 'media-redirect-domain'], 'Configure media files to be proxied from a VIP Platform environment. Accepts a string value for the primary domain of the VIP Platform environment or "n" to disable the media proxy.', undefined, processMediaRedirectDomainOption).option('php', `Manage the version of PHP. Accepts a string value for minor versions: ${phpVersionsSupported}`, undefined, processVersionOption).option(['A', 'mailpit'], 'Enable or disable Mailpit, disabled by default. Accepts "y" (default value) to enable or "n" to disable.', undefined, processBooleanOption).option(['H', 'photon'], 'Enable or disable Photon, disabled by default. Accepts "y" (default value) to enable or "n" to disable.', undefined, processBooleanOption);
631
+ return command.option('wordpress', 'Manage the version of WordPress. Accepts a string value for major versions (6.x). Defaults to the most recent version of WordPress.', undefined, processVersionOption).option(['u', 'mu-plugins'], 'Manage the source for VIP MU plugins. Accepts "demo" (default) for a read-only image of the staging branch, or a path to a built copy of VIP MU plugins on the local machine.').option('app-code', 'Manage the source for application code. Accepts "demo" (default) for a read-only image of WordPress VIP skeleton application code, or a path to a VIP formatted application repo on the local machine.').option('phpmyadmin', 'Enable or disable phpMyAdmin, disabled by default. Accepts "y" (default value) to enable or "n" to disable. When enabled, refer to the value of "PHPMYADMIN URLS" in the information output for a local environment for the URL to access phpMyAdmin.', undefined, processBooleanOption).option('xdebug', 'Enable or disable XDebug, disabled by default. Accepts "y" (default value) to enable or "n" to disable.', undefined, processBooleanOption).option('xdebug_config', 'Override some default configuration settings for Xdebug. Accepts a string value that is assigned to the XDEBUG_CONFIG environment variable.').option('elasticsearch', 'Enable or disable Elasticsearch (required by Enterprise Search), disabled by default. Accepts "y" (default value) to enable or "n" to disable.', undefined, processBooleanOption).option(['r', 'media-redirect-domain'], 'Configure media files to be proxied from a VIP Platform environment. Accepts a string value for the primary domain of the VIP Platform environment or "n" to disable the media proxy.', undefined, processMediaRedirectDomainOption).option('php', `Manage the version of PHP. Accepts a string value for minor versions: ${phpVersionsSupported}`, undefined, processVersionOption).option('cron', 'Enable or disable cron, disabled by default. Accepts "y" (default value) to enable or "n" to disable.', undefined, processBooleanOption).option(['A', 'mailpit'], 'Enable or disable Mailpit, disabled by default. Accepts "y" (default value) to enable or "n" to disable.', undefined, processBooleanOption).option(['H', 'photon'], 'Enable or disable Photon, disabled by default. Accepts "y" (default value) to enable or "n" to disable.', undefined, processBooleanOption);
630
632
  }
631
633
 
632
634
  /**
@@ -84,6 +84,7 @@ function sanitizeConfiguration(configuration, configurationFilePath) {
84
84
  mailpit: stringToBooleanIfDefined(configuration.mailpit),
85
85
  'media-redirect-domain': configuration['media-redirect-domain']?.toString(),
86
86
  photon: stringToBooleanIfDefined(configuration.photon),
87
+ cron: stringToBooleanIfDefined(configuration.cron),
87
88
  meta: configurationMeta
88
89
  };
89
90
 
@@ -121,7 +122,8 @@ function mergeConfigurationFileOptions(preselectedOptions, configurationFileOpti
121
122
  xdebugConfig: configurationFileOptions['xdebug-config'],
122
123
  mailpit: configurationFileOptions.mailpit,
123
124
  mediaRedirectDomain: configurationFileOptions['media-redirect-domain'],
124
- photon: configurationFileOptions.photon
125
+ photon: configurationFileOptions.photon,
126
+ cron: configurationFileOptions.cron
125
127
  };
126
128
  const mergedOptions = {};
127
129
  Object.keys(configurationFileInstanceOptions).forEach(key => {
@@ -179,5 +181,6 @@ elasticsearch: false
179
181
  xdebug: false
180
182
  mailpit: false
181
183
  photon: false
184
+ cron: false
182
185
  `;
183
186
  }
@@ -148,6 +148,9 @@ function preProcessInstanceData(instanceData) {
148
148
  if (!newInstanceData.photon) {
149
149
  newInstanceData.photon = false;
150
150
  }
151
+ if (!newInstanceData.cron) {
152
+ newInstanceData.cron = false;
153
+ }
151
154
 
152
155
  // Mailpit migration
153
156
  newInstanceData.mailpit ??= false;
@@ -247,6 +250,7 @@ async function printEnvironmentInfo(lando, slug, options) {
247
250
  xdebug += ' (with additional configuration)';
248
251
  }
249
252
  appInfo.xdebug = xdebug;
253
+ appInfo.cron = environmentData.cron ? 'enabled' : 'disabled';
250
254
  appInfo.wordpress = parseComponentForInfo(environmentData.wordpress);
251
255
  appInfo['Mu plugins'] = parseComponentForInfo(environmentData.muPlugins);
252
256
  appInfo['App Code'] = parseComponentForInfo(environmentData.appCode);
@@ -80,7 +80,7 @@ async function getLandoConfig() {
80
80
  subdir: '.',
81
81
  namespace: '@lando'
82
82
  }],
83
- disablePlugins: ['@lando/argv', '@lando/mailhog'],
83
+ disablePlugins: ['@lando/argv', '@lando/mailhog', '@lando/phpmyadmin'],
84
84
  proxyName: 'vip-dev-env-proxy',
85
85
  userConfRoot: landoDir,
86
86
  home: fakeHomeDir,
@@ -373,16 +373,19 @@ async function getExtraServicesConnections(lando, app) {
373
373
  // eslint-disable-next-line no-await-in-loop
374
374
  const containerScan = service.id ? await lando.engine.docker.scan(service.id) : null;
375
375
  if (containerScan?.NetworkSettings.Ports) {
376
- const mappings = Object.keys(containerScan.NetworkSettings.Ports).map(internalPort => containerScan.NetworkSettings.Ports[internalPort]).filter(externalMapping => externalMapping?.length);
377
- if (mappings.length) {
378
- const {
379
- HostIp: host,
380
- HostPort: port
381
- } = mappings[0][0];
376
+ const mappings = Object.values(containerScan.NetworkSettings.Ports).filter(externalMapping => externalMapping?.length);
377
+ mappings[0]?.forEach(({
378
+ HostIp: host,
379
+ HostPort: port
380
+ }) => {
382
381
  const label = displayConfiguration.label ?? service.service;
383
382
  const value = (displayConfiguration.protocol ? `${displayConfiguration.protocol}://` : '') + `${host}:${port}`;
384
- extraServices[label] = value;
385
- }
383
+ if (extraServices[label]) {
384
+ extraServices[label] += `, ${value}`;
385
+ } else {
386
+ extraServices[label] = value;
387
+ }
388
+ });
386
389
  }
387
390
  }
388
391
  return extraServices;
package/docs/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  ## Changelog
2
2
 
3
+ ### 3.5.0
4
+
5
+ * feat(dev-env): add support for cron
6
+ * build(deps-dev): bump @automattic/eslint-plugin-wpvip from 0.11.0 to 0.12.0
7
+ * fix(dev-env): display all port mappings
8
+ * refactor(dev-env): migrate from `@lando/phpmyadmin` to `phpmyadmin` Docker image
9
+
10
+ **Full Changelog**: https://github.com/Automattic/vip-cli/compare/3.4.2...3.5.0
11
+
12
+ ### 3.4.2
13
+
14
+ * build(deps-dev): bump @types/node from 18.19.37 to 18.19.38
15
+ * build(deps-dev): bump typescript from 5.4.5 to 5.5.2
16
+ * build(deps-dev): bump @types/uuid from 9.0.8 to 10.0.0
17
+ * build(deps-dev): bump @types/node from 18.19.38 to 18.19.39
18
+ * fix(dev-env): ensure that URLs suggested for replacement start with `http(s)://`
19
+ * Remove unnecessary y/N choice for confirmations
20
+ * Update the vip app command to follow the VIP-CLI style guide
21
+ * Add retries to the fetching of jobs data
22
+
23
+ **Full Changelog**: https://github.com/Automattic/vip-cli/compare/3.4.1...3.4.2
24
+
3
25
  ### 3.4.1
4
26
 
5
27
  * Updating vip cache commands descriptions and examples to follow the VIP-CLI style guide
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@automattic/vip",
3
- "version": "3.4.2",
3
+ "version": "3.5.1",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@automattic/vip",
9
- "version": "3.4.2",
9
+ "version": "3.5.1",
10
10
  "hasInstallScript": true,
11
11
  "license": "MIT",
12
12
  "dependencies": {
@@ -108,7 +108,7 @@
108
108
  "vip-wp": "dist/bin/vip-wp.js"
109
109
  },
110
110
  "devDependencies": {
111
- "@automattic/eslint-plugin-wpvip": "0.11.0",
111
+ "@automattic/eslint-plugin-wpvip": "0.12.0",
112
112
  "@babel/cli": "7.24.7",
113
113
  "@babel/core": "7.24.7",
114
114
  "@babel/preset-env": "7.24.7",
@@ -206,9 +206,9 @@
206
206
  }
207
207
  },
208
208
  "node_modules/@automattic/eslint-plugin-wpvip": {
209
- "version": "0.11.0",
210
- "resolved": "https://registry.npmjs.org/@automattic/eslint-plugin-wpvip/-/eslint-plugin-wpvip-0.11.0.tgz",
211
- "integrity": "sha512-GfSGo2KbrRSPmmklL5YRiVONCFDQidF6agv7x9xU8UEmEw6jPNgndrD4yO7KCoEXX4OUYRDi9bZx1afky1TYng==",
209
+ "version": "0.12.0",
210
+ "resolved": "https://registry.npmjs.org/@automattic/eslint-plugin-wpvip/-/eslint-plugin-wpvip-0.12.0.tgz",
211
+ "integrity": "sha512-ARF+Nj0HBHeaTPoWDA+BynaEergBrtHKDoYqIHtLWJEe7xMNRedB3Q4+lo1OuTZGA3ggBwMmOy5OU0izQwPpog==",
212
212
  "dev": true,
213
213
  "dependencies": {
214
214
  "@babel/eslint-parser": "7.24.5",
@@ -12643,9 +12643,9 @@
12643
12643
  }
12644
12644
  },
12645
12645
  "node_modules/typescript": {
12646
- "version": "5.5.2",
12647
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.2.tgz",
12648
- "integrity": "sha512-NcRtPEOsPFFWjobJEtfihkLCZCXZt/os3zf8nTxjVH3RvTSxjrCamJpbExGvYOF+tFHc3pA65qpdwPbzjohhew==",
12646
+ "version": "5.5.3",
12647
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.3.tgz",
12648
+ "integrity": "sha512-/hreyEujaB0w76zKo6717l3L0o/qEUtRgdvUBvlkhoWeOVMjMuHNHk0BRBzikzuGDqNmPQbg5ifMEqsHLiIUcQ==",
12649
12649
  "dev": true,
12650
12650
  "bin": {
12651
12651
  "tsc": "bin/tsc",
@@ -13585,9 +13585,9 @@
13585
13585
  }
13586
13586
  },
13587
13587
  "@automattic/eslint-plugin-wpvip": {
13588
- "version": "0.11.0",
13589
- "resolved": "https://registry.npmjs.org/@automattic/eslint-plugin-wpvip/-/eslint-plugin-wpvip-0.11.0.tgz",
13590
- "integrity": "sha512-GfSGo2KbrRSPmmklL5YRiVONCFDQidF6agv7x9xU8UEmEw6jPNgndrD4yO7KCoEXX4OUYRDi9bZx1afky1TYng==",
13588
+ "version": "0.12.0",
13589
+ "resolved": "https://registry.npmjs.org/@automattic/eslint-plugin-wpvip/-/eslint-plugin-wpvip-0.12.0.tgz",
13590
+ "integrity": "sha512-ARF+Nj0HBHeaTPoWDA+BynaEergBrtHKDoYqIHtLWJEe7xMNRedB3Q4+lo1OuTZGA3ggBwMmOy5OU0izQwPpog==",
13591
13591
  "dev": true,
13592
13592
  "requires": {
13593
13593
  "@babel/eslint-parser": "7.24.5",
@@ -22653,9 +22653,9 @@
22653
22653
  }
22654
22654
  },
22655
22655
  "typescript": {
22656
- "version": "5.5.2",
22657
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.2.tgz",
22658
- "integrity": "sha512-NcRtPEOsPFFWjobJEtfihkLCZCXZt/os3zf8nTxjVH3RvTSxjrCamJpbExGvYOF+tFHc3pA65qpdwPbzjohhew==",
22656
+ "version": "5.5.3",
22657
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.3.tgz",
22658
+ "integrity": "sha512-/hreyEujaB0w76zKo6717l3L0o/qEUtRgdvUBvlkhoWeOVMjMuHNHk0BRBzikzuGDqNmPQbg5ifMEqsHLiIUcQ==",
22659
22659
  "dev": true
22660
22660
  },
22661
22661
  "typical": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/vip",
3
- "version": "3.4.2",
3
+ "version": "3.5.1",
4
4
  "description": "The VIP Javascript library & CLI",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -107,7 +107,7 @@
107
107
  },
108
108
  "homepage": "https://github.com/Automattic/vip#readme",
109
109
  "devDependencies": {
110
- "@automattic/eslint-plugin-wpvip": "0.11.0",
110
+ "@automattic/eslint-plugin-wpvip": "0.12.0",
111
111
  "@babel/cli": "7.24.7",
112
112
  "@babel/core": "7.24.7",
113
113
  "@babel/preset-env": "7.24.7",