elementor/scripts/setup-test-environment.sh
Netanel Baba 4bc56cc985
Internal: Convert to single turbo monorepo with unified workspace [ED-23202] (#35005)
## Summary
- Merges the `packages/` turbo-repo into the root npm workspaces —
**single `node_modules`, single lockfile, turbo runs from root**
- No directory moves: `packages/packages/core|libs|tools` stays as-is
- `packages/package.json` stripped to scripts-only (no devDependencies,
workspaces, or overrides)
- All devDependencies consolidated at root with version bumps where
needed
- Root scripts updated to use `turbo` and `-w elementor-packages`
directly instead of `cd packages && npm run X`

## Changes
| File | Action |
|------|--------|
| `/turbo.json` | **Created** — root turbo config (tasks: build, dev) |
| `/package.json` | **Modified** — added workspaces, packageManager,
merged devDeps + overrides, updated scripts |
| `/packages/package.json` | **Modified** — stripped to scripts-only |
| `/packages/turbo.json` | **Deleted** — root turbo.json is now
authoritative |
| `/packages/package-lock.json` | **Deleted** — single lockfile at root
|

## Test plan
- [x] `npm install` — succeeds, single `node_modules` at root
- [x] `turbo build` — all 20 packages build successfully
- [x] `npm run test:packages` — 361/362 suites pass (2 pre-existing
failures on main)
- [x] No `packages/node_modules` or `packages/package-lock.json` exist
- [ ] CI pipeline passes
- [ ] `npm run watch:packages` works in dev
- [ ] `npm run lint` works


Made with [Cursor](https://cursor.com)
<!--start_gitstream_placeholder-->
###  PR Description
Purpose: Consolidate separate packages directory into single Turbo
monorepo workspace structure to unify dependency management and build
orchestration across the Elementor codebase.

Main changes:
- Replaced `prepare-environment:ci` with `install:ci` across all CI
workflows and scripts, removing nested package directory navigation
- Migrated Turbo configuration and workspace definitions from
packages/package.json to root-level package.json with unified workspace
paths
- Updated build scripts to use Turbo directly at root level and
consolidated testing/tooling dependencies into main devDependencies

_Generated by LinearB AI and added by gitStream._
<sub>AI-generated content may contain inaccuracies. Please verify before
using.
💡 **Tip:** You can customize your AI Description using **Guidelines**
[Learn
how](https://docs.gitstream.cm/automation-actions/#describe-changes)</sub>
<!--end_gitstream_placeholder-->

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: ElementorBot <48412871+elementorbot@users.noreply.github.com>
Co-authored-by: Davids Seveloff <94905340+davseve@users.noreply.github.com>
2026-03-08 13:08:44 +02:00

78 lines
No EOL
2.5 KiB
Bash
Executable file

#!/bin/bash
set -e
echo "Setting up Elementor test environment from current branch..."
# Get current branch
CURRENT_BRANCH=$(git branch --show-current)
echo "Building from branch: $CURRENT_BRANCH"
# Step 1: Stop and remove existing Elementor test containers
echo "Step 1: Cleaning up existing Elementor test containers"
ELEMENTOR_CONTAINERS=$(docker ps -q --filter "name=port888")
if [ -n "$ELEMENTOR_CONTAINERS" ]; then
echo "Found running Elementor test containers:"
docker ps --filter "name=port888" --format "table {{.Names}}\t{{.Status}}"
if [[ "${SKIP_CONFIRMATION:-}" != "true" ]]; then
read -p "Stop and remove these containers? (y/N): " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "Skipping container cleanup. You may need to manually stop conflicting containers."
echo "To skip this prompt, set SKIP_CONFIRMATION=true"
exit 1
fi
fi
echo "Stopping Elementor test containers..."
docker stop $ELEMENTOR_CONTAINERS
fi
ELEMENTOR_CONTAINERS_ALL=$(docker ps -aq --filter "name=port888")
if [ -n "$ELEMENTOR_CONTAINERS_ALL" ]; then
echo "Removing Elementor test containers..."
docker rm $ELEMENTOR_CONTAINERS_ALL
fi
# Step 2: Prepare environment
echo "Step 2: Installing dependencies"
npm run install:ci
# Step 3: Build project from current branch
echo "Step 3: Building project from $CURRENT_BRANCH"
npm run build:packages
npm run composer:no-dev
grunt scripts styles
echo "Built Elementor from $CURRENT_BRANCH (skipped full grunt build to avoid text domain warnings)"
# Step 4: Download hello-elementor theme
echo "Step 4: Downloading hello-elementor theme"
if [ -f "hello-elementor.zip" ]; then
rm hello-elementor.zip
fi
if [ -d "hello-elementor" ]; then
rm -rf hello-elementor
fi
curl -L --output hello-elementor.zip "https://downloads.wordpress.org/theme/hello-elementor.zip"
unzip -o hello-elementor.zip
rm hello-elementor.zip
# Step 5: Start local servers
echo "Step 5: Starting WordPress environments"
npm run start-local-server
# Step 6: Setup WordPress environments
echo "Step 6: Configuring WordPress"
npm run test:setup:playwright
echo "Test environment setup completed successfully!"
echo ""
echo "WordPress environments are ready:"
echo " - Port 8888: http://localhost:8888"
echo " - Port 8889: http://localhost:8889"
echo " - Admin panel: http://localhost:8888/wp-admin/"
echo " - Login: admin / password"
echo ""
echo "Build info:"
echo " - Branch: $CURRENT_BRANCH"
echo " - Elementor version: Built from current branch"
echo ""
echo "Ready for testing and development!"