From 07368aff02b118a4f6f281b6a1f9b381306b6e38 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Vanhalle Date: Tue, 22 Oct 2024 20:07:47 +0200 Subject: [PATCH] adds default launch.json for laravel, livewire and php project --- create.sh | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/create.sh b/create.sh index a3ff2bd..f4d0daa 100755 --- a/create.sh +++ b/create.sh @@ -137,6 +137,45 @@ if [ "${PROJECT_TYPE}" = "wintercms" ]; then docker exec --user www-data --workdir "/var/www/html" -it "${PREFIX}-app" /bin/sh -c "php artisan winter:install" fi +if [ "${PROJECT_TYPE}" = "laravel" ] || [ "${PROJECT_TYPE}" = "livewire" ] || [ "${PROJECT_TYPE}" = "php" ]; then + echo "Generating vscode launch.json file" + cat << EOF > /tmp/${PREFIX}/launch.json +{ + "version": "0.2.0", + "configurations": [ + { + "hostname": "${TRAEFIK_LISTENING_IP}", + "name": "Listen for Xdebug (${TRAEFIK_LISTENING_IP})", + "pathMappings": { + "/var/www/html/": "\${workspaceRoot}/", + }, + "port": 9003, + "request": "launch", + "type": "php" + } + ] +} +EOF + docker run \ + --rm \ + --user www-data \ + --volume "${PREFIX}-app":/destination \ + ubuntu \ + mkdir --parents /destination/.vscode + docker run \ + --rm \ + --user www-data \ + --volume "${PREFIX}-app":/destination \ + ubuntu \ + cp /source/launch.json /destination/.vscode + docker run \ + --rm \ + --user root \ + --volume "${PREFIX}-app":/destination \ + ubuntu \ + chown www-data:www-data /destination/.vscode -r +fi + if [ "${PROJECT_TYPE}" = "wordpress" ]; then echo "Downloading WordPress core" docker exec --user www-data "${PREFIX}-app" /bin/sh -c "