Skip to content

Commit

Permalink
Merge branch 'trunk' into update/docs-pt-vip-db
Browse files Browse the repository at this point in the history
  • Loading branch information
yolih committed Apr 16, 2024
2 parents 28ef3a2 + dbf9928 commit abbc36d
Show file tree
Hide file tree
Showing 30 changed files with 243 additions and 155 deletions.
1 change: 0 additions & 1 deletion .gitattributes

This file was deleted.

12 changes: 0 additions & 12 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion __tests__/bin/vip-config-envvar-delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe( 'deleteEnvVarCommand', () => {
let args;
let opts;
const eventPayload = expect.objectContaining( {
command: expect.stringContaining( 'vip @mysite.develop config envvar delete' ),
command: expect.stringContaining( 'vip config envvar delete' ),
} );
const executeEvent = [ 'envvar_delete_command_execute', eventPayload ];
const successEvent = [ 'envvar_delete_command_success', eventPayload ];
Expand Down
2 changes: 1 addition & 1 deletion __tests__/bin/vip-config-envvar-get-all.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe( 'getAllEnvVarsCommand', () => {
format: 'csv',
};
const eventPayload = expect.objectContaining( {
command: 'vip @mysite.develop config envvar get-all',
command: 'vip config envvar get-all',
} );
const executeEvent = [ 'envvar_get_all_command_execute', eventPayload ];
const successEvent = [ 'envvar_get_all_command_success', eventPayload ];
Expand Down
2 changes: 1 addition & 1 deletion __tests__/bin/vip-config-envvar-get.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe( 'getEnvVarCommand', () => {
},
};
const eventPayload = expect.objectContaining( {
command: 'vip @mysite.develop config envvar get HELLO',
command: 'vip config envvar get HELLO',
} );
const executeEvent = [ 'envvar_get_command_execute', eventPayload ];
const successEvent = [ 'envvar_get_command_success', eventPayload ];
Expand Down
2 changes: 1 addition & 1 deletion __tests__/bin/vip-config-envvar-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe( 'listEnvVarsCommand', () => {
format: 'csv',
};
const eventPayload = expect.objectContaining( {
command: 'vip @mysite.develop config envvar list',
command: 'vip config envvar list',
} );
const executeEvent = [ 'envvar_list_command_execute', eventPayload ];
const successEvent = [ 'envvar_list_command_success', eventPayload ];
Expand Down
2 changes: 1 addition & 1 deletion __tests__/bin/vip-config-envvar-set.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ describe( 'setEnvVarCommand', () => {
let args;
let opts;
const eventPayload = expect.objectContaining( {
command: expect.stringContaining( 'vip @mysite.develop config envvar set' ),
command: expect.stringContaining( 'vip config envvar set' ),
} );
const executeEvent = [ 'envvar_set_command_execute', eventPayload ];
const successEvent = [ 'envvar_set_command_success', eventPayload ];
Expand Down
1 change: 1 addition & 0 deletions __tests__/lib/cli/envAlias.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ describe( 'utils/cli/envAlias', () => {
'@1',
'@1.env',
'@2.MixedCaseEnv',
'@xxx.production_test',
] )( 'should identify valid aliases - %p', alias => {
expect( isAlias( alias ) ).toBe( true );
} );
Expand Down
17 changes: 17 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
## Changelog

### 2.39.2

* build(deps-dev): bump typescript from 5.4.4 to 5.4.5
* build(deps): bump ejs from 3.1.9 to 3.1.10
* fix: remove unused `cancelCommand`
* fix(dev-env): argument parsing for `vip dev-env sync sql`9
* fix: underscore is allowed in environment name
* chore: remove unused files
* fix: superfluous trailing arguments

**Full Changelog**: https://github.com/Automattic/vip-cli/compare/2.39.1...2.39.2

### 2.39.1

- Fix a crash due to an undefined function when running `export sql` with the `--generate-backup` flag by @noahtallen in https://github.com/Automattic/vip-cli/pull/1769
- refactor(dev-env): reduce noise from preflight checks by @sjinks in https://github.com/Automattic/vip-cli/pull/1758

### 2.39.0

* Updated Docs URLs to current permalinks by @yolih in https://github.com/Automattic/vip-cli/pull/1742
Expand Down
28 changes: 14 additions & 14 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@automattic/vip",
"version": "2.39.1-dev.0",
"version": "2.39.3-dev.0",
"description": "The VIP Javascript library & CLI",
"main": "index.js",
"bin": {
Expand Down
7 changes: 4 additions & 3 deletions src/bin/vip-config-envvar-delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ import { cancel, confirm, promptForValue } from '../lib/envvar/input';
import { debug, getEnvContext } from '../lib/envvar/logging';
import { trackEvent } from '../lib/tracker';

const baseUsage = 'vip @mysite.develop config envvar delete';
const baseUsage = 'vip config envvar delete';
const exampleUsage = 'vip @example-app.develop config envvar delete';

// Command examples
const examples = [
{
usage: `${ baseUsage } MY_VARIABLE`,
description: 'Permanently deletes the environment variable "MY_VARIABLE"',
usage: `${ exampleUsage } MY_VARIABLE`,
description: 'Delete the environment variable "MY_VARIABLE" from the environment.',
},
];

Expand Down
19 changes: 16 additions & 3 deletions src/bin/vip-config-envvar-get-all.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,26 @@ import { appQuery, getEnvVars } from '../lib/envvar/api';
import { debug, getEnvContext } from '../lib/envvar/logging';
import { trackEvent } from '../lib/tracker';

const usage = 'vip @mysite.develop config envvar get-all';
const exampleUsage = 'vip @example-app.develop config envvar get-all';
const usage = 'vip config envvar get-all';

// Command examples
const examples = [
{
usage,
description: 'Get the values of all environment variables',
usage: exampleUsage,
description: 'Retrieve a list of all environment variables in the default table format.',
},
{
usage: `${ exampleUsage } --format=csv`,
description: 'Retrieve a list of all environment variables in CSV format.',
},
{
usage: `${ exampleUsage } --format=ids`,
description: 'Retrieve a list of all environment variable names as a space separated list.',
},
{
usage: `${ exampleUsage } --format=keyValue`,
description: 'Retrieve a list of all environment variables as a key value list.',
},
];

Expand Down
7 changes: 4 additions & 3 deletions src/bin/vip-config-envvar-get.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ import { appQuery, getEnvVar } from '../lib/envvar/api';
import { debug, getEnvContext } from '../lib/envvar/logging';
import { trackEvent } from '../lib/tracker';

const baseUsage = 'vip @mysite.develop config envvar get';
const baseUsage = 'vip config envvar get';
const exampleUsage = 'vip @example-app.develop config envvar get';

// Command examples
const examples = [
{
usage: `${ baseUsage } MY_VARIABLE`,
description: 'Get the value of the environment variable "MY_VARIABLE"',
usage: `${ exampleUsage } MY_VARIABLE`,
description: 'Retrieve the value of the environment variable "MY_VARIABLE".',
},
];

Expand Down
7 changes: 4 additions & 3 deletions src/bin/vip-config-envvar-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ import { appQuery, listEnvVars } from '../lib/envvar/api';
import { debug, getEnvContext } from '../lib/envvar/logging';
import { trackEvent } from '../lib/tracker';

const usage = 'vip @mysite.develop config envvar list';
const usage = 'vip config envvar list';
const exampleUsage = 'vip @example-app.develop config envvar list';

// Command examples
const examples = [
{
usage,
description: 'Lists all environment variables (names only)',
usage: exampleUsage,
description: 'List the names of all environment variables on an environment.',
},
];

Expand Down
15 changes: 11 additions & 4 deletions src/bin/vip-config-envvar-set.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,22 @@ import { debug, getEnvContext } from '../lib/envvar/logging';
import { readVariableFromFile } from '../lib/envvar/read-file';
import { trackEvent } from '../lib/tracker';

const baseUsage = 'vip @mysite.develop config envvar set';
const baseUsage = 'vip config envvar set';
const exampleUsage = 'vip @example-app.develop config envvar set';

const NEW_RELIC_ENVVAR_KEY = 'NEW_RELIC_LICENSE_KEY';

// Command examples
const examples = [
{
usage: `${ baseUsage } MY_VARIABLE`,
description: 'Sets the environment variable "MY_VARIABLE" and prompts for its value',
usage: `${ exampleUsage } MY_VARIABLE`,
description:
'Add or update the environment variable "MY_VARIABLE" and assign its value at the prompt.',
},
{
usage: `${ exampleUsage } MULTILINE_ENV_VAR --from-file=envvar-value.txt`,
description:
'Add or update the environment variable "MULTILINE_ENV_VAR" and assign the multiline contents of local file envvar-value.txt as its value.',
},
];

Expand Down Expand Up @@ -52,7 +59,7 @@ export async function setEnvVarCommand( arg, opt ) {
await trackEvent( 'envvar_set_newrelic_key', trackingParams );
console.log(
chalk.bold.red( 'Setting the New Relic key is not permitted.' ),
'If you want to set your own New Relic key, please contact our support team through the usual channels.'
'If you want to set your own New Relic key, please contact WordPress VIP support.'
);
process.exit( 1 );
}
Expand Down
40 changes: 35 additions & 5 deletions src/bin/vip-config-envvar.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,42 @@

import command from '../lib/cli/command';

const usage = 'vip config envvar';
const exampleUsage = 'vip @example-app.develop config envvar';

// Command examples
const examples = [
{
usage: `${ exampleUsage } delete MY_VARIABLE`,
description: 'Delete the environment variable "MY_VARIABLE" from the environment.',
},
{
usage: `${ exampleUsage } get MY_VARIABLE`,
description: 'Retrieve the value of the environment variable "MY_VARIABLE".',
},
{
usage: `${ exampleUsage } get-all`,
description: 'Retrieve a list of all environment variables in the default table format.',
},
{
usage: `${ exampleUsage } list`,
description: 'List the names of all environment variables.',
},
{
usage: `${ exampleUsage } set MY_VARIABLE`,
description:
'Add or update the environment variable "MY_VARIABLE" and assign its value at the prompt.',
},
];

command( {
requiredArgs: 0,
usage,
} )
.command( 'delete', 'Permanently delete an environment variable' )
.command( 'get', 'Get the value of an environment variable' )
.command( 'get-all', 'Get the values of all environment variable' )
.command( 'list', 'List the names of all environment variables' )
.command( 'set', 'Add or update an environment variable' )
.command( 'delete', 'Delete an environment variable.' )
.command( 'get', 'Retrieve the value of an environment variable.' )
.command( 'get-all', 'Retrieve the names and values of all environment variables.' )
.command( 'list', 'List the names of all environment variables.' )
.command( 'set', 'Add or update an environment variable.' )
.examples( examples )
.argv( process.argv );
33 changes: 26 additions & 7 deletions src/bin/vip-config-software-get.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,36 @@ import { appQuery, appQueryFragments, formatSoftwareSettings } from '../lib/conf
import { trackEvent } from '../lib/tracker';
import UserError from '../lib/user-error';

const usage = 'vip config software get <wordpress|php|nodejs|muplugins>';
const exampleUsage = 'vip @example-app.develop config software get';
const exampleUsageNode = 'vip @example-node-app.develop config software get';

// Command examples
const examples = [
{
usage:
'vip @mysite.develop config software get wordpress --include available_versions --format json',
usage: exampleUsage,
description:
'Retrieve a list of the current versions of all environment software in the default table format.',
},
{
usage: `${ exampleUsage } --format=csv`,
description:
'Read current software settings for WordPress in JSON format including available versions',
'Retrieve a list of the current versions of all environment software in CSV format.',
},
{
usage: 'vip @mysite.develop config software get',
description: 'Read current software settings for all components',
usage: `${ exampleUsage } wordpress --include=available_versions`,
description:
'Retrieve the current version of WordPress for a WordPress environment and a list of available versions in the default table format.',
},
{
usage: `${ exampleUsage } php --include=available_versions`,
description:
'Retrieve the current version of PHP for a WordPress environment and a list of available versions in the default table format.',
},
{
usage: `${ exampleUsageNode } nodejs --include=available_versions --format=json`,
description:
'Retrieve the current version of Node.js for a Node.js environment and a list of available versions in JSON format.',
},
];

Expand All @@ -29,11 +48,11 @@ command( {
envContext: true,
wildcardCommand: true,
format: true,
usage: 'vip @mysite.develop config software get <wordpress|php|nodejs|muplugins>',
usage,
} )
.option(
'include',
`Extra information to be included. Valid values: ${ VALID_INCLUDES.join( ',' ) }`
`Retrieve additional data of a specific type. Supported values: ${ VALID_INCLUDES.join( ',' ) }`
)
.examples( examples )
.argv( process.argv, async ( arg, opt ) => {
Expand Down
Loading

0 comments on commit abbc36d

Please sign in to comment.