Skip to content

Commit

Permalink
Merge branch 'trunk' into update/docs-pt-vip-logs
Browse files Browse the repository at this point in the history
  • Loading branch information
yolih committed Nov 18, 2024
2 parents 4a79a33 + f855fc5 commit 7995ac8
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 43 deletions.
52 changes: 52 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,57 @@
## Changelog

## 3.8.7

* fix(dev-env): SQL sync for single sites

**Full Changelog**: https://github.com/Automattic/vip-cli/compare/3.8.6...3.8.7

## 3.8.6

* Updating Node.js versions and standardize the format

**Full Changelog**: https://github.com/Automattic/vip-cli/compare/3.8.5...3.8.6

## 3.8.5

* build(deps-dev): bump the babel group with 4 updates
* build(deps-dev): bump typescript from 5.6.2 to 5.6.3
* Update the sync command to follow the VIP-CLI style guide
* Update the `import` command group to follow the VIP-CLI style guide
* Remove the unused `--format` option from validate media files command
* Fix `--output` option of `vip import sql` command
* Updates the `vip wp` command to follow the VIP-CLI style guide
* build(deps-dev): bump the babel group with 2 updates
* build(deps-dev): bump @types/node from 22.7.4 to 22.7.6
* build(deps-dev): bump @types/node from 22.7.6 to 22.7.7
* Use a more reliable way to convert to string
* build(deps-dev): bump @types/node from 22.7.7 to 22.8.2
* build(deps): bump socket.io-client from 4.8.0 to 4.8.1
* build(deps-dev): bump @types/jest from 29.5.13 to 29.5.14 in the testing group
* build(deps-dev): bump the babel group across 1 directory with 4 updates
* build(deps): bump actions/dependency-review-action from 4.3.4 to 4.4.0
* build(deps-dev): bump @types/node from 22.8.2 to 22.8.5
* build(deps-dev): bump @types/adm-zip from 0.5.5 to 0.5.6
* build(deps-dev): bump rimraf from 5.0.8 to 6.0.1
* build(deps): bump uuid from 10.0.0 to 11.0.2
* build(deps-dev): bump @types/node from 22.8.5 to 22.8.6
* fix(dev-env): verify the container is running before URL scan
* build(deps-dev): bump @types/node from 22.8.6 to 22.8.7
* build(deps-dev): bump @types/node from 22.8.7 to 22.9.0
* fix(dev-env): detection of URLs to replace for multisites
* build(deps-dev): bump nock from 13.5.5 to 13.5.6
* 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
* Revert "New package release: v3.9.0"
* chore(deps): update Lando to 6ca2668
* fix: `table` format output
* chore(deps): update `cpu-features` to 0.0.10
* build(deps): bump @automattic/vip-go-preflight-checks from 2.0.17 to 2.0.18

**Full Changelog**: https://github.com/Automattic/vip-cli/compare/3.8.4...3.8.5

## 3.8.4

* build(deps): bump step-security/harden-runner from 2.9.1 to 2.10.1
Expand Down
61 changes: 31 additions & 30 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": "3.8.5-dev.0",
"version": "3.8.8-dev.0",
"description": "The VIP Javascript library & CLI",
"main": "index.js",
"bin": {
Expand Down
18 changes: 10 additions & 8 deletions src/bin/vip-validate-preflight.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { parseEnvAliasFromArgv } from '../lib/cli/envAlias';
import * as exit from '../lib/cli/exit';
import { trackEvent } from '../lib/tracker';

const ALLOWED_NODEJS_VERSIONS = [ '14', '16', '18' ];
const ALLOWED_NODEJS_VERSIONS = [ '18', '20', '22' ];

export const appQuery = `
id
Expand All @@ -50,7 +50,7 @@ export const appQuery = `
`;

let suppressOutput = false;
let outputJson = false;
let outputFormat = 'table';

let harmoniaArgs = [];

Expand Down Expand Up @@ -382,7 +382,7 @@ async function handleResults( harmonia, results ) {
} );

// If the output is JSON, reenable the logToConsole output and print-out the json format.
if ( outputJson ) {
if ( outputFormat === 'json' ) {
suppressOutput = false;
logToConsole( harmonia.resultsJSON() );
process.exit( 0 );
Expand Down Expand Up @@ -490,9 +490,9 @@ async function validateArgs( opt ) {
}

// If the JSON option is enabled, all the stdout should be suppressed to prevent polluting the output.
if ( opt.json ) {
if ( opt.format === 'json' ) {
suppressOutput = true;
outputJson = true;
outputFormat = 'json';
}

if ( opt.app ) {
Expand Down Expand Up @@ -588,7 +588,9 @@ command( commandOpts )
)
.option(
'node-version',
'Select a specific target Node.JS version in semver format (MAJOR.MINOR.PATCH) or a MAJOR'
`Select a specific target Node.JS version in semver format (MAJOR.MINOR.PATCH) or a MAJOR (${ ALLOWED_NODEJS_VERSIONS.join(
', '
) })`
)
.option(
'wait',
Expand All @@ -599,7 +601,7 @@ command( commandOpts )
[ '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( 'format', 'Output the log lines in CSV or JSON format', 'table' )
.option( [ 'P', 'path' ], 'Path to the app to be tested', process.cwd() )
.examples( [
{
Expand All @@ -608,7 +610,7 @@ command( commandOpts )
'Runs the preflight tests to validate if your application is ready to be deployed to VIP Go',
},
{
usage: 'vip @mysite.production validate preflight --json > results.json',
usage: 'vip @mysite.production validate preflight --format json > results.json',
description:
'Runs the preflight tests, but output the results in JSON format, and redirect the output to a file',
},
Expand Down
22 changes: 20 additions & 2 deletions src/commands/dev-env-sync-sql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,21 @@ export class DevEnvSyncSQLCommand {
return;
}

const prologue = `
DROP PROCEDURE IF EXISTS vip_sync_update_blog_domains;
DELIMITER $$
CREATE PROCEDURE vip_sync_update_blog_domains()
BEGIN
IF EXISTS (SELECT * FROM information_schema.tables WHERE table_schema = 'wordpress' AND table_name = 'wp_blogs') THEN
`;
const epilogue = `
END IF;
END$$
DELIMITER ;
CALL vip_sync_update_blog_domains();
DROP PROCEDURE vip_sync_update_blog_domains;
`;

const queries: string[] = [];
for ( const site of networkSites ) {
if ( ! site?.blogId || ! site?.homeUrl ) {
Expand All @@ -264,12 +279,15 @@ export class DevEnvSyncSQLCommand {
: this.landoDomain;

queries.push(
`UPDATE wp_blogs SET domain = '${ newDomain }' WHERE blog_id = ${ Number( site.blogId ) };`
` UPDATE wp_blogs SET domain = '${ newDomain }' WHERE blog_id = ${ Number(
site.blogId
) };`
);
}

if ( queries.length ) {
await fs.promises.appendFile( this.sqlFile, queries.join( '\n' ) );
const sql = `${ prologue }\n${ queries.join( '\n' ) }\n${ epilogue }`;
await fs.promises.appendFile( this.sqlFile, sql );
}
}

Expand Down
11 changes: 9 additions & 2 deletions src/lib/config/software.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ interface VersionChoice {
message: string;
value: string;
disabled?: boolean;
deprecated?: boolean;
}

interface VersionChoices {
Expand All @@ -175,16 +176,19 @@ const _optionsForVersion = ( softwareSettings: SoftwareSetting ): VersionChoice[
versionChoices.deprecated.push( {
message: `${ option.version } (deprecated)`,
value: option.version,
deprecated: option.deprecated,
} );
} else if ( option.unstable ) {
versionChoices.test.push( {
message: `${ option.version } (test)`,
value: option.version,
deprecated: option.deprecated,
} );
} else {
versionChoices.supported.push( {
message: option.version,
value: option.version,
deprecated: option.deprecated,
} );
}
}
Expand Down Expand Up @@ -431,9 +435,12 @@ export const formatSoftwareSettings = (
};

if ( includes.includes( 'available_versions' ) ) {
result.available_versions = _optionsForVersion( softwareSetting ).map( option => option.value );
result.available_versions = _optionsForVersion( softwareSetting )
.filter( option => ! option.deprecated )
.map( option => option.value );

if ( format !== 'json' ) {
result.available_versions = result.available_versions.join( ',' );
result.available_versions = result.available_versions.sort().join( ',' );
}
}

Expand Down

0 comments on commit 7995ac8

Please sign in to comment.