From 590fa895ee9bdd30d148fd35462e749c4e649933 Mon Sep 17 00:00:00 2001 From: Andrea Grassi Date: Wed, 6 Nov 2024 15:36:16 +0100 Subject: [PATCH 01/22] Add a dedicated error message for when a token is marked as disabled due to inactivity --- src/lib/api.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/lib/api.ts b/src/lib/api.ts index 142b72079..396400973 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -37,10 +37,13 @@ export default function API( { } = {} ): ApolloClient< NormalizedCacheObject > { const errorLink = onError( ( { networkError, graphQLErrors } ) => { if ( networkError && 'statusCode' in networkError && networkError.statusCode === 401 ) { - console.error( - chalk.red( 'Unauthorized:' ), - 'You are unauthorized to perform this request, please logout with `vip logout` then try again.' - ); + let message = + 'You are unauthorized to perform this request, please logout with `vip logout` then try again.'; + if ( 'result' in networkError && networkError.result?.code === 'token-disabled-inactivity' ) { + message = + 'The configured VIP-CLI token has been disabled due to inactivity, please logout with `vip logout` then try again.'; + } + console.error( chalk.red( 'Unauthorized:' ), message ); process.exit( 1 ); } From 7e1d7a924c30a265b2b6e131c5473e2973b8d0f0 Mon Sep 17 00:00:00 2001 From: Andrea Grassi Date: Mon, 11 Nov 2024 10:08:34 +0100 Subject: [PATCH 02/22] Update src/lib/api.ts Co-authored-by: Mohammad Jangda --- src/lib/api.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/api.ts b/src/lib/api.ts index 396400973..b46a295c7 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -38,7 +38,7 @@ export default function API( { const errorLink = onError( ( { networkError, graphQLErrors } ) => { if ( networkError && 'statusCode' in networkError && networkError.statusCode === 401 ) { let message = - 'You are unauthorized to perform this request, please logout with `vip logout` then try again.'; + 'You are not authorized to perform this request; please logout with `vip logout`, then try again.'; if ( 'result' in networkError && networkError.result?.code === 'token-disabled-inactivity' ) { message = 'The configured VIP-CLI token has been disabled due to inactivity, please logout with `vip logout` then try again.'; From db50310e97bcbdee4c0b2cb4499589787f0ab670 Mon Sep 17 00:00:00 2001 From: Andrea Grassi Date: Mon, 11 Nov 2024 10:08:39 +0100 Subject: [PATCH 03/22] Update src/lib/api.ts Co-authored-by: Mohammad Jangda --- src/lib/api.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/api.ts b/src/lib/api.ts index b46a295c7..a4571d088 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -41,7 +41,7 @@ export default function API( { 'You are not authorized to perform this request; please logout with `vip logout`, then try again.'; if ( 'result' in networkError && networkError.result?.code === 'token-disabled-inactivity' ) { message = - 'The configured VIP-CLI token has been disabled due to inactivity, please logout with `vip logout` then try again.'; + 'Your token has been disabled due to inactivity; please log out with `vip logout`, then try again.'; } console.error( chalk.red( 'Unauthorized:' ), message ); process.exit( 1 ); From 0d8eefed9cf6d6ce5729ca0d2b0eb88b2f1ed57e Mon Sep 17 00:00:00 2001 From: Andrea Grassi Date: Thu, 14 Nov 2024 12:57:45 +0100 Subject: [PATCH 04/22] use Typescript type guards in a dedicate function to check if networkError is a ServerError type --- src/lib/api.ts | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/lib/api.ts b/src/lib/api.ts index a4571d088..677fbdce0 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -6,7 +6,9 @@ import { } from '@apollo/client/core'; import { setContext } from '@apollo/client/link/context'; import { ApolloLink } from '@apollo/client/link/core'; -import { onError } from '@apollo/client/link/error'; +import { ErrorResponse, onError } from '@apollo/client/link/error'; +import { ServerError } from '@apollo/client/link/utils'; + import chalk from 'chalk'; import http from './api/http'; @@ -30,6 +32,15 @@ export function enableGlobalGraphQLErrorHandling(): void { globalGraphQLErrorHandlingEnabled = true; } +function isServerError( + networkError: ErrorResponse[ 'networkError' ] +): networkError is ServerError { + if ( ! networkError ) { + return false; + } + return 'result' in networkError; +} + export default function API( { exitOnError = true, }: { @@ -39,7 +50,10 @@ export default function API( { if ( networkError && 'statusCode' in networkError && networkError.statusCode === 401 ) { let message = 'You are not authorized to perform this request; please logout with `vip logout`, then try again.'; - if ( 'result' in networkError && networkError.result?.code === 'token-disabled-inactivity' ) { + if ( + isServerError( networkError ) && + networkError.result?.code === 'token-disabled-inactivity' + ) { message = 'Your token has been disabled due to inactivity; please log out with `vip logout`, then try again.'; } From 733f58e09c82beee4ec53a967e357b5464953ad0 Mon Sep 17 00:00:00 2001 From: Andrea Grassi Date: Thu, 14 Nov 2024 15:06:39 +0100 Subject: [PATCH 05/22] remove empty line --- src/lib/api.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lib/api.ts b/src/lib/api.ts index 677fbdce0..0b5bc25e5 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -8,7 +8,6 @@ import { setContext } from '@apollo/client/link/context'; import { ApolloLink } from '@apollo/client/link/core'; import { ErrorResponse, onError } from '@apollo/client/link/error'; import { ServerError } from '@apollo/client/link/utils'; - import chalk from 'chalk'; import http from './api/http'; From 730c6c5ba0b2598bb4f6bc91dbf262f2e4a58cfa Mon Sep 17 00:00:00 2001 From: Volodymyr Kolesnykov Date: Sat, 23 Nov 2024 00:32:51 +0200 Subject: [PATCH 06/22] feat(dev-env): add support for PHP 8.4 --- src/lib/constants/dev-environment.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lib/constants/dev-environment.ts b/src/lib/constants/dev-environment.ts index b423d251d..b1dbbb42c 100644 --- a/src/lib/constants/dev-environment.ts +++ b/src/lib/constants/dev-environment.ts @@ -37,6 +37,10 @@ export const DEV_ENVIRONMENT_PHP_VERSIONS: Record< string, PhpImage > = { image: 'ghcr.io/automattic/vip-container-images/php-fpm:8.3', label: '8.3', }, + 8.4: { + image: 'ghcr.io/automattic/vip-container-images/php-fpm:8.4', + label: '8.4 (experimental)', + }, } as const; export const DEV_ENVIRONMENT_DEFAULTS = { From 8939a35f0b26eef48042285c82e5fd22d2611973 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Nov 2024 12:51:42 +0000 Subject: [PATCH 07/22] build(deps-dev): bump typescript from 5.6.3 to 5.7.2 Bumps [typescript](https://github.com/microsoft/TypeScript) from 5.6.3 to 5.7.2. - [Release notes](https://github.com/microsoft/TypeScript/releases) - [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml) - [Commits](https://github.com/microsoft/TypeScript/compare/v5.6.3...v5.7.2) --- updated-dependencies: - dependency-name: typescript dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- npm-shrinkwrap.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 933b2dcfa..191855763 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -12278,9 +12278,9 @@ } }, "node_modules/typescript": { - "version": "5.6.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz", - "integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==", + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz", + "integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -22169,9 +22169,9 @@ } }, "typescript": { - "version": "5.6.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz", - "integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==", + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz", + "integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==", "dev": true }, "typical": { From e8fa33b04a2a5328218dc2b00ae6a1f4eb5887e9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 Nov 2024 12:18:49 +0000 Subject: [PATCH 08/22] build(deps-dev): bump @types/node from 22.9.1 to 22.10.0 Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 22.9.1 to 22.10.0. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- npm-shrinkwrap.json | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 933b2dcfa..55f767a3f 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -3618,11 +3618,11 @@ "dev": true }, "node_modules/@types/node": { - "version": "22.9.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.9.1.tgz", - "integrity": "sha512-p8Yy/8sw1caA8CdRIQBG5tiLHmxtQKObCijiAa9Ez+d4+PRffM4054xbju0msf+cvhJpnFEeNjxmVT/0ipktrg==", + "version": "22.10.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.0.tgz", + "integrity": "sha512-XC70cRZVElFHfIUB40FgZOBbgJYFKKMa5nb9lxcwYstFG/Mi+/Y0bGS+rs6Dmhmkpq4pnNiLiuZAbc02YCOnmA==", "dependencies": { - "undici-types": "~6.19.8" + "undici-types": "~6.20.0" } }, "node_modules/@types/node-fetch": { @@ -12314,9 +12314,9 @@ } }, "node_modules/undici-types": { - "version": "6.19.8", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", - "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==" + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", + "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==" }, "node_modules/unicode-canonical-property-names-ecmascript": { "version": "2.0.1", @@ -15878,11 +15878,11 @@ "dev": true }, "@types/node": { - "version": "22.9.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.9.1.tgz", - "integrity": "sha512-p8Yy/8sw1caA8CdRIQBG5tiLHmxtQKObCijiAa9Ez+d4+PRffM4054xbju0msf+cvhJpnFEeNjxmVT/0ipktrg==", + "version": "22.10.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.0.tgz", + "integrity": "sha512-XC70cRZVElFHfIUB40FgZOBbgJYFKKMa5nb9lxcwYstFG/Mi+/Y0bGS+rs6Dmhmkpq4pnNiLiuZAbc02YCOnmA==", "requires": { - "undici-types": "~6.19.8" + "undici-types": "~6.20.0" } }, "@types/node-fetch": { @@ -22192,9 +22192,9 @@ } }, "undici-types": { - "version": "6.19.8", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", - "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==" + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", + "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==" }, "unicode-canonical-property-names-ecmascript": { "version": "2.0.1", From 93e36a55001abde58dcbd3b3d593c7e3f84539b7 Mon Sep 17 00:00:00 2001 From: Rinat K Date: Tue, 26 Nov 2024 10:31:32 -0600 Subject: [PATCH 09/22] Set the mount path for vip-config to ABSPATH/vip-config to match production (#2124) --- assets/dev-env.lando.template.yml.ejs | 4 ++-- src/lib/constants/dev-environment.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/dev-env.lando.template.yml.ejs b/assets/dev-env.lando.template.yml.ejs index 5b9915078..b7ab57bac 100644 --- a/assets/dev-env.lando.template.yml.ejs +++ b/assets/dev-env.lando.template.yml.ejs @@ -332,7 +332,7 @@ tooling: nocopy: true - type: volume source: clientcode_vipconfig - target: /wp/wp-content/vip-config + target: /wp/vip-config volume: nocopy: true <% } else { %> @@ -342,6 +342,6 @@ tooling: - <%= appCode.dir %>/plugins:/wp/wp-content/plugins - <%= appCode.dir %>/private:/wp/wp-content/private - <%= appCode.dir %>/themes:/wp/wp-content/themes - - <%= appCode.dir %>/vip-config:/wp/wp-content/vip-config + - <%= appCode.dir %>/vip-config:/wp/vip-config <% } %> <% } %> diff --git a/src/lib/constants/dev-environment.ts b/src/lib/constants/dev-environment.ts index b1dbbb42c..a00b9979f 100644 --- a/src/lib/constants/dev-environment.ts +++ b/src/lib/constants/dev-environment.ts @@ -49,4 +49,4 @@ export const DEV_ENVIRONMENT_DEFAULTS = { phpVersion: Object.keys( DEV_ENVIRONMENT_PHP_VERSIONS )[ 0 ], } as const; -export const DEV_ENVIRONMENT_VERSION = '2.1.1'; +export const DEV_ENVIRONMENT_VERSION = '2.1.2'; From 17662a8fcf8d4892565abeb786cf48989f507053 Mon Sep 17 00:00:00 2001 From: owen-cole Date: Sat, 23 Nov 2024 14:34:02 -0500 Subject: [PATCH 10/22] Add --format="text" option to vip logs --- src/bin/vip-logs.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/bin/vip-logs.js b/src/bin/vip-logs.js index 7b0ff786a..6db11d162 100755 --- a/src/bin/vip-logs.js +++ b/src/bin/vip-logs.js @@ -14,7 +14,7 @@ const LIMIT_MIN = 1; const LIMIT_MAX = 5000; const LIMIT_DEFAULT = 500; const ALLOWED_TYPES = [ 'app', 'batch' ]; -const ALLOWED_FORMATS = [ 'csv', 'json', 'table' ]; +const ALLOWED_FORMATS = [ 'csv', 'json', 'table', 'text' ]; const DEFAULT_POLLING_DELAY_IN_SECONDS = 30; const MIN_POLLING_DELAY_IN_SECONDS = 5; const MAX_POLLING_DELAY_IN_SECONDS = 300; @@ -179,6 +179,12 @@ function printLogs( logs, format ) { } output = table.toString(); + } else if ( format && 'text' === format ) { + const rows = []; + for ( const { timestamp, message } of logs ) { + rows.push( `${ timestamp } ${ message }` ); + output = rows.join( '\n' ); + } } else { output = formatData( logs, format ); } From 09ead6c57ec19d7511d12f3c6c070aa92a5846d0 Mon Sep 17 00:00:00 2001 From: owen-cole Date: Sat, 23 Nov 2024 14:47:09 -0500 Subject: [PATCH 11/22] update help docs --- src/bin/vip-logs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/vip-logs.js b/src/bin/vip-logs.js index 6db11d162..c9264ce1a 100755 --- a/src/bin/vip-logs.js +++ b/src/bin/vip-logs.js @@ -249,7 +249,7 @@ command( { `The maximum number of entries to return. Accepts an integer value between 1 and 5000 (defaults to ${ LIMIT_DEFAULT }).` ) .option( 'follow', 'Output new entries as they are generated.' ) - .option( 'format', 'Render output in a particular format. Accepts “csv”, and “json”.', 'table' ) + .option( 'format', 'Render output in a particular format. Accepts “csv”, “json” and “text”.', 'table' ) .examples( [ { usage: 'vip @example-app.production logs', From 8f2e717984f04885d8addda0c0fc2e3b78e0d8c3 Mon Sep 17 00:00:00 2001 From: owen-cole Date: Sat, 23 Nov 2024 14:58:47 -0500 Subject: [PATCH 12/22] add oxford comma in help output --- src/bin/vip-logs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/vip-logs.js b/src/bin/vip-logs.js index c9264ce1a..a59f48e48 100755 --- a/src/bin/vip-logs.js +++ b/src/bin/vip-logs.js @@ -249,7 +249,7 @@ command( { `The maximum number of entries to return. Accepts an integer value between 1 and 5000 (defaults to ${ LIMIT_DEFAULT }).` ) .option( 'follow', 'Output new entries as they are generated.' ) - .option( 'format', 'Render output in a particular format. Accepts “csv”, “json” and “text”.', 'table' ) + .option( 'format', 'Render output in a particular format. Accepts “csv”, “json”, and “text”.', 'table' ) .examples( [ { usage: 'vip @example-app.production logs', From c1cddcec0fb1b00dc37cb932e306b2f8d4d4052a Mon Sep 17 00:00:00 2001 From: Volodymyr Kolesnykov Date: Sun, 24 Nov 2024 21:17:34 +0200 Subject: [PATCH 13/22] fix: simplify `if` conditions --- src/bin/vip-logs.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bin/vip-logs.js b/src/bin/vip-logs.js index a59f48e48..28e7e09e4 100755 --- a/src/bin/vip-logs.js +++ b/src/bin/vip-logs.js @@ -148,7 +148,7 @@ function printLogs( logs, format ) { } ); let output = ''; - if ( format && 'table' === format ) { + if ( 'table' === format ) { const options = { wordWrap: true, wrapOnWordBoundary: true, @@ -179,7 +179,7 @@ function printLogs( logs, format ) { } output = table.toString(); - } else if ( format && 'text' === format ) { + } else if ( 'text' === format ) { const rows = []; for ( const { timestamp, message } of logs ) { rows.push( `${ timestamp } ${ message }` ); From c4fa85ae00e80b37f881d528f32b1a8b902a7ae5 Mon Sep 17 00:00:00 2001 From: Volodymyr Kolesnykov Date: Tue, 26 Nov 2024 19:15:47 +0200 Subject: [PATCH 14/22] test: fix tests --- __tests__/bin/vip-logs.js | 2 +- src/bin/vip-logs.js | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/__tests__/bin/vip-logs.js b/__tests__/bin/vip-logs.js index 971572068..0d9e6d1dc 100644 --- a/__tests__/bin/vip-logs.js +++ b/__tests__/bin/vip-logs.js @@ -308,7 +308,7 @@ describe( 'getLogs', () => { expect( exit.withError ).toHaveBeenCalledTimes( 1 ); expect( exit.withError ).toHaveBeenCalledWith( - 'Invalid format: jso. The supported formats are: csv, json, table.' + 'Invalid format: jso. The supported formats are: csv, json, table, text.' ); expect( logsLib.getRecentLogs ).not.toHaveBeenCalled(); diff --git a/src/bin/vip-logs.js b/src/bin/vip-logs.js index 28e7e09e4..2d3b77045 100755 --- a/src/bin/vip-logs.js +++ b/src/bin/vip-logs.js @@ -249,7 +249,11 @@ command( { `The maximum number of entries to return. Accepts an integer value between 1 and 5000 (defaults to ${ LIMIT_DEFAULT }).` ) .option( 'follow', 'Output new entries as they are generated.' ) - .option( 'format', 'Render output in a particular format. Accepts “csv”, “json”, and “text”.', 'table' ) + .option( + 'format', + 'Render output in a particular format. Accepts “csv”, “json”, and “text”.', + 'table' + ) .examples( [ { usage: 'vip @example-app.production logs', From 70e744afb6c026e96bbd1ce2fa795674096bca4b Mon Sep 17 00:00:00 2001 From: Volodymyr Kolesnykov Date: Sat, 23 Nov 2024 00:57:57 +0200 Subject: [PATCH 15/22] docs: update changelog --- docs/CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 454f6ef64..52484686f 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,5 +1,11 @@ ## Changelog +### 3.9.0 + +* feat(dev-env): add support for PHP 8.4 + +**Full Changelog**: https://github.com/Automattic/vip-cli/compare/3.8.8...3.9.0 + ### 3.8.8 * build(deps-dev): bump @types/dockerode from 3.3.31 to 3.3.32 From 03a13cda8e0a5d77fba27cffa139c12fbb159692 Mon Sep 17 00:00:00 2001 From: Rinat K Date: Tue, 26 Nov 2024 10:34:30 -0600 Subject: [PATCH 16/22] Update changelog to mention vip-config --- docs/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 52484686f..0468d444c 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -3,6 +3,7 @@ ### 3.9.0 * feat(dev-env): add support for PHP 8.4 +* Change mount path for vip-config from WP_CONTENT_DIR to ABSPATH **Full Changelog**: https://github.com/Automattic/vip-cli/compare/3.8.8...3.9.0 From 91c7a836cd70cc28006ab59cd6124bf42ebb50ef Mon Sep 17 00:00:00 2001 From: Volodymyr Kolesnykov Date: Tue, 26 Nov 2024 19:09:44 +0200 Subject: [PATCH 17/22] docs: update changelog --- docs/CHANGELOG.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 0468d444c..ca71853ef 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -3,7 +3,11 @@ ### 3.9.0 * feat(dev-env): add support for PHP 8.4 -* Change mount path for vip-config from WP_CONTENT_DIR to ABSPATH +* Provide dedicated error message for when a token is marked as disabled due to inactivity +* Set the mount path for vip-config to ABSPATH/vip-config to match production +* Add --format="text" option to vip logs +* build(deps-dev): bump typescript from 5.6.3 to 5.7.2 +* build(deps-dev): bump @types/node from 22.9.1 to 22.10.0 **Full Changelog**: https://github.com/Automattic/vip-cli/compare/3.8.8...3.9.0 @@ -61,7 +65,7 @@ * build(deps): bump uuid from 11.0.2 to 11.0.3 * Update socket error handler * Fix --limit arg handling in vip logs command -* New package release: v3.9.0 by +* New package release: v3.9.0 by * Revert "New package release: v3.9.0" * chore(deps): update Lando to 6ca2668 * fix: `table` format output @@ -158,7 +162,7 @@ * build(deps-dev): bump @babel/core from 7.24.8 to 7.24.9 in the babel group * build(deps-dev): bump @types/dockerode from 3.3.29 to 3.3.30 * update: media import validate-files - + **Full Changelog**: https://github.com/Automattic/vip-cli/compare/3.6.0...3.7.0 ### 3.6.0 From ad04b3c7b28d6f9f56418186f2360045406be59e Mon Sep 17 00:00:00 2001 From: WordPress VIP Bot <22917138+wpcomvip-bot@users.noreply.github.com> Date: Tue, 26 Nov 2024 17:42:14 +0000 Subject: [PATCH 18/22] chore: bump package version to v3.9.0 --- npm-shrinkwrap.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 8c137f3b4..c6236b53f 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,12 +1,12 @@ { "name": "@automattic/vip", - "version": "3.8.9-dev.0", + "version": "3.9.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@automattic/vip", - "version": "3.8.9-dev.0", + "version": "3.9.0", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 338a3d037..941545bde 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@automattic/vip", - "version": "3.8.9-dev.0", + "version": "3.9.0", "description": "The VIP Javascript library & CLI", "main": "index.js", "bin": { From 8b0f2f206f85c3ac2e143107441b2759ae8f6720 Mon Sep 17 00:00:00 2001 From: WordPress VIP Bot <22917138+wpcomvip-bot@users.noreply.github.com> Date: Tue, 26 Nov 2024 17:44:40 +0000 Subject: [PATCH 19/22] chore: bump to next prepatch: (v3.9.1-dev.0) --- npm-shrinkwrap.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index c6236b53f..69bec6b5a 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,12 +1,12 @@ { "name": "@automattic/vip", - "version": "3.9.0", + "version": "3.9.1-dev.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@automattic/vip", - "version": "3.9.0", + "version": "3.9.1-dev.0", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 941545bde..f61c3361a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@automattic/vip", - "version": "3.9.0", + "version": "3.9.1-dev.0", "description": "The VIP Javascript library & CLI", "main": "index.js", "bin": { From ccb5cef67808be260651bf3f9a8a8b1585dea0d0 Mon Sep 17 00:00:00 2001 From: Roberson Gomes Date: Wed, 27 Nov 2024 11:09:23 -0300 Subject: [PATCH 20/22] Add a warning on `vip export` when exporting a MyDumper SQL dump --- src/commands/export-sql.generated.d.ts | 2 ++ src/commands/export-sql.ts | 23 +++++++++++++++++++++-- src/graphqlTypes.d.ts | 1 + 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/commands/export-sql.generated.d.ts b/src/commands/export-sql.generated.d.ts index b07e15857..9071620dc 100644 --- a/src/commands/export-sql.generated.d.ts +++ b/src/commands/export-sql.generated.d.ts @@ -13,12 +13,14 @@ export type AppBackupAndJobStatusQuery = { environments?: Array< { __typename?: 'AppEnvironment'; id?: number | null; + backupsSqlDumpTool?: string | null; latestBackup?: { __typename?: 'Backup'; id?: number | null; type?: string | null; size?: number | null; filename?: string | null; + sqlDumpTool?: string | null; createdAt?: string | null; } | null; jobs?: Array< diff --git a/src/commands/export-sql.ts b/src/commands/export-sql.ts index f69705736..26f7c2b76 100644 --- a/src/commands/export-sql.ts +++ b/src/commands/export-sql.ts @@ -33,11 +33,13 @@ const BACKUP_AND_JOB_STATUS_QUERY = gql` id environments(id: $envId) { id + backupsSqlDumpTool latestBackup { id type size filename + sqlDumpTool createdAt } jobs(jobTypes: [db_backup_copy]) { @@ -98,6 +100,7 @@ async function fetchLatestBackupAndJobStatusBase( ): Promise< { latestBackup: Backup | undefined; jobs: Job[]; + envSqlDumpTool: string | null | undefined; } > { const api = API(); @@ -108,11 +111,12 @@ async function fetchLatestBackupAndJobStatusBase( } ); const environments = response.data.app?.environments; + const envSqlDumpTool = environments?.[ 0 ]?.backupsSqlDumpTool; const latestBackup: Backup | undefined = environments?.[ 0 ]?.latestBackup as Backup; const jobs: Job[] = ( environments?.[ 0 ]?.jobs || [] ) as Job[]; - return { latestBackup, jobs }; + return { latestBackup, jobs, envSqlDumpTool }; } async function fetchLatestBackupAndJobStatus( @@ -412,7 +416,10 @@ export class ExportSQLCommand { await this.runBackupJob(); } - const { latestBackup } = await fetchLatestBackupAndJobStatus( this.app.id, this.env.id ); + const { latestBackup, envSqlDumpTool } = await fetchLatestBackupAndJobStatus( + this.app.id, + this.env.id + ); if ( ! latestBackup ) { await this.track( 'error', { @@ -436,6 +443,18 @@ export class ExportSQLCommand { ); } + const showMyDumperWarning = ( latestBackup.sqlDumpTool ?? envSqlDumpTool ) === 'mydumper'; + if ( showMyDumperWarning ) { + console.warn( + chalk.yellow.bold( 'WARNING:' ), + chalk.yellow( + 'This is a large or complex database. The backup file for this database is generated with MyDumper. ' + + 'The file can only be loaded with MyLoader. ' + + 'For more information: https://github.com/mydumper/mydumper' + ) + ); + } + if ( await this.getExportJob() ) { console.log( `Attaching to an existing export for the backup with timestamp ${ latestBackup.createdAt }` diff --git a/src/graphqlTypes.d.ts b/src/graphqlTypes.d.ts index 3161da2ea..835d39edb 100644 --- a/src/graphqlTypes.d.ts +++ b/src/graphqlTypes.d.ts @@ -1186,6 +1186,7 @@ export type Backup = { filename?: Maybe< Scalars[ 'String' ][ 'output' ] >; id?: Maybe< Scalars[ 'Float' ][ 'output' ] >; size?: Maybe< Scalars[ 'Float' ][ 'output' ] >; + sqlDumpTool?: Maybe< Scalars[ 'String' ][ 'output' ] >; type?: Maybe< Scalars[ 'String' ][ 'output' ] >; }; From 046ce189af1dbebf48286f297850e305eeb44b8e Mon Sep 17 00:00:00 2001 From: Volodymyr Kolesnykov Date: Wed, 27 Nov 2024 16:22:04 +0200 Subject: [PATCH 21/22] fix: make the help text for the `format` option consistent for all commands --- src/bin/vip-app-list.js | 2 +- src/bin/vip-logs.js | 3 +-- src/bin/vip-slowlogs.ts | 3 +-- src/bin/vip-validate-preflight.js | 2 +- src/lib/cli/command.js | 7 +++++-- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/bin/vip-app-list.js b/src/bin/vip-app-list.js index 4c08fc251..df21a56ff 100755 --- a/src/bin/vip-app-list.js +++ b/src/bin/vip-app-list.js @@ -8,7 +8,7 @@ import { trackEvent } from '../lib/tracker'; const baseUsage = 'vip app list'; -command( { format: true, usage: baseUsage } ) +command( { usage: baseUsage } ) .examples( [ { usage: diff --git a/src/bin/vip-logs.js b/src/bin/vip-logs.js index 2d3b77045..c93e58c43 100755 --- a/src/bin/vip-logs.js +++ b/src/bin/vip-logs.js @@ -251,8 +251,7 @@ command( { .option( 'follow', 'Output new entries as they are generated.' ) .option( 'format', - 'Render output in a particular format. Accepts “csv”, “json”, and “text”.', - 'table' + 'Render output in a particular format. Accepts “table“ (default), “csv“, “json“, and “text”.' ) .examples( [ { diff --git a/src/bin/vip-slowlogs.ts b/src/bin/vip-slowlogs.ts index 4b84f897c..f2a8652c2 100755 --- a/src/bin/vip-slowlogs.ts +++ b/src/bin/vip-slowlogs.ts @@ -190,7 +190,7 @@ void command( { appContext: true, appQuery, envContext: true, - format: false, + format: true, module: 'slowlogs', usage: baseUsage, } ) @@ -199,7 +199,6 @@ void command( { 'Set the maximum number of log entries. Accepts an integer value between 1 and 500.', 500 ) - .option( 'format', 'Render output in a particular format. Accepts “csv”, and “json”.', 'table' ) .examples( [ { description: diff --git a/src/bin/vip-validate-preflight.js b/src/bin/vip-validate-preflight.js index 7318ccab4..658da1aca 100755 --- a/src/bin/vip-validate-preflight.js +++ b/src/bin/vip-validate-preflight.js @@ -560,6 +560,7 @@ function sanitizeArgsForTracking( args ) { let commandOpts = { module: 'harmonia', + format: true, }; // The @app.env selector is optional, so we need to check if it was passed @@ -601,7 +602,6 @@ command( commandOpts ) [ '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( [ { diff --git a/src/lib/cli/command.js b/src/lib/cli/command.js index 5d3138f4f..875911ab1 100644 --- a/src/lib/cli/command.js +++ b/src/lib/cli/command.js @@ -67,6 +67,10 @@ args.argv = async function ( argv, cb ) { debug: false, } ); + if ( _opts.format && ! options.format ) { + options.format = 'table'; + } + if ( options.h || options.help ) { this.showHelp(); } @@ -603,8 +607,7 @@ export default function ( opts ) { if ( _opts.format ) { args.option( 'format', - 'Render output in a particular format. Accepts “csv”, and “json”.', - 'table' + 'Render output in a particular format. Accepts “table“ (default), “csv“, and “json“.' ); } From 5820a1c9cbcb439141ef7317a45a8a9a54886781 Mon Sep 17 00:00:00 2001 From: Volodymyr Kolesnykov Date: Wed, 27 Nov 2024 19:05:08 +0200 Subject: [PATCH 22/22] fix: wrong file --- src/bin/vip-app-list.js | 2 +- src/bin/vip-app.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bin/vip-app-list.js b/src/bin/vip-app-list.js index df21a56ff..4c08fc251 100755 --- a/src/bin/vip-app-list.js +++ b/src/bin/vip-app-list.js @@ -8,7 +8,7 @@ import { trackEvent } from '../lib/tracker'; const baseUsage = 'vip app list'; -command( { usage: baseUsage } ) +command( { format: true, usage: baseUsage } ) .examples( [ { usage: diff --git a/src/bin/vip-app.js b/src/bin/vip-app.js index f1aab251f..8c4efc97d 100755 --- a/src/bin/vip-app.js +++ b/src/bin/vip-app.js @@ -6,7 +6,7 @@ import app from '../lib/api/app'; import command, { getEnvIdentifier } from '../lib/cli/command'; import { trackEvent } from '../lib/tracker'; -command( { requiredArgs: 1, format: true } ) +command( { requiredArgs: 1 } ) .example( 'vip app list', 'Retrieve a list of applications that can be accessed by the current authenticated VIP-CLI user.'