From b2e4920aa2c92a6b8f84f443c47857b701fb7034 Mon Sep 17 00:00:00 2001 From: rugk Date: Thu, 24 Aug 2023 21:41:50 +0000 Subject: [PATCH 1/2] feat: add basic support for debugging and working with devcontainer For GitHub Codespaces e.g. --- .devcontainer/devcontainer.json | 46 +++++++++++++++++++++++++++++++++ .vscode/extensions.json | 7 +++++ .vscode/launch.json | 35 +++++++++++++++++++++++++ 3 files changed, 88 insertions(+) create mode 100644 .devcontainer/devcontainer.json create mode 100644 .vscode/extensions.json create mode 100644 .vscode/launch.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..16917098 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,46 @@ +{ + "name": "PHP", + "image": "mcr.microsoft.com/devcontainers/php", + "customizations": { + "vscode": { + "extensions": [ + "github.codespaces", + // PHP from https://github.com/devcontainers/templates/tree/main/src/php + "xdebug.php-debug", + "bmewburn.vscode-intelephense-client", + "xdebug.php-pack", + // PHP + "DEVSENSE.phptools-vscode", + "DEVSENSE.composer-php-vscode", + // linting + "EditorConfig.EditorConfig", + "dbaeumer.vscode-eslint", + "raymondcamden.CSSLint", + // testing + "maty.vscode-mocha-sidebar" + ] + }, + "codespaces": { + "repositories": { + "PrivateBin/*": { + "permissions": { + "pull_requests": "write" + } + } + } + } + }, + "features": { + "ghcr.io/devcontainers-contrib/features/mocha:2": {} + }, + "forwardPorts": [ + 8080 + ], + "postCreateCommand": [ + "composer install --no-dev --optimize-autoloader", + "sudo chmod a+x \"$(pwd)\" && sudo rm -rf /var/www/html && sudo ln -s \"$(pwd)\" /var/www/html", + "npm install --global nyc" + ], + // alternatiuve: apache2ctl start (but requires root) + "postAttachCommand": "php -S 0.0.0.0:8080" +} diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 00000000..eea5315d --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,7 @@ +{ + "recommendations": [ + "recca0120.vscode-phpunit", + "onecentlin.phpunit-snippets", + "devsense.profiler-php-vscode" + ] +} diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..e62f41ff --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,35 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Launch built-in server and debug", + "type": "php", + "request": "launch", + "runtimeArgs": [ + "-S", + "localhost:8000", + "-t", + "." + ], + "port": 9003, + "serverReadyAction": { + "action": "openExternally" + } + }, + { + "name": "Debug current script in console", + "type": "php", + "request": "launch", + "program": "${file}", + "cwd": "${fileDirname}", + "externalConsole": false, + "port": 9003 + }, + { + "name": "Listen for Xdebug", + "type": "php", + "request": "launch", + "port": 9003 + } + ] +} From 664a8fff0868a60c75a9837dda1682256a9ae665 Mon Sep 17 00:00:00 2001 From: rugk Date: Thu, 24 Aug 2023 22:08:45 +0000 Subject: [PATCH 2/2] feat: also open doc readme by default --- .devcontainer/devcontainer.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 16917098..a0c531ee 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -21,6 +21,10 @@ ] }, "codespaces": { + "openFiles": [ + "README.md", + "doc/README.md" + ], "repositories": { "PrivateBin/*": { "permissions": {