Skip to content

Commit 83392f6

Browse files
committed
feat: enhance integration scripts and README for Symfony and Laravel projects
1 parent e271465 commit 83392f6

File tree

4 files changed

+65
-25
lines changed

4 files changed

+65
-25
lines changed

booster/integrate_booster.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ IS_DDEV_PROJECT=0
2626
# Set the memory limit for Composer to unlimited (can help with large dependency trees)
2727
export COMPOSER_MEMORY_LIMIT=-1
2828

29+
# Set Symfony recipe auto-acceptance to avoid interactive prompts during composer require/update
30+
# This automatically accepts all recipes from both main and contrib repositories
31+
export SYMFONY_FLEX_RECIPES_AUTO_ACCEPT=1
32+
2933
# --- Helper Functions ---
3034

3135
function log() {
@@ -315,6 +319,15 @@ function update_package_json() {
315319
else
316320
warn "Blueprint 'commitlint.config.ts' not found. Skipping copy."
317321
fi
322+
323+
# Copy pnpm-workspace.yaml if it exists
324+
local booster_pnpm_workspace="${BOOSTER_INTERNAL_PATH}/pnpm-workspace.yaml"
325+
if [ -f "$booster_pnpm_workspace" ]; then
326+
cp "$booster_pnpm_workspace" . || warn "Failed to copy pnpm-workspace.yaml."
327+
success "pnpm-workspace.yaml copied."
328+
else
329+
warn "Blueprint 'pnpm-workspace.yaml' not found. Skipping copy."
330+
fi
318331
}
319332

320333
# --- Updated merge_scripts Function ---

booster/tools/git-hooks/setup.sh

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ readonly RUNNER_SCRIPT="./tools/runner.sh"
1111
# --- Environment Setup ---
1212
setup_environment() {
1313
readonly IS_CI_ENV="${CI:-}"
14-
14+
1515
# ANSI color codes for output formatting (only if interactive terminal)
1616
if [[ -t 1 ]]; then
1717
readonly RED='\033[0;31m'
@@ -77,59 +77,59 @@ EOF
7777
# --- Installation Functions ---
7878
setup_husky_directory() {
7979
echo "Setting up Husky directory..."
80-
80+
8181
if [ -d "$HUSKY_DIR" ]; then
8282
echo "Removing existing $HUSKY_DIR directory..."
8383
rm -rf "$HUSKY_DIR"
8484
fi
85-
85+
8686
mkdir "$HUSKY_DIR"
8787
echo "Created $HUSKY_DIR directory"
8888
}
8989

9090
copy_hook_files() {
9191
echo "Copying hook files from $HOOKS_SOURCE to $HUSKY_DIR..."
92-
92+
9393
if [ ! -d "$HOOKS_SOURCE" ]; then
9494
echo_color "${RED}ERROR: Hook source directory '$HOOKS_SOURCE' not found${NC}" >&2
9595
exit 1
9696
fi
97-
97+
9898
cp -r "$HOOKS_SOURCE"/* "$HUSKY_DIR/"
99-
99+
100100
# Make hooks executable
101101
chmod +x "$HUSKY_DIR"/*
102-
102+
103103
echo_color "${GREEN}Hook files copied and made executable${NC}"
104104
}
105105

106106
install_dependencies() {
107107
echo "Installing npm dependencies..."
108-
108+
109109
if ! bash "$RUNNER_SCRIPT" pnpm install; then
110110
echo_color "${RED}ERROR: Failed to install dependencies with pnpm${NC}" >&2
111111
exit 1
112112
fi
113-
113+
114114
echo_color "${GREEN}Dependencies installed successfully${NC}"
115115
}
116116

117117
# --- Main Execution ---
118118
main() {
119119
setup_environment
120-
120+
121121
if should_skip_in_ci; then
122122
exit 0
123123
fi
124-
124+
125125
echo "Installing Git hooks..."
126-
126+
127127
check_runner_available
128128
check_pnpm_installed
129129
setup_husky_directory
130130
copy_hook_files
131131
install_dependencies
132-
132+
133133
echo_color "${GREEN}Git hooks installation completed successfully!${NC}"
134134
}
135135

tools/internal-test/README.md

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ Run the comprehensive Python test script for full end-to-end testing:
1111
./test-integration.py
1212

1313
# Full test with specific framework
14-
./test-integration.py full symfony my-project
14+
./test-integration.py full symfony
15+
16+
# Full test with custom project name
17+
./test-integration.py full laravel my-custom-project
1518

1619
# Individual test steps
1720
./test-integration.py setup # Only create and set up project
@@ -60,9 +63,10 @@ The workflow uses the same Python test script and provides the same comprehensiv
6063
The Python test script provides comprehensive verification:
6164

6265
### Project Setup
63-
- Creates fresh Laravel or Symfony projects using DDEV
66+
- Creates fresh Laravel or Symfony projects using DDEV with framework-specific naming
67+
- Framework-specific project names prevent DDEV conflicts (e.g., `booster-test-laravel`, `booster-test-symfony`)
6468
- Initializes git repository with proper configuration
65-
- Sets up DDEV containers and services
69+
- Sets up DDEV containers and services with unique project identification
6670

6771
### Integration Testing
6872
- Tests local development mode integration
@@ -101,16 +105,21 @@ The test script provides:
101105

102106
## Cleaning Up
103107

104-
The Python script creates test projects in `tests/laravel/test-project` or `tests/symfony/test-project` by default.
108+
The Python script creates test projects with framework-specific naming:
109+
- Laravel: `tests/laravel/booster-test-laravel`
110+
- Symfony: `tests/symfony/booster-test-symfony`
111+
112+
This prevents DDEV project name conflicts when testing multiple frameworks.
105113

106114
To clean up:
107115
```bash
108-
# Automatic cleanup
109-
./test-integration.py clean
116+
# Automatic cleanup (specify framework)
117+
./test-integration.py clean laravel
118+
./test-integration.py clean symfony
110119

111-
# Manual cleanup
112-
cd tests/laravel/test-project && ddev delete -y
113-
rm -rf tests/laravel/test-project
120+
# Manual cleanup example
121+
cd tests/laravel/booster-test-laravel && ddev delete -y
122+
rm -rf tests/laravel/booster-test-laravel
114123
```
115124

116125
## Local Development Mode

tools/internal-test/test-integration.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,17 +286,31 @@ def _setup_symfony(self):
286286
)
287287

288288
self.run_command(["ddev", "start"], cwd=self.config.target_dir)
289+
290+
# Use Symfony LTS for better stability
289291
self.run_command(
290292
[
291293
"ddev",
292294
"composer",
293295
"create-project",
294-
"symfony/website-skeleton",
296+
"symfony/skeleton:^7.1",
295297
".",
296298
"--no-interaction",
297299
],
298300
cwd=self.config.target_dir,
299301
)
302+
303+
# Add some basic packages
304+
self.run_command(
305+
[
306+
"ddev",
307+
"composer",
308+
"require",
309+
"symfony/webapp-pack",
310+
"--no-interaction",
311+
],
312+
cwd=self.config.target_dir,
313+
)
300314

301315
def _setup_laravel(self):
302316
"""Setup Laravel project"""
@@ -727,8 +741,8 @@ def create_config() -> Config:
727741
parser.add_argument(
728742
"project_name",
729743
nargs="?",
730-
default="test-project",
731-
help="Project name (default: test-project)",
744+
default=None,
745+
help="Project name (default: booster-test-{framework})",
732746
)
733747

734748
parser.add_argument(
@@ -739,6 +753,10 @@ def create_config() -> Config:
739753

740754
args = parser.parse_args()
741755

756+
# Set default project name if not provided (framework-specific)
757+
if args.project_name is None:
758+
args.project_name = f"booster-test-{args.project_type}"
759+
742760
# Calculate paths
743761
script_dir = Path(__file__).parent.absolute()
744762
root_dir = script_dir.parent.parent

0 commit comments

Comments
 (0)