Skip to content
This repository has been archived by the owner on Oct 12, 2024. It is now read-only.

Commit

Permalink
fix: Updates dependencies & local development environment (#229)
Browse files Browse the repository at this point in the history
- Updates Composer dependencies to latest versions with support for PHP 8.0.
- Updates NPM dependencies to latest versions with support for Node 16.
- Removes `wp-env` and migrates to a Dev Container for local development.
- Updates linting configuration.
- Updates unit tests to pass linting testings.
- Updates unit testing to use new Dev Container & Docker setup.
- Fixes linting issues.
  • Loading branch information
timnolte authored Apr 28, 2024
1 parent 59d31f3 commit 5350e42
Show file tree
Hide file tree
Showing 63 changed files with 35,850 additions and 18,996 deletions.
47 changes: 0 additions & 47 deletions .devcontainer/Dockerfile

This file was deleted.

12 changes: 12 additions & 0 deletions .devcontainer/activate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

set -eu

# Activate the plugin.
cd "/app"
echo "Activating plugin..."
if ! wp plugin is-active woocommerce-local-pickup-time-select 2>/dev/null; then
wp plugin activate woocommerce-local-pickup-time-select --quiet
fi

echo "Done!"
108 changes: 69 additions & 39 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,71 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.192.0/containers/docker-in-docker
// For format details, https://containers.dev/implementors/json_reference/.
{
"name": "Docker in Docker",
"dockerFile": "Dockerfile",
"runArgs": ["--init", "--privileged"],
"mounts": ["source=dind-var-lib-docker,target=/var/lib/docker,type=volume"],
"overrideCommand": false,

// Set *default* container specific settings.json values on container create.
"settings": {},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-azuretools.vscode-docker",
"bmewburn.vscode-intelephense-client",
"claudiosanches.woocommerce",
"ddarkonen.phpstan-larastan",
"ecmel.vscode-html-css",
"editorconfig.editorconfig",
"github.codespaces",
"gitpod.gitpod-desktop",
"johnbillion.vscode-wordpress-hooks",
"ms-vscode-remote.remote-containers",
"ms-vscode-remote.remote-ssh",
"ms-vscode-remote.remote-ssh-edit",
"obliviousharmony.vscode-php-codesniffer"
],

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "npm run setup",

// Use 'postStartCommand' to run commands after the container has started.
"postStartCommand": "npm start -- --update",

// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
"name": "WordPress Development Environment",
"dockerComposeFile": "../docker-compose.yml",
"service": "app",
"mounts": ["source=dind-var-lib-docker,target=/var/lib/docker,type=volume"],
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",

"customizations": {
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-azuretools.vscode-docker",
"bmewburn.vscode-intelephense-client",
"claudiosanches.woocommerce",
"ddarkonen.phpstan-larastan",
"ecmel.vscode-html-css",
"editorconfig.editorconfig",
"github.codespaces",
"johnbillion.vscode-wordpress-hooks",
"ms-azuretools.vscode-docker",
"ms-vscode-remote.remote-containers",
"ms-vscode-remote.remote-ssh",
"ms-vscode-remote.remote-ssh-edit",
"obliviousharmony.vscode-php-codesniffer"
]
}
},

// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"./local-features/welcome-message": "latest"
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [8080, 8081, 8027, 3306],

// Maps a port number, "host:port" value, range, or regular expression to a set of default options. See port attributes for available options
"portsAttributes": {
"8080": {
"label": "WordPress Development/Testing Site"
},
"8081": {
"label": "phpMyAdmin"
},
"8027": {
"label": "MailHog"
},
"3306": {
"label": "MariaDB"
}
},

// Use `onCreateCommand` to run commands as part of the container creation.
//"onCreateCommand": "chmod +x .devcontainer/install.sh && .devcontainer/install.sh",

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "chmod +x .devcontainer/setup.sh && .devcontainer/setup.sh",

// Use 'postStartCommand' to run commands after the container has started.
"postStartCommand": "cd /app && wp --quiet plugin activate woocommerce-local-pickup-time-select",

// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "wp_php",

// A set of name-value pairs that sets or overrides environment variables for the devcontainer.json supporting service / tool (or sub-processes like terminals) but not the container as a whole.
"remoteEnv": { "LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}" }
}
Loading

0 comments on commit 5350e42

Please sign in to comment.