Skip to content

Commit

Permalink
Merge branch 'feature/devenv-purge-cmd' of https://github.com/Automat…
Browse files Browse the repository at this point in the history
…tic/vip-cli into feature/devenv-purge-cmd
  • Loading branch information
rebeccahum committed Nov 22, 2023
2 parents 503fcd9 + d5b3a9d commit 18a1a8e
Show file tree
Hide file tree
Showing 20 changed files with 2,310 additions and 2,660 deletions.
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
reviewers:
- 'Automattic/vip-platform-patisserie'
labels:
- '[Status] Needs Review'
- 'dependencies'
# Allow up to 15 open pull requests at the same time
open-pull-requests-limit: 15
4 changes: 4 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ jobs:
name: Publish to npm
runs-on: ubuntu-latest
if: contains( github.event.pull_request.labels.*.name, '[ Type ] NPM version update' ) && startsWith( github.head_ref, 'release/') && github.event.pull_request.merged == true
permissions:
contents: write
id-token: write
pull-requests: write
steps:
- uses: Automattic/vip-actions/[email protected]
with:
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
18
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
## Changelog

### 2.36.1

- #1550 chore(deps): replace cli-table with cli-table3

### 2.36.0

- #1527 chore(dev-deps): remove @babel/plugin-transform-modules-commonjs and babel-plugin-module-resolver
- #1531 chore(dev-deps): update nock from 13.3.3 to 13.3.4
- #1530 chore(dev-deps): update TypeScript type definitions
- #1529 chore(dev-deps): update eslint from 8.50.0 to 8.51.0
- #1532 chore(dev-deps): update dockerode from 3.3.4 to 4.0.0
- #1528 chore(dev-deps): update Babel-related stuff to 7.23
- #1522 Change default response on WordPress upgrade prompt to 'no'
- #1533 FORNO-1704: SQL Import - Improve handling of compressed files
- #1536 CANTINA-957: Dev-env: Make message after update more clear
- #1534 build: disable promise/no-multiple-resolved
- #1535 FORNO-1677: Fix dev env network site domains
- #1538 style: update @automattic/eslint-plugin-wpvip to 0.8.0 and apply style fixes
- #1539 chore(dev-deps): update TypeScript type definitions
- #1540 chore(deps): update jwt-decode from 3.1.2 to 4.0.0
- #1541 chore(dev-deps): update nock from 13.3.4 to 13.3.7
- #1542 chore: generate and verify provenance statements
- #1544 chore(deps): update update-notifier to 7.0.0
- #1485 feat(dev-env): add PHP 8.3 image
- #1543 chore(deps): update lando
- #1545 chore(deps): replace deprecated `json2csv` with `@json2csv/plainjs`

### 2.35.1

- #1523 SQL Import Status: Ensure we pull site type ID from server for validation
Expand Down
2 changes: 1 addition & 1 deletion __tests__/bin/vip-logs.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ describe( 'getLogs', () => {
expect( console.log ).toHaveBeenCalledTimes( 1 );
expect( console.log ).toHaveBeenCalledWith(
/* eslint-disable max-len */
`"timestamp","message"${ os.EOL }"2021-11-05T20:18:36.234041811Z","My container message 1"${ os.EOL }"2021-11-09T20:47:07.301221112Z","My container message 2 has ""double quotes"", 'single quotes', commas, multiple${ os.EOL }lines${ os.EOL }, and tabs"`
`"timestamp","message"\n"2021-11-05T20:18:36.234041811Z","My container message 1"\n"2021-11-09T20:47:07.301221112Z","My container message 2 has ""double quotes"", 'single quotes', commas, multiple${ os.EOL }lines${ os.EOL }, and tabs"`
/* eslint-enable max-len */
);

Expand Down
4 changes: 1 addition & 3 deletions __tests__/bin/vip-slowlogs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import os from 'os';

import { getSlowlogs } from '../../src/bin/vip-slowlogs';
import * as slowlogsLib from '../../src/lib/app-slowlogs/app-slowlogs';
import * as exit from '../../src/lib/cli/exit';
Expand Down Expand Up @@ -225,7 +223,7 @@ describe( 'getSlowlogs', () => {
expect( console.log ).toHaveBeenCalledTimes( 1 );
expect( console.log ).toHaveBeenCalledWith(
/* eslint-disable max-len */
`"timestamp","rows sent","rows examined","query time","request uri","query"${ os.EOL }"2021-11-05T20:18:36.234041811Z",,,,,"SELECT * FROM wp_posts"${ os.EOL }"2021-11-09T20:47:07.301221112Z",,,,,"SELECT * FROM wp_posts"`
`"timestamp","rows sent","rows examined","query time","request uri","query"\n"2021-11-05T20:18:36.234041811Z",,,,,"SELECT * FROM wp_posts"\n"2021-11-09T20:47:07.301221112Z",,,,,"SELECT * FROM wp_posts"`
/* eslint-enable max-len */
);

Expand Down
9 changes: 5 additions & 4 deletions __tests__/lib/dev-environment/dev-environment-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -584,10 +584,11 @@ describe( 'lib/dev-environment/dev-environment-cli', () => {

describe( 'resolvePhpVersion', () => {
it.each( [
[ '7.4', DEV_ENVIRONMENT_PHP_VERSIONS[ '7.4' ] ],
[ '8.0', DEV_ENVIRONMENT_PHP_VERSIONS[ '8.0' ] ],
[ '8.1', DEV_ENVIRONMENT_PHP_VERSIONS[ '8.1' ] ],
[ '8.2', DEV_ENVIRONMENT_PHP_VERSIONS[ '8.2' ] ],
[ '7.4', DEV_ENVIRONMENT_PHP_VERSIONS[ '7.4' ].image ],
[ '8.0', DEV_ENVIRONMENT_PHP_VERSIONS[ '8.0' ].image ],
[ '8.1', DEV_ENVIRONMENT_PHP_VERSIONS[ '8.1' ].image ],
[ '8.2', DEV_ENVIRONMENT_PHP_VERSIONS[ '8.2' ].image ],
[ '8.3', DEV_ENVIRONMENT_PHP_VERSIONS[ '8.3' ].image ],
[ 'image:php:8.0', 'image:php:8.0' ],
[
'ghcr.io/automattic/vip-container-images/php-fpm-ubuntu:8.0',
Expand Down
24 changes: 15 additions & 9 deletions __tests__/lib/http/proxy-agent.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import { HttpsProxyAgent } from 'https-proxy-agent';
import { SocksProxyAgent } from 'socks-proxy-agent';

import { createProxyAgent } from '../../../src/lib/http/proxy-agent';

// Reference for testing with env variables within a test: https://github.com/vuejs/vue-test-utils/issues/193

describe( 'validate CreateProxyAgent', () => {
let env;

beforeAll( () => {
env = { ...process.env };
} );

beforeEach( () => {
// Clear all applicable environment variables before running test so each test starts "clean"
// using beforeEach instead of afterEach in case the client running tests has env variables set before the first test is run
Expand All @@ -19,6 +27,10 @@ describe( 'validate CreateProxyAgent', () => {
}
} );

afterAll( () => {
process.env = { ...env };
} );

// Tests checking for null results
it.each( [
{
Expand Down Expand Up @@ -90,11 +102,7 @@ describe( 'validate CreateProxyAgent', () => {
urlToHit: 'https://wpAPI.org/api',
},
] )( 'should return null with %o', async ( { envVars, urlToHit } ) => {
setEnvironmentVariabeles( envVars );
// We have to dynamically import the module so we can set environment variables above
// All tests must be async to support this dynamic import, otherwise the modified env variables are not picked up
const createProxyAgent = ( await import( '../../../src/lib/http/proxy-agent' ) )
.createProxyAgent;
setEnvironmentVariables( envVars );
const agent = createProxyAgent( urlToHit );
expect( agent ).toBeNull();
} );
Expand Down Expand Up @@ -167,17 +175,15 @@ describe( 'validate CreateProxyAgent', () => {
expectedClass: HttpsProxyAgent,
},
] )( 'should return proxy with %o', async ( { envVars, urlToHit, expectedClass } ) => {
setEnvironmentVariabeles( envVars );
const createProxyAgent = ( await import( '../../../src/lib/http/proxy-agent' ) )
.createProxyAgent;
setEnvironmentVariables( envVars );
const agent = createProxyAgent( urlToHit );
expect( agent ).not.toBeNull();
expect( agent ).toBeInstanceOf( expectedClass );
} );

// Helper function to set environment variables based on passed in object
// envVars of the form: [ { VAR: 'VALUE' }, { VAR1: 'VALUE1' }, ... ]
function setEnvironmentVariabeles( envVars ) {
function setEnvironmentVariables( envVars ) {
for ( const index in envVars ) {
for ( const key in envVars[ index ] ) {
process.env[ key ] = envVars[ index ][ key ];
Expand Down
4 changes: 3 additions & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ module.exports = {
[
'@babel/preset-env',
{
loose: true,
exclude: [ '@babel/plugin-proposal-dynamic-import' ],
targets: {
node: '16', // Keep this in sync with package.json engines.node
node: '18', // Keep this in sync with package.json engines.node
},
},
],
Expand Down
Loading

0 comments on commit 18a1a8e

Please sign in to comment.