Skip to content

Commit b28a03c

Browse files
committed
🔧 Fix Sage v11 installation and remove duplicate Acorn
- Remove existing Acorn before re-adding with version alias - Force Sage v11 installation by aliasing local Acorn as 5.0.x-dev - Remove Sage's vendored Acorn to use Bedrock's version - Add destroy.sh script for thorough cleanup
1 parent 0f26ea2 commit b28a03c

File tree

2 files changed

+38
-4
lines changed

2 files changed

+38
-4
lines changed

.devcontainer/destroy.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
3+
# Kill and remove all devcontainer containers (more aggressive)
4+
echo "Force stopping all devcontainer containers..."
5+
docker ps -q | xargs -r docker kill 2>/dev/null || true
6+
7+
echo "Removing all containers..."
8+
docker ps -aq | xargs -r docker rm -f 2>/dev/null || true
9+
10+
# Remove all devcontainer volumes
11+
echo "Removing all devcontainer volumes..."
12+
docker volume ls -q | grep -E "acorn_devcontainer|devcontainer_acorn|devcontainer" | xargs -r docker volume rm -f 2>/dev/null || true
13+
14+
# Clean up any dangling resources
15+
echo "Cleaning up dangling resources..."
16+
docker system prune -f --volumes 2>/dev/null || true
17+
18+
# Wait a moment for ports to be released
19+
sleep 2
20+
21+
# Check if anything is still running on port 8080
22+
if lsof -i :8080 >/dev/null 2>&1; then
23+
echo "Warning: Something is still running on port 8080"
24+
lsof -i :8080
25+
else
26+
echo "Port 8080 is clear"
27+
fi
28+
29+
echo "Devcontainer cleanup complete!"

.devcontainer/setup.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,21 @@ wp core install --url="${WP_HOME}" --title="${WP_SITE_TITLE}" --admin_user="admi
3838

3939
# Add sage if it's not active
4040
if ! wp theme status sage --skip-plugins --skip-themes 2>/dev/null | grep -q "^sage.*active"; then
41-
# Ensure COMPOSER_ROOT_VERSION is available for composer
42-
export COMPOSER_ROOT_VERSION="${COMPOSER_ROOT_VERSION:-5.0.x-dev}"
43-
cd /roots/app
4441
# Only require sage if it doesn't exist
4542
if ! wp theme is-installed sage --skip-plugins --skip-themes 2>/dev/null; then
46-
composer require roots/sage -W
43+
# Remove existing Acorn to replace with version-aliased one
44+
composer remove roots/acorn --no-update
45+
# Add our local Acorn repository with version alias
46+
composer config repositories.acorn '{"type": "path", "url": "/roots/acorn", "options": {"versions": {"roots/acorn": "5.0.x-dev"}}}'
47+
# Install Sage v11 with our aliased Acorn
48+
composer require "roots/sage:^11.0" "roots/acorn:5.0.x-dev" -W
4749
fi
4850
wp theme activate sage
4951
# Build the Sage theme
5052
cd $(wp theme path --skip-plugins --skip-themes 2>/dev/null)/sage
53+
# Remove Sage's vendored Acorn to use Bedrock's version
54+
composer remove roots/acorn --no-update
55+
composer update --no-install
5156
bun install && bun run build
5257
fi
5358

0 commit comments

Comments
 (0)