From 18db83193d251c047c97f4b582a2652aebaafe51 Mon Sep 17 00:00:00 2001 From: Yoli Hodde Date: Wed, 16 Oct 2024 11:46:51 -0700 Subject: [PATCH 1/5] Updates to descriptions --- src/bin/vip-validate-preflight.js | 28 +++++++++++++++------------- src/bin/vip-validate.js | 2 +- src/bin/vip.js | 5 ++++- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/bin/vip-validate-preflight.js b/src/bin/vip-validate-preflight.js index 86f1a8721..017fc6bdf 100755 --- a/src/bin/vip-validate-preflight.js +++ b/src/bin/vip-validate-preflight.js @@ -113,14 +113,14 @@ async function getBuildConfiguration( application, environment ) { console.log( `${ chalk.red( 'Error:' - ) } You don't have the required permissions to run validations for this environment.\n` + + ) } You do not have sufficient permissions to run validations for this environment.\n` + `You must be either be an admin of the ${ chalk.bold.underline( application.organization.name ) } organization, or, alternatively,\n` + `a guest of that organization and an admin of the ${ chalk.bold.underline( application.name ) } application.\n\n` + - 'You can read more about organization and application roles on our documentation:\n' + + 'Read more about organization and application roles in our documentation:\n' + chalk.underline( 'https://docs.wpvip.com/manage-user-access/vip-dashboard/' ) ); @@ -202,7 +202,7 @@ export async function vipValidatePreflightCommand( arg, opt ) { } ); return exit.withError( - `Could not find a 'package.json' in the current folder (${ opt.path }).` + `Could not find a 'package.json' in the current directory (${ opt.path }).` ); } @@ -440,7 +440,7 @@ async function handleResults( harmonia, results ) { `${ chalk.bold.bgRedBright( ' NOT PASS ' ) } There was a critical failure that makes the application ` + - 'incompatible with VIP Go. Please review the results and re-run the tests.' + 'incompatible with the VIP Platform. Please review the results and re-run the tests.' ); process.exit( 1 ); } @@ -453,7 +453,7 @@ async function handleResults( harmonia, results ) { logToConsole( `${ chalk.bold.bgYellow( ' PASS ' - ) } The application has passed the required tests, but it does not follow all the recommendations.` + ) } The application has passed the required tests, but it does not follow all of the recommendations.` ); logToConsole( 'Please review the results.' ); process.exit( 0 ); @@ -464,14 +464,16 @@ async function handleResults( harmonia, results ) { logToConsole( `${ chalk.bold.bgRed( ' NOT PASS ' - ) } The application has failed some tests, and will very likely have problems in a production ` + - 'environment. Please review all the errors found in the results.' + ) } The application has failed some tests, and will very likely have problems on a production ` + + 'environment. Please review all of the errors found in the results.' ); process.exit( 1 ); } logToConsole( - `${ chalk.bold.bgGreen( ' PASS ' ) } Congratulations. The application passes all the tests.` + `${ chalk.bold.bgGreen( + ' PASS ' + ) } Congratulations! The application passes all of the tests.` ); process.exit( 0 ); } @@ -576,23 +578,23 @@ if ( parsedAlias.app ) { logToConsole( chalk.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.' + 'Some app-dependent configurations, such as environment variables, might not be defined.' ); } command( commandOpts ) .option( 'verbose', - 'Increase logging level to include app build and server boot up messages', + 'Increase logging level to include app build and server boot up messages. Prints rows to the console as they are updated.', false ) .option( 'node-version', - 'Select a specific target Node.JS version in semver format (MAJOR.MINOR.PATCH) or a MAJOR' + 'Specify a Node.JS version in semver format (MAJOR.MINOR.PATCH) or a MAJOR (e.g. ).' ) .option( 'wait', - 'Configure the time to wait in ms for the app to boot up. Do not change unless you have issues', + 'Specify an amount of time in milliseconds to wait for the app to boot up. Do not change unless you have issues.', 3000 ) .option( @@ -603,7 +605,7 @@ command( commandOpts ) .option( [ 'P', 'path' ], 'Path to the app to be tested', process.cwd() ) .examples( [ { - usage: 'vip @mysite.production validate preflight', + usage: 'vip @example-node-app.production validate preflight', description: 'Runs the preflight tests to validate if your application is ready to be deployed to VIP Go', }, diff --git a/src/bin/vip-validate.js b/src/bin/vip-validate.js index 85b264853..b9ffa62f9 100755 --- a/src/bin/vip-validate.js +++ b/src/bin/vip-validate.js @@ -8,7 +8,7 @@ command( { } ) .command( 'preflight', - 'Runs preflight tests to validate if your application is ready to be deployed' + 'Scan a Node.js codebase on a local machine for potential issues that could prevent successful building or deploying.' ) .argv( process.argv, async () => { await trackEvent( 'vip_validate_command_execute' ); diff --git a/src/bin/vip.js b/src/bin/vip.js index 0433712b7..51a5fbbc5 100755 --- a/src/bin/vip.js +++ b/src/bin/vip.js @@ -42,7 +42,10 @@ const runCmd = async function () { .command( 'db', "Access an environment's database." ) .command( 'sync', 'Sync the database from production to a non-production environment.' ) .command( 'whoami', 'Retrieve details about the current authenticated VIP-CLI user.' ) - .command( 'validate', 'Validate your VIP application and environment' ) + .command( + 'validate', + 'Scan a Node.js codebase on a local machine for potential issues that could prevent successful building or deploying.' + ) .command( 'wp', 'Run WP CLI commands against an environment' ); cmd.argv( process.argv ); From dfb1a3a0f489afdbdd5959aa6f8a12e5f22ee216 Mon Sep 17 00:00:00 2001 From: Yoli Hodde Date: Thu, 17 Oct 2024 14:38:04 -0700 Subject: [PATCH 2/5] Working through updates to descriptions and examples --- src/bin/vip-validate-preflight.js | 20 +++++++++++++++----- src/bin/vip-validate.js | 2 +- src/bin/vip.js | 5 ++++- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/bin/vip-validate-preflight.js b/src/bin/vip-validate-preflight.js index 017fc6bdf..aea7660dd 100755 --- a/src/bin/vip-validate-preflight.js +++ b/src/bin/vip-validate-preflight.js @@ -590,11 +590,11 @@ command( commandOpts ) ) .option( 'node-version', - 'Specify a Node.JS version in semver format (MAJOR.MINOR.PATCH) or a MAJOR (e.g. ).' + 'Specify a Node.JS version in semver format (MAJOR.MINOR.PATCH) or a MAJOR.' ) .option( 'wait', - 'Specify an amount of time in milliseconds to wait for the app to boot up. Do not change unless you have issues.', + 'Set the number of milliseconds to delay the start of a scan. Only necessary for apps that require a larger amount of time to start.', 3000 ) .option( @@ -607,12 +607,22 @@ command( commandOpts ) { usage: 'vip @example-node-app.production validate preflight', description: - 'Runs the preflight tests to validate if your application is ready to be deployed to VIP Go', + 'Run the validate command from within the local Node.js codebase directory.\n' + + ' * Run the tests with settings that are identical to the targeted VIP Platform environment.', }, { - usage: 'vip @mysite.production validate preflight --json > results.json', + usage: + 'vip @example-node-app.production validate preflight --path=/Users/example/Desktop/example-node-repo', description: - 'Runs the preflight tests, but output the results in JSON format, and redirect the output to a file', + 'Scan a local copy of the Node.js repository from a path on the user\'s local machine named "example-node-repo".', + }, + { + usage: 'vip @example-node-app.production validate preflight --json > results.json', + description: 'Run the scan and output the results to a local file in JSON format.', + }, + { + usage: 'vip @example-node-app.production validate preflight --node-version=18', + description: 'Run the scan and output the results to a local file in JSON format.', }, ] ) .argv( process.argv, vipValidatePreflightCommand ); diff --git a/src/bin/vip-validate.js b/src/bin/vip-validate.js index b9ffa62f9..45fc47d54 100755 --- a/src/bin/vip-validate.js +++ b/src/bin/vip-validate.js @@ -8,7 +8,7 @@ command( { } ) .command( 'preflight', - 'Scan a Node.js codebase on a local machine for potential issues that could prevent successful building or deploying.' + 'Run a full suite of validation tests against a local Node.js codebase to identify potential issues that could prevent successful building or deploying.' ) .argv( process.argv, async () => { await trackEvent( 'vip_validate_command_execute' ); diff --git a/src/bin/vip.js b/src/bin/vip.js index edb7870e1..22ddcd137 100755 --- a/src/bin/vip.js +++ b/src/bin/vip.js @@ -42,7 +42,10 @@ const runCmd = async function () { .command( 'db', "Access an environment's database." ) .command( 'sync', 'Sync the database from production to a non-production environment.' ) .command( 'whoami', 'Retrieve details about the current authenticated VIP-CLI user.' ) - .command( 'validate', 'Validate your VIP application and environment' ) + .command( + 'validate', + 'Scan a Node.js codebase for issues that could prevent building or deploying.' + ) .command( 'wp', 'Execute a WP-CLI command against an environment.' ); cmd.argv( process.argv ); From de7dc3c8d917ccedc2e97b9498e3520f7b653cd8 Mon Sep 17 00:00:00 2001 From: Yoli Hodde Date: Thu, 21 Nov 2024 08:59:12 -0800 Subject: [PATCH 3/5] Initial changes --- src/bin/vip-validate-preflight.js | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/bin/vip-validate-preflight.js b/src/bin/vip-validate-preflight.js index f0f203376..41d1bc9f4 100755 --- a/src/bin/vip-validate-preflight.js +++ b/src/bin/vip-validate-preflight.js @@ -590,9 +590,9 @@ command( commandOpts ) ) .option( 'node-version', - `Select a specific target Node.JS version in semver format (MAJOR.MINOR.PATCH) or a MAJOR (${ ALLOWED_NODEJS_VERSIONS.join( + `The version of Node.JS to run the tests with. Accepts semver format (MAJOR.MINOR.PATCH) or a MAJOR (${ ALLOWED_NODEJS_VERSIONS.join( ', ' - ) })` + ) }).` ) .option( 'wait', @@ -601,11 +601,18 @@ command( commandOpts ) ) .option( [ 'p', 'port' ], - 'Configure the port to use for the app (defaults to a random port between 3001 and 3999)' + 'Configure a port to use for the application (defaults to a random value 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() ) + .option( + 'format', + 'Render output in a particular format. Accepts “table” (default), “csv”, and “json”.' + ) + .option( [ 'P', 'path' ], 'Path to the local application code.', process.cwd() ) .examples( [ + { + usage: 'vip validate preflight', + description: 'Run the validate command from within the local Node.js codebase directory.', + }, { usage: 'vip @example-node-app.production validate preflight', description: @@ -613,12 +620,13 @@ command( commandOpts ) ' * Run the tests with settings that are identical to the targeted VIP Platform environment.', }, { - usage: 'vip @mysite.production validate preflight --format json > results.json', + usage: + 'vip @example-node-app.production validate preflight --path=/Users/example/Desktop/example-node-repo', description: 'Scan a local copy of the Node.js repository from a path on the user\'s local machine named "example-node-repo".', }, { - usage: 'vip @example-node-app.production validate preflight --json > results.json', + usage: 'vip @example-node-app.production validate preflight --format=json > results.json', description: 'Run the scan and output the results to a local file in JSON format.', }, { From 6c7cb0d3ec5ed4ac71b88ca8a4ab1e2933e812e6 Mon Sep 17 00:00:00 2001 From: Yoli Hodde Date: Thu, 21 Nov 2024 15:58:32 -0800 Subject: [PATCH 4/5] Initial updates to command descriptions and examples --- src/bin/vip-logs.js | 2 +- src/bin/vip-slowlogs.ts | 2 +- src/bin/vip-validate-preflight.js | 42 +++++++++++++++---------------- 3 files changed, 22 insertions(+), 24 deletions(-) diff --git a/src/bin/vip-logs.js b/src/bin/vip-logs.js index 7b0ff786a..e40212123 100755 --- a/src/bin/vip-logs.js +++ b/src/bin/vip-logs.js @@ -243,7 +243,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” and “json”.', 'table' ) .examples( [ { usage: 'vip @example-app.production logs', diff --git a/src/bin/vip-slowlogs.ts b/src/bin/vip-slowlogs.ts index 4b84f897c..3700f4004 100755 --- a/src/bin/vip-slowlogs.ts +++ b/src/bin/vip-slowlogs.ts @@ -199,7 +199,7 @@ 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' ) + .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 41d1bc9f4..1f13d921d 100755 --- a/src/bin/vip-validate-preflight.js +++ b/src/bin/vip-validate-preflight.js @@ -582,56 +582,54 @@ if ( parsedAlias.app ) { ); } -command( commandOpts ) +const usage = 'vip validate preflight'; + +command( { commandOpts, usage } ) .option( 'verbose', - 'Increase logging level to include app build and server boot up messages. Prints rows to the console as they are updated.', + 'Increase logging level to include app build and server boot up messages. Outputs rows to the console as they are generated.', false ) .option( 'node-version', - `The version of Node.JS to run the tests with. Accepts semver format (MAJOR.MINOR.PATCH) or a MAJOR (${ ALLOWED_NODEJS_VERSIONS.join( + `Set a version of Node.JS for the tests. Accepts semver format (MAJOR.MINOR.PATCH) or a MAJOR (${ ALLOWED_NODEJS_VERSIONS.join( ', ' ) }).` ) .option( 'wait', - 'Set the number of milliseconds to delay the start of a scan. Only necessary for apps that require a larger amount of time to start.', + 'Set the number of milliseconds to delay the start of the tests. Only necessary if an application requires a greater amount of time to start.', 3000 ) .option( [ 'p', 'port' ], - 'Configure a port to use for the application (defaults to a random value between 3001 and 3999)' - ) - .option( - 'format', - 'Render output in a particular format. Accepts “table” (default), “csv”, and “json”.' + 'Set a port for the application. (Defaults to a random value between 3001 and 3999)' ) - .option( [ 'P', 'path' ], 'Path to the local application code.', process.cwd() ) + .option( 'format', 'Render output in a particular format. Accepts “csv” and “json”.', 'table' ) + .option( [ 'P', 'path' ], 'Path to a local Node.js application directory.', process.cwd() ) .examples( [ { usage: 'vip validate preflight', - description: 'Run the validate command from within the local Node.js codebase directory.', + description: + 'Run the validate command from within the root of the local Node.js codebase directory.', }, { - usage: 'vip @example-node-app.production validate preflight', + usage: 'vip validate preflight --path=/Users/example/Desktop/example-node-repo', description: - 'Run the validate command from within the local Node.js codebase directory.\n' + - ' * Run the tests with settings that are identical to the targeted VIP Platform environment.', + 'Run the validate command against a Node.js application directory at a specific local path.', }, { - usage: - 'vip @example-node-app.production validate preflight --path=/Users/example/Desktop/example-node-repo', - description: - 'Scan a local copy of the Node.js repository from a path on the user\'s local machine named "example-node-repo".', + usage: 'vip @example-node-app.production validate preflight --node-version=20', + description: 'Run the validation tests with a specific version of Node.js.', }, { - usage: 'vip @example-node-app.production validate preflight --format=json > results.json', - description: 'Run the scan and output the results to a local file in JSON format.', + usage: 'vip validate preflight --format=json > results.json', + description: 'Output the results of the validation tests to a local file in JSON format.', }, { - usage: 'vip @example-node-app.production validate preflight --node-version=18', - description: 'Run the scan and output the results to a local file in JSON format.', + usage: 'vip @example-node-app.production validate preflight', + description: + 'Run the validation tests with settings based on a targeted VIP Platform environment.', }, ] ) .argv( process.argv, vipValidatePreflightCommand ); From 6994bf0c62df1d6c7f61209fe53929565475a8d2 Mon Sep 17 00:00:00 2001 From: Yoli Hodde Date: Wed, 27 Nov 2024 15:58:58 -0800 Subject: [PATCH 5/5] Changes as per feedback from Rinat --- src/bin/vip-validate-preflight.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bin/vip-validate-preflight.js b/src/bin/vip-validate-preflight.js index 0f1120502..d95f9409d 100755 --- a/src/bin/vip-validate-preflight.js +++ b/src/bin/vip-validate-preflight.js @@ -588,12 +588,12 @@ const usage = 'vip validate preflight'; command( { commandOpts, usage } ) .option( 'verbose', - 'Increase logging level to include app build and server boot up messages. Outputs rows to the console as they are generated.', + 'Increase logging level to include app build and server boot up messages.', false ) .option( 'node-version', - `Set a version of Node.JS for the tests. Accepts semver format (MAJOR.MINOR.PATCH) or a MAJOR (${ ALLOWED_NODEJS_VERSIONS.join( + `Set a version of Node.js for the tests. Accepts semver format (MAJOR.MINOR.PATCH) or a MAJOR (${ ALLOWED_NODEJS_VERSIONS.join( ', ' ) }).` )