From 0dfe5d8548cd2fa3f6dd5b858a524201fedbab89 Mon Sep 17 00:00:00 2001 From: Samuel Reina Date: Fri, 27 Feb 2026 12:21:44 +0100 Subject: [PATCH 1/9] Replace #!/bin/bash sebang with "#!/usr/bin/env bash" --- commands/host/1x-granite | 2 +- commands/host/1x-playwright | 2 +- commands/host/1x-playwright-install | 2 +- commands/host/1x-start | 2 +- commands/host/1x-theme-debug | 2 +- commands/host/1x-token-setup | 2 +- commands/host/1x-twig-debug | 2 +- commands/web/1x-phpcs | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/commands/host/1x-granite b/commands/host/1x-granite index 8f6515f..b7e101b 100755 --- a/commands/host/1x-granite +++ b/commands/host/1x-granite @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash ## #ddev-generated ## Description: Build granite ## Usage: granite 1x-granite diff --git a/commands/host/1x-playwright b/commands/host/1x-playwright index 319be88..9579c31 100755 --- a/commands/host/1x-playwright +++ b/commands/host/1x-playwright @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash ## #ddev-generated ## Description: Run lullabot/ddev-playwright commands in a slightly more sane way :) diff --git a/commands/host/1x-playwright-install b/commands/host/1x-playwright-install index 62368b4..f50d73a 100755 --- a/commands/host/1x-playwright-install +++ b/commands/host/1x-playwright-install @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash ## #ddev-generated ## Description: Install the lullabot/ddev-playwright addon and does some basic onex config. diff --git a/commands/host/1x-start b/commands/host/1x-start index 3c15917..3570885 100755 --- a/commands/host/1x-start +++ b/commands/host/1x-start @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash #ddev-generated ## Description: Starts the ddev project, runs auth and makes sure the .gitconfig is present. ## Usage: 1x-start diff --git a/commands/host/1x-theme-debug b/commands/host/1x-theme-debug index 3301231..322c388 100755 --- a/commands/host/1x-theme-debug +++ b/commands/host/1x-theme-debug @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash ## #ddev-generated ## Description: manage php config options ## Usage: 1x-theme-debug diff --git a/commands/host/1x-token-setup b/commands/host/1x-token-setup index 1bce68c..245a7bb 100644 --- a/commands/host/1x-token-setup +++ b/commands/host/1x-token-setup @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash ## #ddev-generated # Description: Setup GitLab tokens, composer gitlab tokens as well as npm gitlab tokens and npm scoped packages. # Usage: 1x-token-setup diff --git a/commands/host/1x-twig-debug b/commands/host/1x-twig-debug index 2933116..f4a2151 100755 --- a/commands/host/1x-twig-debug +++ b/commands/host/1x-twig-debug @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash ## #ddev-generated ## Description: Enables or disables Twig debugging for Drupal 10 installations ## Usage: 1x-twig-debug diff --git a/commands/web/1x-phpcs b/commands/web/1x-phpcs index 538006b..dc4df36 100644 --- a/commands/web/1x-phpcs +++ b/commands/web/1x-phpcs @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash ## #ddev-generated ## Description: Run phpcs within the web container ## Usage: 1x-phpcs From a2d7bac2e7e41af3b5205a67f99ad8c5aeeda44f Mon Sep 17 00:00:00 2001 From: Samuel Reina Date: Fri, 27 Feb 2026 12:50:25 +0100 Subject: [PATCH 2/9] Added 1x-lib.sh helper script for compatible commands between platforms --- commands/host/1x-lib.sh | 48 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 commands/host/1x-lib.sh diff --git a/commands/host/1x-lib.sh b/commands/host/1x-lib.sh new file mode 100644 index 0000000..94af9bb --- /dev/null +++ b/commands/host/1x-lib.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash +# +# Shared helper library for 1x DDEV host commands. +# Source this from any 1x-* command with: +# source "${BASH_SOURCE%/*}/1x-lib.sh" +# +# No ## Usage: header, so DDEV will not register this as a command. + +# Cross-platform "sed" +sed_compat() { + case "$OSTYPE" in + darwin*) + # BSD sed (macOS) needs '' after -i + local args=() + for arg in "$@"; do + if [[ "$arg" == "-i" ]]; then + args+=("-i" "") + else + args+=("$arg") + fi + done + sed "${args[@]}" + ;; + linux*) + sed "$@" + ;; + *) + echo "sed_compat: unsupported platform: $OSTYPE" >&2 + return 1 + ;; + esac +} + +# Cross-platform "open" +open_compat() { + case "$OSTYPE" in + darwin*) + open "$@" + ;; + linux*) + xdg-open "$@" + ;; + *) + echo "open_compat: unsupported platform: $OSTYPE" >&2 + return 1 + ;; + esac +} From 8159027af58599f769ac9318cbb8c1bc89b3a8cd Mon Sep 17 00:00:00 2001 From: Samuel Reina Date: Fri, 27 Feb 2026 13:00:21 +0100 Subject: [PATCH 3/9] Replaced "sed" and "open" commands with their cross-platform compatible function --- commands/host/1x-playwright | 16 +++++++++------- commands/host/1x-theme-debug | 14 ++++---------- commands/host/1x-token-setup | 11 +++-------- 3 files changed, 16 insertions(+), 25 deletions(-) diff --git a/commands/host/1x-playwright b/commands/host/1x-playwright index 9579c31..a3269e2 100755 --- a/commands/host/1x-playwright +++ b/commands/host/1x-playwright @@ -6,6 +6,8 @@ ## Usage: 1x-playwright ## OSTypes: darwin,linux +source "${BASH_SOURCE%/*}/1x-lib.sh" + start=`date +%s` # Colors for printing messages. @@ -39,7 +41,7 @@ else host=$(ddev_hostname) playwright_report_url="https://${host}:9324" # Note: playwright "report server" hangs. - sleep 1 && open $playwright_report_url & jobs + sleep 1 && open_compat $playwright_report_url & jobs ddev playwright test "${@:2} --ui-host=0.0.0.0 --ui-port=9323" ;; @@ -47,7 +49,7 @@ else host=$(ddev_hostname) kasmvnc_url="https://${host}:8444" echo "Please note - if asked for authentication login is your username on the host (`whoami`) and the password is 'secret' (without the ')" - sleep 1 && open $kasmvnc_url & jobs + sleep 1 && open_compat $kasmvnc_url & jobs ddev playwright codegen "${@:2}" ;; @@ -62,7 +64,7 @@ else host=$(ddev_hostname) playwright_report_url="https://${host}:9324" # Note: playwright "report server" hangs. - sleep 1 && open $playwright_report_url & jobs + sleep 1 && open_compat $playwright_report_url & jobs ddev playwright show-report --host=0.0.0.0 ;; @@ -70,7 +72,7 @@ else host=$(ddev_hostname) kasmvnc_url="https://${host}:8444" # Note: playwright "ff|cr|wk" hangs. - sleep 1 && open $kasmvnc_url & jobs + sleep 1 && open_compat $kasmvnc_url & jobs echo "Please note - if asked for authentication login is your username on the host (`whoami`) and the password is 'secret' (without the ')" ddev playwright "$1" "${@:2}" ;; @@ -79,7 +81,7 @@ else host=$(ddev_hostname) kasmvnc_url="https://${host}:8444" # Note: playwright "ff|cr|wk" hangs. - sleep 1 && open $kasmvnc_url & jobs + sleep 1 && open_compat $kasmvnc_url & jobs echo "Please note - if asked for authentication login is your username on the host (`whoami`) and the password is 'secret' (without the ')" ddev playwright "$1" "${@:2}" ;; @@ -88,7 +90,7 @@ else host=$(ddev_hostname) kasmvnc_url="https://${host}:8444" # Note: playwright "ff|cr|wk" hangs. - sleep 1 && open $kasmvnc_url & jobs + sleep 1 && open_compat $kasmvnc_url & jobs echo "Please note - if asked for authentication login is your username on the host (`whoami`) and the password is 'secret' (without the ')" ddev playwright "$1" "${@:2}" ;; @@ -97,7 +99,7 @@ else host=$(ddev_hostname) kasmvnc_url="https://${host}:8444" echo "Please note - if asked for authentication login is your username on the host (`whoami`) and the password is 'secret' (without the ')" - open $kasmvnc_url + open_compat $kasmvnc_url ;; *) diff --git a/commands/host/1x-theme-debug b/commands/host/1x-theme-debug index 322c388..38671e7 100755 --- a/commands/host/1x-theme-debug +++ b/commands/host/1x-theme-debug @@ -4,6 +4,8 @@ ## Usage: 1x-theme-debug ## Example: "ddev 1x-theme-debug (enable|disable)" +source "${BASH_SOURCE%/*}/1x-lib.sh" + settings_dir="${DDEV_APPROOT}/${DDEV_DOCROOT}/sites/default" settings_local="settings.local.php" debug_services="services.theme_debug.yml" @@ -49,11 +51,7 @@ preflight() { fi # Delete the config always, so that enabling twice doesn't add it multiple times. - if [[ $OSTYPE == darwin* ]]; then - sed -i '' '/^#.*DO NOT WRITE ANYTHING BELOW THIS LINE/,$d' "${settings_dir}/${settings_local}" - else - sed -i '/^#.*DO NOT WRITE ANYTHING BELOW THIS LINE/,$d' "${settings_dir}/${settings_local}" - fi + sed_compat -i '/^#.*DO NOT WRITE ANYTHING BELOW THIS LINE/,$d' "${settings_dir}/${settings_local}" } enable_debug() { @@ -64,11 +62,7 @@ enable_debug() { echo "${debug_settings_php}" > "${settings_dir}/${debug_settings}" # Make sure the file ends with a new line - if [[ $OSTYPE == darwin* ]]; then - sed -i '' '$a\' "${settings_dir}/${settings_local}" - else - sed -i '$a\' "${settings_dir}/${settings_local}" - fi + sed_compat -i '$a\' "${settings_dir}/${settings_local}" echo -e "${debug_config_php}" >> "${settings_dir}/${settings_local}" } diff --git a/commands/host/1x-token-setup b/commands/host/1x-token-setup index 245a7bb..2b0e8e5 100644 --- a/commands/host/1x-token-setup +++ b/commands/host/1x-token-setup @@ -5,6 +5,8 @@ set -e +source "${BASH_SOURCE%/*}/1x-lib.sh" + # Stop the current DDEV project (if running). if ddev describe > /dev/null 2>&1; then ddev stop @@ -74,14 +76,7 @@ fi # Setup token for NPM # Remove old token if exists to replace with new one, or just append # A simple append might create duplicates, so let's try to be a bit smarter or just append as requested -# Make this work on MacOS and Linux >.< -if [[ $OSTYPE == darwin* ]]; then - # "in-place editing only works for regular files" thus change directly ~/.npmrc - sed -i '' '/\/\/git.1xinternet.de\/:_authToken=/d' ~/.npmrc -else - # "In-place editing" works also for symlinks on Linux, but for consistency's sake. - sed -i '/\/\/git.1xinternet.de\/:_authToken=/d' ~/.npmrc -fi +sed_compat -i '/\/\/git.1xinternet.de\/:_authToken=/d' ~/.npmrc echo "//git.1xinternet.de/:_authToken=${PERSONAL_ACCESS_TOKEN}" >> ~/.ddev/homeadditions/.npmrc # Configure NPM in homeadditions so the container picks it up. From f14577685ac7f8336adff065c1335611c2605775 Mon Sep 17 00:00:00 2001 From: Samuel Reina Date: Fri, 27 Feb 2026 13:05:15 +0100 Subject: [PATCH 4/9] Moved color definitions for output messages to common helper script --- commands/host/1x-lib.sh | 8 ++++++++ commands/host/1x-playwright | 7 ------- commands/host/1x-playwright-install | 6 ++---- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/commands/host/1x-lib.sh b/commands/host/1x-lib.sh index 94af9bb..88b452b 100644 --- a/commands/host/1x-lib.sh +++ b/commands/host/1x-lib.sh @@ -6,6 +6,14 @@ # # No ## Usage: header, so DDEV will not register this as a command. +# Colors for printing messages. +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +CYAN='\033[0;36m' +BROWN='\033[0;33m' +NC='\033[0m' # No Color + # Cross-platform "sed" sed_compat() { case "$OSTYPE" in diff --git a/commands/host/1x-playwright b/commands/host/1x-playwright index a3269e2..71063d3 100755 --- a/commands/host/1x-playwright +++ b/commands/host/1x-playwright @@ -10,13 +10,6 @@ source "${BASH_SOURCE%/*}/1x-lib.sh" start=`date +%s` -# Colors for printing messages. -RED='\033[0;31m' -CYAN='\033[0;36m' -GREEN='\033[0;32m' -BROWN='\033[0;33m' -NC='\033[0m' # No Color - if ! command -v jq 2>&1 >/dev/null then echo "Notice: jq command not found. Consider installing jq locally, using dockerized jq." diff --git a/commands/host/1x-playwright-install b/commands/host/1x-playwright-install index f50d73a..0f648a5 100755 --- a/commands/host/1x-playwright-install +++ b/commands/host/1x-playwright-install @@ -4,11 +4,9 @@ ## Description: Install the lullabot/ddev-playwright addon and does some basic onex config. ## Usage: 1x-playwright-install -start=`date +%s` +source "${BASH_SOURCE%/*}/1x-lib.sh" -# Colors for printing messages. -GREEN='\033[0;32m' -NC='\033[0m' # No Color +start=`date +%s` # Make sure the container is alive. ddev start From c30e55409bfa614e373714c443b2d43366bc3646 Mon Sep 17 00:00:00 2001 From: Samuel Reina Date: Fri, 27 Feb 2026 13:37:20 +0100 Subject: [PATCH 5/9] Added cross-platform compatible date_compact function for date commands --- commands/host/1x-lib.sh | 21 +++++++++++++++++++++ commands/host/1x-playwright | 2 +- commands/host/1x-playwright-install | 2 +- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/commands/host/1x-lib.sh b/commands/host/1x-lib.sh index 88b452b..2714155 100644 --- a/commands/host/1x-lib.sh +++ b/commands/host/1x-lib.sh @@ -39,6 +39,27 @@ sed_compat() { esac } +# Cross-platform "date" +date_compat() { + case "$OSTYPE" in + darwin*) + # BSD date (macOS) lacks GNU extensions + if command -v gdate >/dev/null 2>&1; then + gdate "$@" + else + date "$@" + fi + ;; + linux*) + date "$@" + ;; + *) + echo "date_compat: unsupported platform: $OSTYPE" >&2 + return 1 + ;; + esac +} + # Cross-platform "open" open_compat() { case "$OSTYPE" in diff --git a/commands/host/1x-playwright b/commands/host/1x-playwright index 71063d3..59a349f 100755 --- a/commands/host/1x-playwright +++ b/commands/host/1x-playwright @@ -8,7 +8,7 @@ source "${BASH_SOURCE%/*}/1x-lib.sh" -start=`date +%s` +start=`date_compat +%s` if ! command -v jq 2>&1 >/dev/null then diff --git a/commands/host/1x-playwright-install b/commands/host/1x-playwright-install index 0f648a5..01289d4 100755 --- a/commands/host/1x-playwright-install +++ b/commands/host/1x-playwright-install @@ -6,7 +6,7 @@ source "${BASH_SOURCE%/*}/1x-lib.sh" -start=`date +%s` +start=`date_compat +%s` # Make sure the container is alive. ddev start From 0500bb538807152cc2a1f4fdefc25fe736ac73ac Mon Sep 17 00:00:00 2001 From: Samuel Reina Date: Fri, 27 Feb 2026 15:54:33 +0100 Subject: [PATCH 6/9] Fix tokens removal command only removing the root level tokens and not all --- commands/host/1x-token-setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/host/1x-token-setup b/commands/host/1x-token-setup index 2b0e8e5..2f10b90 100644 --- a/commands/host/1x-token-setup +++ b/commands/host/1x-token-setup @@ -76,7 +76,7 @@ fi # Setup token for NPM # Remove old token if exists to replace with new one, or just append # A simple append might create duplicates, so let's try to be a bit smarter or just append as requested -sed_compat -i '/\/\/git.1xinternet.de\/:_authToken=/d' ~/.npmrc +sed_compat -i '/\/\/git.1xinternet.de\/.*:_authToken=/d' ~/.npmrc echo "//git.1xinternet.de/:_authToken=${PERSONAL_ACCESS_TOKEN}" >> ~/.ddev/homeadditions/.npmrc # Configure NPM in homeadditions so the container picks it up. From 97669a1528f17ea71200945056b5e3b691518bf4 Mon Sep 17 00:00:00 2001 From: Samuel Reina Date: Fri, 27 Feb 2026 15:58:34 +0100 Subject: [PATCH 7/9] Write the new auth token to ~/.npmrc instead of homeadditions --- commands/host/1x-token-setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/host/1x-token-setup b/commands/host/1x-token-setup index 2f10b90..9fb040a 100644 --- a/commands/host/1x-token-setup +++ b/commands/host/1x-token-setup @@ -77,7 +77,7 @@ fi # Remove old token if exists to replace with new one, or just append # A simple append might create duplicates, so let's try to be a bit smarter or just append as requested sed_compat -i '/\/\/git.1xinternet.de\/.*:_authToken=/d' ~/.npmrc -echo "//git.1xinternet.de/:_authToken=${PERSONAL_ACCESS_TOKEN}" >> ~/.ddev/homeadditions/.npmrc +echo "//git.1xinternet.de/:_authToken=${PERSONAL_ACCESS_TOKEN}" >> ~/.npmrc # Configure NPM in homeadditions so the container picks it up. # We append if not already present to avoid duplication From 3840ce31591ff923c0b13efa64ed01d412fe1a56 Mon Sep 17 00:00:00 2001 From: Samuel Reina Date: Fri, 27 Feb 2026 16:01:48 +0100 Subject: [PATCH 8/9] Fix for 1xinternet registry guard checking groups instead of project --- commands/host/1x-token-setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/host/1x-token-setup b/commands/host/1x-token-setup index 9fb040a..8803834 100644 --- a/commands/host/1x-token-setup +++ b/commands/host/1x-token-setup @@ -87,7 +87,7 @@ fi # Configure NPM in homeadditions so the container picks it up. # We append if not already present to avoid duplication -if ! grep -q "@1xINTERNET:registry=https://git.1xinternet.de/api/v4/group/1121/-/packages/npm/" ~/.ddev/homeadditions/.npmrc; then +if ! grep -q "@1xINTERNET:registry=https://git.1xinternet.de/api/v4/projects/1121/packages/npm/" ~/.ddev/homeadditions/.npmrc; then echo "@1xINTERNET:registry=https://git.1xinternet.de/api/v4/projects/1121/packages/npm/" >> ~/.ddev/homeadditions/.npmrc fi From 4d1a3885aefeed7e84fdcf7726af015b2378d5de Mon Sep 17 00:00:00 2001 From: Samuel Reina Date: Fri, 27 Feb 2026 16:03:30 +0100 Subject: [PATCH 9/9] Write all npmrc entries to ~/.npmrc instead of homeadditions --- commands/host/1x-token-setup | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/commands/host/1x-token-setup b/commands/host/1x-token-setup index 8803834..08f3337 100644 --- a/commands/host/1x-token-setup +++ b/commands/host/1x-token-setup @@ -81,14 +81,14 @@ echo "//git.1xinternet.de/:_authToken=${PERSONAL_ACCESS_TOKEN}" >> ~/.npmrc # Configure NPM in homeadditions so the container picks it up. # We append if not already present to avoid duplication -if ! grep -q "@dxp:registry=https://git.1xinternet.de/api/v4/groups/392/-/packages/npm/" ~/.ddev/homeadditions/.npmrc; then - echo "@dxp:registry=https://git.1xinternet.de/api/v4/groups/392/-/packages/npm/" >> ~/.ddev/homeadditions/.npmrc +if ! grep -q "@dxp:registry=https://git.1xinternet.de/api/v4/groups/392/-/packages/npm/" ~/.npmrc; then + echo "@dxp:registry=https://git.1xinternet.de/api/v4/groups/392/-/packages/npm/" >> ~/.npmrc fi # Configure NPM in homeadditions so the container picks it up. # We append if not already present to avoid duplication -if ! grep -q "@1xINTERNET:registry=https://git.1xinternet.de/api/v4/projects/1121/packages/npm/" ~/.ddev/homeadditions/.npmrc; then - echo "@1xINTERNET:registry=https://git.1xinternet.de/api/v4/projects/1121/packages/npm/" >> ~/.ddev/homeadditions/.npmrc +if ! grep -q "@1xINTERNET:registry=https://git.1xinternet.de/api/v4/projects/1121/packages/npm/" ~/.npmrc; then + echo "@1xINTERNET:registry=https://git.1xinternet.de/api/v4/projects/1121/packages/npm/" >> ~/.npmrc fi # Start the DDEV project (so containers run).