Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ indent_size = 2

[.prettierrc.json]
indent_size = 2

[package.json]
indent_size = 2
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# To ignore OS temporary files use global .gitignore
# https://help.github.com/articles/ignoring-files/#create-a-global-gitignore

# Ignore Drupal web, but preserve custom modules, themes and settings.
# Ignore Drupal webroot, but preserve custom modules, themes and settings.
# To add an override file, explicitly un-ignore it below and add to the
# repository (useful for robots.txt and .htaccess file overrides).

Expand Down
3 changes: 3 additions & 0 deletions .vortex/.ahoy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ commands:
lint-markdown:
cmd: ./tests/lint.markdown.sh

lint-markdown-fix:
cmd: ./tests/lint.markdown.sh --fix

lint-docs:
cmd: yarn --cwd=docs run lint

Expand Down
8 changes: 4 additions & 4 deletions .vortex/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ cd .vortex/docs
yarn install

# Development workflow
yarn start # Start dev server
yarn start # Start dev server
yarn build # Build documentation

# Testing workflow
Expand Down Expand Up @@ -454,7 +454,7 @@ When script output changes, update corresponding test files:
**Important**: Each system has independent dependencies and must be set up separately:

1. **Documentation** (`.vortex/docs/`): Requires Node.js/Yarn
2. **Installer** (`.vortex/installer/`): Requires PHP/Composer
2. **Installer** (`.vortex/installer/`): Requires PHP/Composer
3. **Template** (`.vortex/tests/`): Requires PHP/Composer + Node.js + BATS

**Full Setup** (from `.vortex/`):
Expand Down Expand Up @@ -757,7 +757,7 @@ Each system:
# Build failures
yarn build --verbose # Check for detailed build errors

# Spellcheck failures
# Spellcheck failures
yarn spellcheck # Review American English violations
npx cspell "content/**/*.md" # Check specific files

Expand Down Expand Up @@ -983,7 +983,7 @@ $this->cmd('ahoy info', ['Docker', 'Compose']); // Both must be found in output
// ✅ CORRECT - all strings have prefixes
$this->cmd('ahoy info', [
'* Xdebug', // Must contain "Xdebug"
'* Disabled', // Must contain "Disabled"
'* Disabled', // Must contain "Disabled"
'! Enabled' // Must NOT contain "Enabled"
]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ indent_size = 2

[.prettierrc.json]
indent_size = 2

[package.json]
indent_size = 2
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# To ignore OS temporary files use global .gitignore
# https://help.github.com/articles/ignoring-files/#create-a-global-gitignore

# Ignore Drupal web, but preserve custom modules, themes and settings.
# Ignore Drupal webroot, but preserve custom modules, themes and settings.
# To add an override file, explicitly un-ignore it below and add to the
# repository (useful for robots.txt and .htaccess file overrides).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
displayDetailsOnPhpunitDeprecations="true"
failOnPhpunitDeprecation="true"
cacheResult="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.5/phpunit.xsd"
cacheDirectory=".phpunit.cache">
<php>
<!-- Set error reporting to E_ALL. -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,188 @@ ahoy composer require --dev drupal/devel
ahoy drush pm:install admin_toolbar pathauto
```

### Patching Contributed Modules

When contributed modules need fixes or customizations, use the proper patching workflow with `cweagans/composer-patches`.

#### Prerequisites for Patching

- Project uses `cweagans/composer-patches` package
- Git is available for version control
- Access to Drupal.org git repositories

#### Patch Storage and Configuration

Patches are defined in `composer.json` under the `extra.patches` section:

```json
{
"extra": {
"patches": {
"drupal/module_name": {
"Description of fix": "patches/module-name-description.patch",
"Another fix": "https://www.drupal.org/files/issues/external-patch.patch"
}
}
}
}
```

- **Local patches**: Store in `patches/` directory in project root
- **External patches**: Reference URLs directly in composer.json
- **Naming convention**: Use descriptive names like `module-name-description.patch`

#### Creating Module Patches

Step 1: Identify Module Version

Always work with the exact version and state used in your project:

```bash
# Check installed version
ahoy composer show drupal/module_name

# Verify version in composer.lock
grep -A 20 "drupal/module_name" composer.lock
```

Step 2: Clone Module from Git

**CRITICAL**: Always use the official Drupal git repository, not tarball downloads:

```bash
# Create working directory
cd /tmp && mkdir module_patch_work && cd module_patch_work

# Clone the module
git clone https://git.drupalcode.org/project/module_name.git

# Navigate to module directory
cd module_name

# Checkout the exact version/tag used in project
git checkout 1.2.3 # Replace with actual version

# Create working branch
git checkout -b fix-description
```

Step 3: Apply Existing Patches

If your project already has patches for this module, apply them first to match the current state:

```bash
# Apply each existing patch in order
curl -s https://example.com/patch1.patch | patch -p1
curl -s https://example.com/patch2.patch | patch -p1

# Commit the patches to establish baseline
git add .
git commit -m "Apply existing patches to match project state"
```

Step 4: Make Required Changes

Edit the necessary files to implement your fix:

```bash
# Make your changes using your preferred editor
vim path/to/file.php

# Or use automated tools if applicable
sed -i 's/old_code/new_code/' path/to/file.php
```

Step 5: Generate Clean Patch

Create a proper git-based patch:

```bash
# Stage your changes
git add .

# Generate patch from staged changes
git diff --cached > /path/to/project/patches/module-name-fix-description.patch
```

Step 6: Test Patch Application

**ALWAYS test that your patch applies cleanly**:

```bash
# Reset to test patch application
git reset --hard HEAD

# Test patch applies without conflicts
git apply /path/to/project/patches/module-name-fix-description.patch

# Verify changes were applied correctly
git status
git diff
```

Step 7: Integrate into Project

Add the patch to your project's composer configuration and test:

```bash
# Update the specific module to apply patch
ahoy composer require drupal/module_name

# Verify no patch application errors
# Check that functionality works as expected
```

Step 8: Clean Up

Remove temporary working directory:

```bash
rm -rf /tmp/module_patch_work
```

#### Patching Best Practices

**✅ Do This:**

- Use descriptive patch names that explain what they fix
- Keep patches focused - one fix per patch when possible
- Follow Drupal coding standards in your changes
- Test locally before committing patches
- Document the issue being fixed in composer.json description
- Include issue URLs when available from drupal.org

**❌ Avoid These Mistakes:**

- Working with tarball downloads instead of git repositories
- Creating patches from modified project files
- Skipping patch application testing
- Creating patches without applying existing patches first
- Assuming patches work across different module versions

#### Troubleshooting Patch Issues

**Patch Won't Apply:**

1. Check module version matches between patch creation and application
2. Verify existing patches are applied in correct order
3. Check for whitespace issues in patch file
4. Ensure patch paths are correct (usually relative to module root)

**Patch Conflicts:**

1. Identify conflicting patches by applying them individually
2. Update patch order in composer.json if needed
3. Recreate patches against the current patched state
4. Merge patches if they modify the same areas

**Performance Issues:**

1. Minimize external patch URLs to reduce download time
2. Store frequently used patches locally in patches directory
3. Keep patch files small and focused
4. Remove obsolete patches when updating modules

### Adding JavaScript/CSS Libraries

For npm packages that need to be Drupal libraries, define them as inline
Expand Down
Loading