Initial commit

This commit is contained in:
Zhongwei Li
2025-11-30 08:43:27 +08:00
commit e082963336
43 changed files with 6129 additions and 0 deletions

View File

@@ -0,0 +1,74 @@
#!/bin/bash
## Description: Render TYPO3 extension documentation to HTML
## Usage: docs
## Example: "ddev docs"
set -e
PROJECT_DIR="$(pwd)"
DOC_SOURCE="${PROJECT_DIR}/Documentation"
DOC_OUTPUT="${PROJECT_DIR}/Documentation-GENERATED-temp"
echo "📚 Rendering TYPO3 Extension Documentation"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
# Check if Documentation directory exists
if [ ! -d "$DOC_SOURCE" ]; then
echo "❌ Error: Documentation directory not found"
echo "💡 Tip: Create a Documentation/ directory with Index.rst to get started"
exit 1
fi
# Check if Index.rst exists
if [ ! -f "$DOC_SOURCE/Index.rst" ]; then
echo "❌ Error: Index.rst not found in Documentation/"
echo "💡 Tip: Create Documentation/Index.rst as the main entry point"
exit 1
fi
echo "📖 Source: Documentation/"
echo "📦 Output: Documentation-GENERATED-temp/"
echo ""
# Clean previous output
if [ -d "$DOC_OUTPUT" ]; then
echo "🧹 Cleaning previous documentation build..."
rm -rf "$DOC_OUTPUT"
fi
# Render documentation using TYPO3's official docker image
echo "🔨 Rendering documentation with TYPO3 render-guides..."
echo ""
docker run --rm \
-v "${PROJECT_DIR}:/project" \
--user "$(id -u):$(id -g)" \
ghcr.io/typo3-documentation/render-guides:latest \
--no-progress \
--output=/project/Documentation-GENERATED-temp \
/project/Documentation 2>&1
if [ $? -eq 0 ]; then
# Check for output files (structure may vary)
if [ -f "$DOC_OUTPUT/Result/project/0.0.0/Index.html" ] || \
[ -f "$DOC_OUTPUT/Index.html" ] || \
[ -d "$DOC_OUTPUT" ]; then
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "✅ Documentation rendered successfully!"
echo ""
echo "🌐 View at: https://docs.$(ddev describe -j | jq -r .raw.name).ddev.site/"
echo "📁 Output: Documentation-GENERATED-temp/"
echo ""
else
echo ""
echo "⚠️ Build completed but output structure unclear"
echo "📁 Check: Documentation-GENERATED-temp/"
fi
else
echo ""
echo "❌ Documentation rendering failed"
echo "💡 Check your .rst files for syntax errors"
exit 1
fi

View File

@@ -0,0 +1,17 @@
#!/bin/bash
## Description: Capture git info for landing page before container build
## Usage: Runs automatically before ddev start
## Example: "ddev start"
# Get git info from host
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "unknown")
GIT_COMMIT=$(git rev-parse --short HEAD 2>/dev/null || echo "unknown")
GIT_PR=$(gh pr view --json number 2>/dev/null | jq -r '.number // "unknown"' || echo "unknown")
# Export for docker-compose to use
export DDEV_GIT_BRANCH="$GIT_BRANCH"
export DDEV_GIT_COMMIT="$GIT_COMMIT"
export DDEV_GIT_PR="$GIT_PR"
echo "Git info captured: $GIT_BRANCH @ $GIT_COMMIT (PR: $GIT_PR)"

View File

@@ -0,0 +1,41 @@
#!/bin/bash
## Description: Complete setup - docs, install TYPO3, configure extension
## Usage: setup
## Example: "ddev setup"
set -e
echo "🚀 Complete DDEV Environment Setup"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
# Step 1: Render documentation
echo "📚 Step 1/3: Rendering documentation..."
if [ -d "/var/www/${EXTENSION_KEY}/Documentation" ]; then
ddev docs
else
echo "⚠️ No Documentation/ directory found, skipping docs rendering"
fi
echo ""
# Step 2: Install TYPO3
echo "🌐 Step 2/3: Installing TYPO3..."
ddev exec /mnt/ddev_config/commands/web/install-all
echo ""
# Done
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "✅ Setup Complete!"
echo ""
echo "🌐 Access Your Environment:"
echo " Overview: https://${DDEV_SITENAME}.ddev.site/"
echo " Documentation: https://docs.${DDEV_SITENAME}.ddev.site/"
echo " TYPO3 v11: https://v11.${DDEV_SITENAME}.ddev.site/"
echo " TYPO3 v12: https://v12.${DDEV_SITENAME}.ddev.site/"
echo " TYPO3 v13: https://v13.${DDEV_SITENAME}.ddev.site/"
echo ""
echo "🔑 Backend Login:"
echo " Username: admin"
echo " Password: Password:joh316"
echo ""

View File

@@ -0,0 +1,16 @@
#!/bin/bash
## Description: Install all TYPO3 versions (11, 12, 13) with your extension
## Usage: install-all
## Example: ddev install-all
echo "Installing TYPO3 11.5 LTS..."
/mnt/ddev_config/commands/web/install-v11
echo "Installing TYPO3 12.4 LTS..."
/mnt/ddev_config/commands/web/install-v12
echo "Installing TYPO3 13.4 LTS..."
/mnt/ddev_config/commands/web/install-v13
echo "✅ All TYPO3 versions installed successfully!"

View File

@@ -0,0 +1,54 @@
#!/bin/bash
## Description: Install TYPO3 11.5 LTS with your extension
## Usage: install-v11
## Example: ddev install-v11
VERSION=v11
rm -rf /var/www/html/$VERSION/*
mkdir -p /var/www/html/$VERSION/
echo "{}" > /var/www/html/$VERSION/composer.json
composer config extra.typo3/cms.web-dir public -d /var/www/html/$VERSION
composer config repositories.$EXTENSION_KEY path ../../$EXTENSION_KEY -d /var/www/html/$VERSION
composer config --no-plugins allow-plugins.typo3/cms-composer-installers true -d /var/www/html/$VERSION
composer config --no-plugins allow-plugins.typo3/class-alias-loader true -d /var/www/html/$VERSION
composer req t3/cms:'^11' $PACKAGE_NAME:'*@dev' --no-progress -n -d /var/www/html/$VERSION
composer req typo3/cms-extensionmanager --no-progress -n -d /var/www/html/$VERSION
composer req --dev typo3/cms-styleguide --no-progress -n -d /var/www/html/$VERSION
composer req typo3/cms-introduction --no-progress -n -d /var/www/html/$VERSION
cd /var/www/html/$VERSION
TYPO3_INSTALL_DB_DBNAME=$VERSION
vendor/bin/typo3cms install:setup -n --database-name $VERSION
vendor/bin/typo3cms configuration:set 'BE/debug' 1
vendor/bin/typo3cms configuration:set 'FE/debug' 1
vendor/bin/typo3cms configuration:set 'SYS/devIPmask' '*'
vendor/bin/typo3cms configuration:set 'SYS/displayErrors' 1
vendor/bin/typo3cms configuration:set 'SYS/trustedHostsPattern' '.*\.{{DDEV_SITENAME}}\.ddev\.site'
vendor/bin/typo3cms configuration:set 'MAIL/transport' 'smtp'
vendor/bin/typo3cms configuration:set 'MAIL/transport_smtp_server' 'localhost:1025'
vendor/bin/typo3cms configuration:set 'GFX/processor' 'ImageMagick'
vendor/bin/typo3cms configuration:set 'GFX/processor_path' '/usr/bin/'
vendor/bin/typo3cms configuration:set 'GFX/processor_path_lzw' '/usr/bin/'
sed -i "/'deprecations'/,/^[[:space:]]*'disabled' => true,/s/'disabled' => true,/'disabled' => false,/" /var/www/html/$VERSION/public/typo3conf/LocalConfiguration.php
sed -i -e "s/base: ht\//base: \//g" /var/www/html/$VERSION/config/sites/main/config.yaml
sed -i -e 's/base: \/en\//base: \//g' /var/www/html/$VERSION/config/sites/main/config.yaml
vendor/bin/typo3cms cache:flush
echo ""
echo "✅ TYPO3 $VERSION installation complete!"
echo "📦 Your extension is activated and ready to use"
echo "📐 TYPO3 Styleguide is available for UI pattern reference"
echo "📦 Introduction Package installed with demo content (86+ pages, 226+ content elements)"
# Auto-configure extension if configure script exists
if [ -f "/mnt/ddev_config/commands/web/configure-{{EXTENSION_KEY}}" ]; then
echo ""
echo "🔧 Auto-configuring {{EXTENSION_KEY}} extension..."
/mnt/ddev_config/commands/web/configure-{{EXTENSION_KEY}} $VERSION
fi

View File

@@ -0,0 +1,54 @@
#!/bin/bash
## Description: Install TYPO3 12.4 LTS with your extension
## Usage: install-v12
## Example: ddev install-v12
VERSION=v12
rm -rf /var/www/html/$VERSION/*
mkdir -p /var/www/html/$VERSION/
echo "{}" > /var/www/html/$VERSION/composer.json
composer config extra.typo3/cms.web-dir public -d /var/www/html/$VERSION
composer config repositories.$EXTENSION_KEY path ../../$EXTENSION_KEY -d /var/www/html/$VERSION
composer config --no-plugins allow-plugins.typo3/cms-composer-installers true -d /var/www/html/$VERSION
composer config --no-plugins allow-plugins.typo3/class-alias-loader true -d /var/www/html/$VERSION
composer req t3/cms:'^12' $PACKAGE_NAME:'*@dev' --no-progress -n -d /var/www/html/$VERSION
composer req typo3/cms-extensionmanager --no-progress -n -d /var/www/html/$VERSION
composer req --dev typo3/cms-styleguide --no-progress -n -d /var/www/html/$VERSION
composer req typo3/cms-introduction --no-progress -n -d /var/www/html/$VERSION
cd /var/www/html/$VERSION
TYPO3_INSTALL_DB_DBNAME=$VERSION
vendor/bin/typo3 install:setup -n --database-name $VERSION
vendor/bin/typo3 configuration:set 'BE/debug' 1
vendor/bin/typo3 configuration:set 'FE/debug' 1
vendor/bin/typo3 configuration:set 'SYS/devIPmask' '*'
vendor/bin/typo3 configuration:set 'SYS/displayErrors' 1
vendor/bin/typo3 configuration:set 'SYS/trustedHostsPattern' '.*\.{{DDEV_SITENAME}}\.ddev\.site'
vendor/bin/typo3 configuration:set 'MAIL/transport' 'smtp'
vendor/bin/typo3 configuration:set 'MAIL/transport_smtp_server' 'localhost:1025'
vendor/bin/typo3 configuration:set 'MAIL/defaultMailFromAddress' 'admin@example.com'
vendor/bin/typo3 configuration:set 'GFX/processor' 'ImageMagick'
vendor/bin/typo3 configuration:set 'GFX/processor_path' '/usr/bin/'
sed -i "/'deprecations'/,/^[[:space:]]*'disabled' => true,/s/'disabled' => true,/'disabled' => false,/" /var/www/html/$VERSION/config/system/settings.php
sed -i -e "s/base: ht\//base: \//g" /var/www/html/$VERSION/config/sites/main/config.yaml
sed -i -e 's/base: \/en\//base: \//g' /var/www/html/$VERSION/config/sites/main/config.yaml
vendor/bin/typo3 cache:flush
echo ""
echo "✅ TYPO3 $VERSION installation complete!"
echo "📦 Your extension is activated and ready to use"
echo "📐 TYPO3 Styleguide is available for UI pattern reference"
echo "📦 Introduction Package installed with demo content (86+ pages, 226+ content elements)"
# Auto-configure extension if configure script exists
if [ -f "/mnt/ddev_config/commands/web/configure-{{EXTENSION_KEY}}" ]; then
echo ""
echo "🔧 Auto-configuring {{EXTENSION_KEY}} extension..."
/mnt/ddev_config/commands/web/configure-{{EXTENSION_KEY}} $VERSION
fi

View File

@@ -0,0 +1,56 @@
#!/bin/bash
## Description: Install TYPO3 13.4 LTS with your extension
## Usage: install-v13
## Example: ddev install-v13
VERSION=v13
rm -rf /var/www/html/$VERSION/*
mkdir -p /var/www/html/$VERSION/
echo "{}" > /var/www/html/$VERSION/composer.json
composer config extra.typo3/cms.web-dir public -d /var/www/html/$VERSION
composer config repositories.$EXTENSION_KEY path ../../$EXTENSION_KEY -d /var/www/html/$VERSION
composer config --no-plugins allow-plugins.typo3/cms-composer-installers true -d /var/www/html/$VERSION
composer config --no-plugins allow-plugins.typo3/class-alias-loader true -d /var/www/html/$VERSION
composer req t3/cms:'^13' $PACKAGE_NAME:'*@dev' --no-progress -n -d /var/www/html/$VERSION
composer req typo3/cms-extensionmanager --no-progress -n -d /var/www/html/$VERSION
composer req --dev typo3/cms-styleguide --no-progress -n -d /var/www/html/$VERSION
composer req typo3/cms-introduction --no-progress -n -d /var/www/html/$VERSION
cd /var/www/html/$VERSION
mysql -h db -u root -p"root" -e "DROP DATABASE IF EXISTS ${VERSION};"
mysql -h db -u root -p"root" -e "CREATE DATABASE ${VERSION};"
vendor/bin/typo3 setup -n --dbname=$VERSION --password=$TYPO3_DB_PASSWORD --create-site="https://${VERSION}.{{DDEV_SITENAME}}.ddev.site" --admin-user-password=$TYPO3_SETUP_ADMIN_PASSWORD
vendor/bin/typo3 configuration:set 'BE/debug' 1
vendor/bin/typo3 configuration:set 'FE/debug' 1
vendor/bin/typo3 configuration:set 'SYS/devIPmask' '*'
vendor/bin/typo3 configuration:set 'SYS/displayErrors' 1
vendor/bin/typo3 configuration:set 'SYS/trustedHostsPattern' '.*\.{{DDEV_SITENAME}}\.ddev\.site'
vendor/bin/typo3 configuration:set 'MAIL/transport' 'smtp'
vendor/bin/typo3 configuration:set 'MAIL/transport_smtp_server' 'localhost:1025'
vendor/bin/typo3 configuration:set 'MAIL/defaultMailFromAddress' 'admin@example.com'
vendor/bin/typo3 configuration:set 'GFX/processor' 'ImageMagick'
vendor/bin/typo3 configuration:set 'GFX/processor_path' '/usr/bin/'
sed -i "/'deprecations'/,/^[[:space:]]*'disabled' => true,/s/'disabled' => true,/'disabled' => false,/" /var/www/html/$VERSION/config/system/settings.php
vendor/bin/typo3 extension:setup
vendor/bin/typo3 cache:flush
echo ""
echo "✅ TYPO3 $VERSION installation complete!"
echo "📦 Your extension is activated and ready to use"
echo "📐 TYPO3 Styleguide is available for UI pattern reference"
echo "📦 Introduction Package installed with demo content (86+ pages, 226+ content elements)"
# Auto-configure extension if configure script exists
if [ -f "/mnt/ddev_config/commands/web/configure-{{EXTENSION_KEY}}" ]; then
echo ""
echo "🔧 Auto-configuring {{EXTENSION_KEY}} extension..."
/mnt/ddev_config/commands/web/configure-{{EXTENSION_KEY}} $VERSION
fi

View File

@@ -0,0 +1,113 @@
#!/bin/bash
## Description: Auto-configure your TYPO3 extension with demo content and settings
## Usage: configure-extension [VERSION]
## Example: ddev configure-extension v13
VERSION=${1:-v13}
INSTALL_DIR=/var/www/html/$VERSION
echo "🔧 Configuring {{EXTENSION_KEY}} extension for $VERSION..."
# Install Introduction Package for demo content
echo "📦 Installing TYPO3 Introduction Package..."
composer require typo3/cms-introduction --no-progress -d $INSTALL_DIR
# Activate Introduction extension
echo "✅ Activating Introduction extension..."
cd $INSTALL_DIR
vendor/bin/typo3 extension:setup --extension=introduction
# Remove default "main" site created by typo3 setup (Introduction creates its own site)
echo "🧹 Removing default site (Introduction package provides its own)..."
rm -rf $INSTALL_DIR/config/sites/main
# Optional: Create site package for extension-specific configuration
# Uncomment and customize for extensions needing RTE, TsConfig, or TypoScript setup
# echo "📝 Creating site configuration package..."
# mkdir -p $INSTALL_DIR/public/typo3conf/ext/site_config/Configuration
#
# cat > $INSTALL_DIR/public/typo3conf/ext/site_config/ext_emconf.php << 'EOF'
# <?php
# $EM_CONF[$_EXTKEY] = [
# 'title' => 'Site Configuration',
# 'description' => 'Configuration for {{EXTENSION_KEY}}',
# 'category' => 'templates',
# 'state' => 'stable',
# 'version' => '1.0.0',
# 'constraints' => [
# 'depends' => [
# 'typo3' => '13.4.0-13.4.99',
# '{{EXTENSION_KEY}}' => '',
# ],
# ],
# ];
# EOF
# Example: RTE configuration for CKEditor plugins
# IMPORTANT: When defining editor.config, YAML replaces the entire block instead of merging!
# DO NOT override importModules or externalPlugins - let Plugin.yaml handle them.
#
# mkdir -p $INSTALL_DIR/public/typo3conf/ext/site_config/Configuration/RTE
#
# cat > $INSTALL_DIR/public/typo3conf/ext/site_config/Configuration/RTE/Default.yaml << 'EOF'
# imports:
# - { resource: "EXT:rte_ckeditor/Configuration/RTE/Default.yaml" }
# - { resource: "EXT:{{EXTENSION_KEY}}/Configuration/RTE/Plugin.yaml" }
#
# editor:
# config:
# # IMPORTANT: DO NOT override importModules here!
# # Plugin.yaml provides: importModules: ['@vendor/extension/Plugins/myplugin.js']
# # Plugin.yaml provides: externalPlugins: { myplugin: { route: ... } }
# # If you need html-support, add it to Plugin.yaml or merge arrays properly
#
# toolbar:
# items:
# - heading
# - '|'
# - bold
# - italic
# # Add your custom toolbar buttons here
# EOF
# Example: Page TSConfig
# mkdir -p $INSTALL_DIR/public/typo3conf/ext/site_config/Configuration/TsConfig/Page
#
# cat > $INSTALL_DIR/public/typo3conf/ext/site_config/Configuration/TsConfig/Page/Config.tsconfig << 'EOF'
# # Add your Page TSConfig here
# # Example: RTE.default.preset = default
# EOF
# IMPORTANT: If creating site_config extension, you must register it!
# Since site_config is not a composer-installed extension, ext_localconf.php
# and ext_tables.php won't be loaded automatically. Instead:
#
# 1. Register RTE preset in AdditionalConfiguration.php:
# cat >> $INSTALL_DIR/config/system/additional.php << 'EOF'
#
# // Register custom RTE preset
# $GLOBALS['TYPO3_CONF_VARS']['RTE']['Presets']['default'] = 'EXT:site_config/Configuration/RTE/Default.yaml';
# EOF
#
# 2. Add Page TSConfig to site configuration:
# cat >> $INSTALL_DIR/config/sites/introduction/config.yaml << 'EOF'
# pagesTsConfig:
# 'RTE.default.preset': 'default'
# EOF
# Flush caches
echo "🧹 Flushing caches..."
cd $INSTALL_DIR
vendor/bin/typo3 cache:flush
echo "✅ Extension configuration complete!"
echo ""
echo "📌 Access your TYPO3 installation:"
echo " Frontend: https://$VERSION.{{DDEV_SITENAME}}.ddev.site/"
echo " Backend: https://$VERSION.{{DDEV_SITENAME}}.ddev.site/typo3/"
echo " Username: admin"
echo " Password: Password:joh316"
echo ""
echo "🎨 Your extension is now configured and ready to test!"

View File

@@ -0,0 +1,17 @@
#!/bin/bash
## Description: Generate index.html overview page
## Usage: generate-index
## Example: ddev generate-index
EXTENSION_KEY=$(basename "$(pwd)")
DDEV_PROJECT=$(ddev describe -j | jq -r '.name' 2>/dev/null || echo "$EXTENSION_KEY")
# Simple sed-based substitution
sed -e "s/{{EXTENSION_NAME}}/$EXTENSION_KEY/g" \
-e "s/{{EXTENSION_KEY}}/$EXTENSION_KEY/g" \
-e "s/{{DDEV_PROJECT}}/$DDEV_PROJECT/g" \
/var/www/html/.ddev/index.html.template > /var/www/html/index.html
echo "✅ index.html generated successfully!"
echo "Access your project at: http://$DDEV_PROJECT.ddev.site/"

View File

@@ -0,0 +1,17 @@
#!/bin/bash
## Description: Generate Makefile for TYPO3 extension development
## Usage: generate-makefile
## Example: ddev generate-makefile
EXTENSION_KEY=$(basename "$(pwd)")
DDEV_PROJECT=$(ddev describe -j | jq -r '.name' 2>/dev/null || echo "$EXTENSION_KEY")
# Simple sed-based substitution
sed -e "s/{{EXTENSION_NAME}}/$EXTENSION_KEY/g" \
-e "s/{{EXTENSION_KEY}}/$EXTENSION_KEY/g" \
-e "s/{{DDEV_PROJECT}}/$DDEV_PROJECT/g" \
/var/www/html/.ddev/Makefile.template > /var/www/html/Makefile
echo "✅ Makefile generated successfully!"
echo "Run 'make help' to see available commands"

View File

@@ -0,0 +1,33 @@
#!/bin/bash
## Description: Install TYPO3 Introduction Package with demo content
## Usage: install-introduction [VERSION]
## Example: ddev install-introduction
## Example: ddev install-introduction v13
VERSION=${1:-v13}
echo "Installing Introduction Package for $VERSION..."
cd /var/www/html/$VERSION
# Install introduction package
composer require typo3/cms-introduction --no-progress
# Setup extension
vendor/bin/typo3 extension:setup --extension=introduction
# Flush caches
vendor/bin/typo3 cache:flush
echo "✅ Introduction Package installed successfully!"
echo ""
echo "Demo content includes:"
echo " - 86+ pages with example content"
echo " - 226+ content elements"
echo " - Multi-language support (EN, DE, DA)"
echo " - Bootstrap Package theme"
echo ""
echo "Access your demo site at:"
echo " Frontend: https://${DDEV_SITENAME}.ddev.site/"
echo " Backend: https://${DDEV_SITENAME}.ddev.site/typo3/"