@automattic/vip 3.8.5 → 3.8.7

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.
@@ -19,7 +19,7 @@ var _tracker = require("../lib/tracker");
19
19
  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); }
20
20
  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 && {}.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; }
21
21
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
22
- const ALLOWED_NODEJS_VERSIONS = ['14', '16', '18'];
22
+ const ALLOWED_NODEJS_VERSIONS = ['18', '20', '22'];
23
23
  const appQuery = exports.appQuery = `
24
24
  id
25
25
  name
@@ -42,7 +42,7 @@ const appQuery = exports.appQuery = `
42
42
  }
43
43
  `;
44
44
  let suppressOutput = false;
45
- let outputJson = false;
45
+ let outputFormat = 'table';
46
46
  let harmoniaArgs = [];
47
47
 
48
48
  /**
@@ -321,7 +321,7 @@ async function handleResults(harmonia, results) {
321
321
  });
322
322
 
323
323
  // If the output is JSON, reenable the logToConsole output and print-out the json format.
324
- if (outputJson) {
324
+ if (outputFormat === 'json') {
325
325
  suppressOutput = false;
326
326
  logToConsole(harmonia.resultsJSON());
327
327
  process.exit(0);
@@ -383,9 +383,9 @@ async function validateArgs(opt) {
383
383
  }
384
384
 
385
385
  // If the JSON option is enabled, all the stdout should be suppressed to prevent polluting the output.
386
- if (opt.json) {
386
+ if (opt.format === 'json') {
387
387
  suppressOutput = true;
388
- outputJson = true;
388
+ outputFormat = 'json';
389
389
  }
390
390
  if (opt.app) {
391
391
  // Get build information from API and store it in the env object
@@ -459,10 +459,10 @@ if (parsedAlias.app) {
459
459
  } else {
460
460
  logToConsole(_chalk.default.bold.yellow('Warning: ') + 'The preflight tests are running without a provided application and/or environment.\n' + 'Some app-dependent configurations, such as environment variables, might not defined.');
461
461
  }
462
- (0, _command.default)(commandOpts).option('verbose', 'Increase logging level to include app build and server boot up messages', false).option('node-version', 'Select a specific target Node.JS version in semver format (MAJOR.MINOR.PATCH) or a MAJOR').option('wait', 'Configure the time to wait in ms for the app to boot up. Do not change unless you have issues', 3000).option(['p', 'port'], 'Configure the port to use for the app (defaults to a random port between 3001 and 3999)').option('json', 'Output the results as JSON', false).option(['P', 'path'], 'Path to the app to be tested', process.cwd()).examples([{
462
+ (0, _command.default)(commandOpts).option('verbose', 'Increase logging level to include app build and server boot up messages', false).option('node-version', `Select a specific target Node.JS version in semver format (MAJOR.MINOR.PATCH) or a MAJOR (${ALLOWED_NODEJS_VERSIONS.join(', ')})`).option('wait', 'Configure the time to wait in ms for the app to boot up. Do not change unless you have issues', 3000).option(['p', 'port'], 'Configure the port to use for the app (defaults to a random port between 3001 and 3999)').option('format', 'Output the log lines in CSV or JSON format', 'table').option(['P', 'path'], 'Path to the app to be tested', process.cwd()).examples([{
463
463
  usage: 'vip @mysite.production validate preflight',
464
464
  description: 'Runs the preflight tests to validate if your application is ready to be deployed to VIP Go'
465
465
  }, {
466
- usage: 'vip @mysite.production validate preflight --json > results.json',
466
+ usage: 'vip @mysite.production validate preflight --format json > results.json',
467
467
  description: 'Runs the preflight tests, but output the results in JSON format, and redirect the output to a file'
468
468
  }]).argv(process.argv, vipValidatePreflightCommand);
@@ -213,6 +213,20 @@ class DevEnvSyncSQLCommand {
213
213
  if (!networkSites) {
214
214
  return;
215
215
  }
216
+ const prologue = `
217
+ DROP PROCEDURE IF EXISTS vip_sync_update_blog_domains;
218
+ DELIMITER $$
219
+ CREATE PROCEDURE vip_sync_update_blog_domains()
220
+ BEGIN
221
+ IF EXISTS (SELECT * FROM information_schema.tables WHERE table_schema = 'wordpress' AND table_name = 'wp_blogs') THEN
222
+ `;
223
+ const epilogue = `
224
+ END IF;
225
+ END$$
226
+ DELIMITER ;
227
+ CALL vip_sync_update_blog_domains();
228
+ DROP PROCEDURE vip_sync_update_blog_domains;
229
+ `;
216
230
  const queries = [];
217
231
  for (const site of networkSites) {
218
232
  if (!site?.blogId || !site?.homeUrl) {
@@ -220,10 +234,11 @@ class DevEnvSyncSQLCommand {
220
234
  }
221
235
  const oldDomain = new URL(site.homeUrl).hostname;
222
236
  const newDomain = site.blogId !== 1 ? `${this.slugifyDomain(oldDomain)}.${this.landoDomain}` : this.landoDomain;
223
- queries.push(`UPDATE wp_blogs SET domain = '${newDomain}' WHERE blog_id = ${Number(site.blogId)};`);
237
+ queries.push(` UPDATE wp_blogs SET domain = '${newDomain}' WHERE blog_id = ${Number(site.blogId)};`);
224
238
  }
225
239
  if (queries.length) {
226
- await _fs.default.promises.appendFile(this.sqlFile, queries.join('\n'));
240
+ const sql = `${prologue}\n${queries.join('\n')}\n${epilogue}`;
241
+ await _fs.default.promises.appendFile(this.sqlFile, sql);
227
242
  }
228
243
  }
229
244
 
@@ -140,17 +140,20 @@ const _optionsForVersion = softwareSettings => {
140
140
  if (option.deprecated) {
141
141
  versionChoices.deprecated.push({
142
142
  message: `${option.version} (deprecated)`,
143
- value: option.version
143
+ value: option.version,
144
+ deprecated: option.deprecated
144
145
  });
145
146
  } else if (option.unstable) {
146
147
  versionChoices.test.push({
147
148
  message: `${option.version} (test)`,
148
- value: option.version
149
+ value: option.version,
150
+ deprecated: option.deprecated
149
151
  });
150
152
  } else {
151
153
  versionChoices.supported.push({
152
154
  message: option.version,
153
- value: option.version
155
+ value: option.version,
156
+ deprecated: option.deprecated
154
157
  });
155
158
  }
156
159
  }
@@ -309,9 +312,9 @@ const formatSoftwareSettings = (softwareSetting, includes, format) => {
309
312
  version
310
313
  };
311
314
  if (includes.includes('available_versions')) {
312
- result.available_versions = _optionsForVersion(softwareSetting).map(option => option.value);
315
+ result.available_versions = _optionsForVersion(softwareSetting).filter(option => !option.deprecated).map(option => option.value);
313
316
  if (format !== 'json') {
314
- result.available_versions = result.available_versions.join(',');
317
+ result.available_versions = result.available_versions.sort().join(',');
315
318
  }
316
319
  }
317
320
  return result;
package/docs/CHANGELOG.md CHANGED
@@ -1,8 +1,19 @@
1
1
  ## Changelog
2
2
 
3
+ ## 3.8.7
4
+
5
+ * fix(dev-env): SQL sync for single sites
6
+
7
+ **Full Changelog**: https://github.com/Automattic/vip-cli/compare/3.8.6...3.8.7
8
+
9
+ ## 3.8.6
10
+
11
+ * Updating Node.js versions and standardize the format
12
+
13
+ **Full Changelog**: https://github.com/Automattic/vip-cli/compare/3.8.5...3.8.6
14
+
3
15
  ## 3.8.5
4
16
 
5
- ## What's Changed
6
17
  * build(deps-dev): bump the babel group with 4 updates
7
18
  * build(deps-dev): bump typescript from 5.6.2 to 5.6.3
8
19
  * Update the sync command to follow the VIP-CLI style guide
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@automattic/vip",
3
- "version": "3.8.5",
3
+ "version": "3.8.7",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@automattic/vip",
9
- "version": "3.8.5",
9
+ "version": "3.8.7",
10
10
  "hasInstallScript": true,
11
11
  "license": "MIT",
12
12
  "dependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/vip",
3
- "version": "3.8.5",
3
+ "version": "3.8.7",
4
4
  "description": "The VIP Javascript library & CLI",
5
5
  "main": "index.js",
6
6
  "bin": {