Skip to content

Commit

Permalink
build: add ddev switch typo3 version command
Browse files Browse the repository at this point in the history
  • Loading branch information
jackd248 committed Dec 27, 2024
1 parent ae480a9 commit 6d81504
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .ddev/commands/web/.install-12
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

## Description: Install TYPO3 12 integration instance.
## Usage: install
## Example: "ddev install 12"

set +x
set -e

. .ddev/commands/web/.utils.sh

restoreComposerFiles
composer install --no-progress --no-interaction

vendor/bin/typo3 database:updateschema
vendor/bin/typo3 cache:flush
21 changes: 21 additions & 0 deletions .ddev/commands/web/.install-13
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

## Description: Install TYPO3 13 integration instance.
## Usage: install
## Example: "ddev install 13"

set +x
set -e

. .ddev/commands/web/.utils.sh

stashComposerFiles

composer remove saschaegerer/phpstan-typo3 --dev --no-interaction
composer require typo3/cms-backend:'^13.4' typo3/cms-beuser:'^13.4' typo3/cms-core:'^13.4' \
typo3/cms-extbase:'^13.4' typo3/cms-frontend:'^13.4' \
--dev typo3/cms-base-distribution:'^13.4' typo3/cms-lowlevel:'^13.4' ssch/typo3-rector:'^3.0' \
--no-progress --no-interaction

vendor/bin/typo3 database:updateschema
vendor/bin/typo3 cache:flush
47 changes: 47 additions & 0 deletions .ddev/commands/web/.utils.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

stashComposerFiles() {
cp composer.json composer.json.orig
}

restoreComposerFiles() {
local exit_status=$?
if [ -f "composer.json.orig" ]; then
mv composer.json.orig composer.json
local message='composer.json has been restored.'
if [ $exit_statusq 0 ]; then
message green "${message}"
else
message red "${message}"
fi
fi
}

message() {
local color=$1
local message=$2

case $color in
red)
echo "\033[31m$message\033[0m"
;;
green)
echo "\033[32m$message\033[0m"
;;
yellow)
echo "\033[33m$message\033[0m"
;;
blue)
echo "\033[34m$message\033[0m"
;;
magenta)
echo "\033[35m$message\033[0m"
;;
cyan)
echo "\033[36m$message\033[0m"
;;
*)
echo "$message"
;;
esac
}
14 changes: 14 additions & 0 deletions .ddev/commands/web/install
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

## Description: Install TYPO3 instance.
## Usage: install
## Example: "ddev install 12"

TYPO3=${1}

if [ -f ".ddev/commands/web/.install-$TYPO3" ]; then
sh .ddev/commands/web/.install-$TYPO3
else
echo "Error: version $TYPO3 not support."
exit 1
fi
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,15 @@ Wrong return url
This could be caused by a strict referer header in your request. If the return url could not be determined correctly, you can force the url generation by pid and language in the extension setting: `forceReturnUrlGeneration`.
</details>

## Development

Use the following ddev commands to easily switch the local TYPO3 versions.

```bash
ddev install 12
ddev install 13
```

## License

This project is licensed
Expand Down

0 comments on commit 6d81504

Please sign in to comment.