Skills.MD
# ActivityPub Development Cycle
Quick reference for common development workflows in the WordPress ActivityPub plugin.
## Quick Reference
### Environment Management
```bash
npm run env-start # Start WordPress at http://localhost:8888.
npm run env-stop # Stop WordPress environment.
```
### Testing Commands
```bash
npm run env-test # Run all PHP tests.
npm run env-test -- --filter=pattern # Run tests matching pattern.
npm run env-test -- path/to/test.php # Run specific test file.
npm run env-test -- --group=name # Run tests with @group annotation.
npm run test:e2e # Run Playwright E2E tests.
npm run test:e2e:debug # Debug E2E tests.
```
### Code Quality
```bash
composer lint # Check PHP coding standards.
composer lint:fix # Auto-fix PHP issues.
npm run lint:js # Check JavaScript.
npm run lint:css # Check CSS styles.
npm run format # Format all code (wp-scripts).
```
### Building Assets
```bash
npm run build # Build for production (formatted and minified).
npm run dev # Start development watch mode.
```
### Code Coverage
```bash
npm run env-start -- --xdebug=coverage # Start with coverage support.
npm run env-test -- --coverage-text # Generate text coverage report.
npm run env-test -- --coverage-html ./coverage # Generate HTML report.
```
## Comprehensive Documentation
See [Development Environment Setup](../../../docs/development-environment.md) for detailed setup instructions.
See [Testing Reference](../../../tests/README.md) for comprehensive testing guidance.
See [Code Linting](../../../docs/code-linting.md) for linting configuration and standards.
## Pre-commit Hooks
The repository uses automated pre-commit hooks (`.githooks/pre-commit`) that run automatically on `git commit`:
1. **Sort PHP imports** - Automatically organizes use statements.
2. **Check unused imports** - Prevents unused use statements.
3. **Validate test patterns** - Blocks `remove_all_filters('pre_http_request')`.
4. **Run PHPCS auto-fix** - Applies coding standards automatically.
5. **Format JavaScript** - Runs wp-scripts formatter.
**IMPORTANT:** Hooks modify staged files automatically. Always review changes before committing. If hooks make changes, you'll need to stage them and commit again.
**Setup:** Hooks are installed by `npm run prepare` (runs automatically after `npm install`).
## Common Development Workflows
### Initial Setup
```bash
git clone git@github.com:Automattic/wordpress-activitypub.git
cd wordpress-activitypub
npm install # Also runs 'npm run prepare' to install hooks.
composer install
npm run env-start # WordPress at http://localhost:8888.
```
### Making Changes Workflow
```bash
# 1. Make code changes.
# 2. Run relevant tests.
npm run env-test -- --filter=FeatureName
# 3. Check code quality (optional - pre-commit hook does this).
composer lint
npm run lint:js
# 4. Commit (pre-commit hook runs automatically).
git add .
git commit -m "Description"
# Hook may modify files - review and stage again if needed.
```
### Before Creating PR
```bash
# Run full test suite.
npm run env-test
# Build assets.
npm run build
# Final lint check.
composer lint
npm run lint:js
```
### Debugging Failing Tests
```bash
# Run with verbose output.
npm run env-test -- --verbose --filter=test_name
# Run single test file to isolate issue.
npm run env-test -- tests/phpunit/tests/path/to/test.php
# Check test groups.
npm run env-test -- --list-groups
npm run env-test -- --group=specific_group
```
### Fresh Environment
```bash
npm run env-stop
npm run env-start
# wp-env automatically sets up WordPress with debug mode and test users.
```
## Key Files
- `package.json` - npm scripts and dependencies.
- `composer.json` - PHP dependencies and lint scripts.
- `.wp-env.json` - wp-env configuration.
- `phpcs.xml` - PHP coding standards (custom WordPress rules).
- `.githooks/pre-commit` - Pre-commit automation.
评论 0
还没有评论,来抢沙发。
相关内容
同类或同场景的收录内容
building-with-kafka-strimzi
在 Kubernetes 上构建基于 Apache Kafka 的事件驱动系统,支持高可靠的消息传递、事务性处理与精确一次语义,结合 Strimzi 运营商实现集群自动化管理,利用 Schema Registry 保障事件模式演进,适用于微服务间解耦通信与实时数据流处理场景。
站外数据与分析
609 0.0
personal-tool-builder
专注于从个人真实痛点出发快速构建实用工具,涵盖命令行程序、本地优先应用和自动化脚本的开发与演进,强调先满足自身需求再逐步扩展,通过持续自用打磨功能,避免过度设计,确保工具简洁有效且长期可维护。
站外商业与营销
196 0.0
threejs-lighting
实现三维场景中的光照与阴影控制,支持多种光源类型及环境光照明,提供从基础布光到高级阴影优化的完整方案,适用于需要真实感渲染或性能平衡的可视化项目。
站外效率工具
442 0.0
aggregation-helper
提供数据聚合场景的自动化辅助能力,涵盖 SQL 查询编写、统计分析建模、可视化方案设计及商业智能配置,支持从需求理解到生产级代码生成的全流程指导。
站外效率工具数据与分析
217 0.0
举报「activitypub-dev-cycle」
举报信息仅审核团队可见,同一资产 24 小时内仅可举报一次