Skip to content

Commit

Permalink
Update dependencies and tooling (#223)
Browse files Browse the repository at this point in the history
  • Loading branch information
kasparsd authored Mar 13, 2023
1 parent 9a6b914 commit 820bb24
Show file tree
Hide file tree
Showing 22 changed files with 30,783 additions and 9,676 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ trim_trailing_whitespace = true
indent_style = tab
indent_size = 4

[*.{json,yml,yaml}]
[*.{yml,yaml}]
indent_style = space
indent_size = 2

Expand Down
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Override the environment variables used in docker-compose.yml.
DOCKER_HOST_IP=127.0.0.1
DEV_URL=local.devgo.vip
DEV_URL=local.wpenv.net
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/plugins/vendor/
/console.log
/.env
/debug.log

# Uploads directory
/uploads/
Expand Down
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ php: '8.0'
before_install:
- nvm install
- nvm use
- mkdir -p uploads

install:
- npm install
Expand Down
2 changes: 2 additions & 0 deletions client-mu-plugins/config-jetpack.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php
/**
* Plugin Name: Jetpack Config
*
* @package XWP\Vip_Site_Template
*/

/**
Expand Down
2 changes: 2 additions & 0 deletions client-mu-plugins/config-yoast-seo.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php
/**
* Plugin Name: Yoast SEO Config
*
* @package XWP\Vip_Site_Template
*/

/**
Expand Down
2 changes: 2 additions & 0 deletions client-mu-plugins/env.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php
/**
* Plugin Name: Environment Config
*
* @package XWP\Vip_Site_Template
*/

// Always enable Query Monitor on local.
Expand Down
8 changes: 6 additions & 2 deletions client-mu-plugins/plugin-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
/**
* Bootstrap all must-use plugins.
*
* Use wpcom_vip_load_plugin( 'plugin-name' ); to always
* enable certain plugins from wp-content/plugins.
* @package XWP\Vip_Site_Template
*/

/**
Expand All @@ -23,3 +22,8 @@
require_once $mu_plugin_file_path;
}
}

/**
* Use wpcom_vip_load_plugin( 'plugin-name' ); to always
* enable certain plugins from wp-content/plugins.
*/
11 changes: 2 additions & 9 deletions client-mu-plugins/tests/phpunit/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
<?php
/**
* Bootstrap the WP testing environment.
*
* @package XWP\Vip_Site_Template
*/

// Ensure the DB host is ready to accept connections.
$connection = new XWP\Wait_For\Tcp_Connection( 'db', 3306 );

try {
$connection->connect( 10 );
} catch ( Exception $e ) {
trigger_error( $e->getMessage(), E_USER_ERROR ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_trigger_error, WordPress.Security.EscapeOutput.OutputNotEscaped
}

// Load WP unit test helper library.
require_once getenv( 'WP_PHPUNIT__DIR' ) . '/includes/functions.php';

Expand Down
5 changes: 5 additions & 0 deletions client-mu-plugins/tests/phpunit/class-example-test.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
<?php
/**
* Test the WP setup.
*
* @package XWP\Vip_Site_Template
*/

class Test_Example extends \WP_UnitTestCase {

Expand Down
128 changes: 64 additions & 64 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,66 +1,66 @@
{
"name": "xwp/vip-go-site",
"description": "VIP Go site environment",
"type": "project",
"license": "proprietary",
"prefer-stable": true,
"minimum-stability": "dev",
"repositories": [
{
"type": "composer",
"url": "https://wpackagist.org"
}
],
"config": {
"sort-packages": true,
"process-timeout": 600,
"preferred-install": "dist",
"vendor-dir": "plugins/vendor",
"platform": {
"php": "8.0"
},
"allow-plugins": {
"johnpbloch/wordpress-core-installer": true,
"composer/installers": true,
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"require": {
"php": ">=8.0",
"composer/installers": "^1.12",
"wpackagist-theme/twentytwenty": "^2.1"
},
"require-dev": {
"automattic/vip-go-mu-plugins": "dev-master",
"automattic/vipwpcs": "^2.3.3",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
"johnpbloch/wordpress": "dev-master",
"phpunit/phpunit": "^9.6.5",
"wp-cli/wp-cli-bundle": "^2.7.1",
"wp-phpunit/wp-phpunit": "^6.1.1",
"xwp/wait-for": "^0.0.1",
"yoast/phpunit-polyfills": "^1.0.4"
},
"scripts": {
"lint": [
"phpcs"
],
"verify": [
"composer validate --no-check-all --no-check-publish --strict"
],
"test": [
"phpunit --configuration=client-mu-plugins/phpunit.xml.dist"
],
"release": [
"composer install --no-dev --prefer-dist --optimize-autoloader"
]
},
"extra": {
"wordpress-install-dir": "local/public/wp",
"installer-paths": {
"plugins/{$name}": ["type:wordpress-plugin"],
"themes/{$name}": ["type:wordpress-theme"],
"client-mu-plugins/{$name}": ["type:wordpress-muplugin"]
}
}
"name": "xwp/vip-site-template",
"description": "VIP Go site environment",
"type": "project",
"license": "proprietary",
"prefer-stable": true,
"minimum-stability": "dev",
"repositories": [
{
"type": "composer",
"url": "https://wpackagist.org"
}
],
"config": {
"sort-packages": true,
"process-timeout": 600,
"preferred-install": "dist",
"vendor-dir": "plugins/vendor",
"platform": {
"php": "8.0"
},
"allow-plugins": {
"johnpbloch/wordpress-core-installer": true,
"composer/installers": true,
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"require": {
"php": ">=8.0",
"composer/installers": "^1.12",
"wpackagist-theme/twentytwenty": "^2.1"
},
"require-dev": {
"automattic/vip-go-mu-plugins": "dev-master",
"automattic/vipwpcs": "^2.3.3",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
"johnpbloch/wordpress": "dev-master",
"phpunit/phpunit": "^9.6.5",
"wp-cli/wp-cli-bundle": "^2.7.1",
"wp-phpunit/wp-phpunit": "^6.1.1",
"xwp/wait-for": "^0.0.1",
"yoast/phpunit-polyfills": "^1.0.4"
},
"scripts": {
"lint": [
"phpcs"
],
"verify": [
"composer validate --no-check-all --no-check-publish --strict"
],
"test": [
"phpunit --configuration=client-mu-plugins/phpunit.xml.dist"
],
"release": [
"composer install --no-dev --prefer-dist --optimize-autoloader"
]
},
"extra": {
"wordpress-install-dir": "local/public/wp",
"installer-paths": {
"plugins/{$name}": ["type:wordpress-plugin"],
"themes/{$name}": ["type:wordpress-theme"],
"client-mu-plugins/{$name}": ["type:wordpress-muplugin"]
}
}
}
10 changes: 5 additions & 5 deletions composer.lock

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

24 changes: 12 additions & 12 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,23 @@ services:
- /var/run/docker.sock:/tmp/docker.sock:ro
- ./local/docker/nginx-proxy/conf.d/custom.conf:/etc/nginx/conf.d/custom.conf

# Create a local DNS server that maps all *.local.devgo.vip to this environment when not connected to the internet.
# Create a local DNS server that maps all *.local.wpenv.net to this environment when not connected to the internet.
# Append `--log-queries --log-facility=-` to the command to enable verbose logging to stderr of all lookups.
dnsmasq:
image: andyshinn/dnsmasq:2.83
ports:
- "53:53/udp"
# Enable only when needed.
# ports:
# - "53:53/udp"
cap_add:
- NET_ADMIN
command: --address=/${DEV_URL:-local.devgo.vip}/${DOCKER_HOST_IP:-"127.0.0.1"} --server=1.1.1.1
command: --address=/${DEV_URL:-local.wpenv.net}/${DOCKER_HOST_IP:-"127.0.0.1"} --server=1.1.1.1

# Generate SSL certs for the local development environment.
mkcert:
build: ./local/docker/mkcert
volumes:
- cert_data:/root/.local/share/mkcert
command: mkcert -cert-file "${DEV_URL:-local.devgo.vip}.crt" -key-file "${DEV_URL:-local.devgo.vip}.key" "${DEV_URL:-local.devgo.vip}" "*.${DEV_URL:-local.devgo.vip}"
command: mkcert -cert-file "${DEV_URL:-local.wpenv.net}.crt" -key-file "${DEV_URL:-local.wpenv.net}.key" "${DEV_URL:-local.wpenv.net}" "*.${DEV_URL:-local.wpenv.net}"

# Sync VIP MySQL container and it's configurations - https://github.com/Automattic/vip-cli/blob/549a45a37bc254a39dba9ed23ac88174a35aa1da/assets/dev-env.lando.template.yml.ejs#L74-L75
db:
Expand All @@ -52,7 +53,7 @@ services:
depends_on:
- db
environment:
VIRTUAL_HOST: phpmyadmin.${DEV_URL:-local.devgo.vip}
VIRTUAL_HOST: phpmyadmin.${DEV_URL:-local.wpenv.net}
PMA_HOST: db
PMA_USER: root
PMA_PASSWORD: root
Expand All @@ -61,7 +62,7 @@ services:
mailhog:
image: mailhog/mailhog:v1.0.1
environment:
VIRTUAL_HOST: mail.${DEV_URL:-local.devgo.vip}
VIRTUAL_HOST: mail.${DEV_URL:-local.wpenv.net}
VIRTUAL_PORT: 8025

# For WP object caching.
Expand All @@ -74,7 +75,7 @@ services:
volumes:
- webgrind_data:/tmp
environment:
VIRTUAL_HOST: webgrind.${DEV_HOSTNAME:-local.devgo.vip}
VIRTUAL_HOST: webgrind.${DEV_HOSTNAME:-local.wpenv.net}

# Enable VIP ElasticSearch https://docs.wpvip.com/technical-references/elasticsearch/
elasticsearch:
Expand All @@ -98,14 +99,13 @@ services:
- .:/var/www/html/wp-content
- ./vip-config:/var/www/html/vip-config # Match the VIP production setup where vip-config is mapped to the root directory.
- webgrind_data:/tmp
command: bash -c "wp core multisite-install --url=${DEV_URL:-local.devgo.vip} --allow-root && docker-entrypoint.sh apache2-foreground"
environment:
VIRTUAL_HOST: ${DEV_URL:-local.devgo.vip}, *.${DEV_URL:-local.devgo.vip}
VIRTUAL_HOST: ${DEV_URL:-local.wpenv.net}, *.${DEV_URL:-local.wpenv.net}
SMTPSERVER: mailhog
EMAIL: local@${DEV_URL:-local.devgo.vip}
EMAIL: local@${DEV_URL:-local.wpenv.net}
XDEBUG_MODE: debug,coverage # Append `profile` to enable profiling or leave empty to disable all.
XDEBUG_CONFIG: client_host=host.docker.internal discover_client_host=0 # Required for MacOS only.
WP_PHPUNIT__TESTS_CONFIG: local/public/wp-tests-config.php
WP_PHPUNIT__TESTS_CONFIG: /var/www/html/wp-tests-config.php

volumes:
db_data:
Expand Down
4 changes: 4 additions & 0 deletions local/docker/wordpress/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
FROM wordpress:php8.0-apache

# Set cache directories to a predictable location for re-use.
ENV COMPOSER_HOME /tmp/.composer
ENV npm_config_cache /tmp/.npmcache

# Add path to Composer binaries to this environment.
ENV PATH /var/www/html/wp-content/plugins/vendor/bin:$PATH

Expand Down
1 change: 1 addition & 0 deletions local/public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*
* @see https://github.com/docker-library/wordpress/blob/e665dbf6044556ace612e09ce1e01d92bb8d6a34/latest/php8.0/fpm/docker-entrypoint.sh#L71-L96
*
* @package XWP\Vip_Site_Template
*/

require_once __DIR__ . '/wp/index.php';
2 changes: 1 addition & 1 deletion local/public/wp-cli.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Update the `setup` script in package.json to configure the correct type of site.
url: local.devgo.vip
url: local.wpenv.net
path: wp

# Single site config.
Expand Down
Loading

0 comments on commit 820bb24

Please sign in to comment.