Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/trunk' into fix/child-blocks-api…
Browse files Browse the repository at this point in the history
…-version-v3
  • Loading branch information
jeherve committed Feb 7, 2025
2 parents 899c7ee + f2c86e0 commit d7c3a8d
Show file tree
Hide file tree
Showing 2,679 changed files with 43,952 additions and 35,243 deletions.
21 changes: 21 additions & 0 deletions .cursor/rules/adding-changelog.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
description: How changelog entries must be structured for each change
globs:
---
Every change in the `/projects` directory will need to add a specially-formatted file to the project's specified `changelog` directory.

The change file is a text file with a header-and-body format, like HTTP or email. A change file might look like this:

```
Significance: patch
Type: compat

Block Editor: update all blocks to be fully compatible with WordPress 5.7.
```

The “Significance” header specifies the significance of change in the style of semantic versioning: patch, minor, or major.

The “Type” header categorizes the change in the changelog. In Jetpack, for example, our changelog divides changes into “Major Enhancements”, “Enhancements”, “Improved compatibility”, and “Bugfixes”.
Type must be "security", "added", "changed", "deprecated", "removed", or "fixed"

The body is separated from the headers by a blank line, and is the text that actually goes into the changelog. This should follow our recommendations at [writing-a-good-changelog-entry.md](mdc:jetpack/jetpack/jetpack/docs/writing-a-good-changelog-entry.md).
13 changes: 13 additions & 0 deletions .cursor/rules/code-style-structure.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
description: General guidelines on code style and structure
globs:
---
General guidelines are defined in [coding-guidelines.md](mdc:jetpack/jetpack/jetpack/jetpack/jetpack/jetpack/jetpack/jetpack/jetpack/jetpack/docs/coding-guidelines.md).

### Naming Conventions

- Use WordPress naming conventions for functions and classes
- Prefix any global php functions or hooks with `jetpack_`
- Use lowercase with underscores for PHP functions
- Follow WordPress React component naming patterns
- Use BEM-like naming for SCSS
42 changes: 42 additions & 0 deletions .cursor/rules/development-guidelines.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
description: General development guidelines
globs:
---
You are an expert WordPress plugin developer specializing in site building tools, with deep expertise in WordPress core, React, PHP, and modern frontend development. You prioritize WordPress coding standards while delivering maintainable, accessible solutions.

## Short codes

Check the start of any user message for the following short codes and act appropriately:

- ddc - short for `discuss don't code` so do not make any code changes only discuss the options until given the go ahead to make changes.
- jdi - short for `just do it` so this is giving approval to go ahead and make the changes that have been discussed.

## Analysis Process

Before responding to any request, follow these steps:

1. Request Analysis

- Determine if task involves plugin core (PHP) or frontend (JS/React)
- Identify WordPress hooks and filters needed
- Note compatibility requirements (WordPress version, PHP version), based on the different versions specified in [versions.sh](mdc:jetpack/jetpack/jetpack/jetpack/jetpack/.github/versions.sh)
- Define core functionality and user experience goals
- Consider WordPress coding standards compliance

2. Solution Planning

- Break down solution into WordPress-compatible components
- Consider plugin activation/deactivation hooks
- Identify necessary WordPress API integrations
- Plan for internationalization (i18n)
- Evaluate security implications

3. Implementation Strategy

- Choose appropriate WordPress design patterns
- Consider performance impact on WordPress site
- Plan for WordPress error handling conventions
- Ensure WordPress coding standards compliance
- Verify accessibility requirements

Always prioritize WordPress coding standards and best practices while delivering functionality that enhances the WordPress site-building experience.
26 changes: 26 additions & 0 deletions .cursor/rules/js-react-standards.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
description: JavaScript/React Standards
globs: *.js, *.jsx, *.ts, *.tsx
---
## General guidelines

- Write modern ES6+ code following WordPress JS standards
- Use WordPress data store for state management
- Follow WordPress component patterns
- Implement proper WordPress hooks system
- Structure components using WordPress conventions
- Where it applies, make strings available for translation.
- Use Gutenberg's `@wordpress/i18n` package to handle translations.
- Use an appropriate unique text domain in your JS code.

## React Components

- Use WordPress `@wordpress/element` instead of direct React import
- Implement WordPress hooks system
- Follow WordPress component lifecycle patterns
- Use the WordPress block editor data stores for state management of WordPress block editor components
- Follow WordPress accessibility guidelines

## TypeScript

- When using TypeScript in Webpack, use `@babel/preset-typescript` rather than `ts-loader`.
14 changes: 14 additions & 0 deletions .cursor/rules/js-testing.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
description: Guidelines to write JavaScript tests
globs:
---
- Use Jest with WordPress test utilities
- Follow WordPress testing patterns
- Test React components with `@testing-library/react`
- Implement proper async testing
- Use WordPress mocking patterns


Check [component.tsx](mdc:jetpack/jetpack/jetpack/jetpack/projects/packages/my-jetpack/_inc/components/connection-status-card/test/component.tsx) for an example.

Find out more about how to develop tests at [automated-testing.md](mdc:jetpack/jetpack/docs/automated-testing.md)
20 changes: 20 additions & 0 deletions .cursor/rules/php-standards.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
description: PHP coding standards
globs: *.php
---
- Follow WordPress PHP Coding Standards
- Use proper WordPress prefix for functions and classes
- Implement WordPress nonce verification
- Follow WordPress database operations best practices
- Structure plugin hooks logically

## Package Version Annotations

When needing to add a package version number inside a DocBlock, please use `$$next-version$$` as such:

- `@since $$next-version$$`
- `@deprecated $$next-version$$`
- `@deprecated since $$next-version$$`
- `_deprecated_function( __METHOD__, 'package-$$next-version$$' );` (other WordPress deprecation functions also work, but note it must be all on one line).

The `$$next-version$$` specifier will be automatically replaced with the correct package version number the next time a new version of that package is released.
14 changes: 14 additions & 0 deletions .cursor/rules/php-testing.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
description: Guidelines when testing PHP
globs:
---
When developing Unit Tests in PHP, follow these guidelines:

- Use PHPUnit with WordPress test framework
- Follow WordPress testing conventions
- Use WordPress fixtures and mocks
- Test WordPress hooks and filters

Check [test_Manager_integration.php](mdc:jetpack/jetpack/jetpack/jetpack/projects/packages/connection/tests/php/test_Manager_integration.php) for an example.

Find out more rules on how to write tests at [automated-testing.md](mdc:jetpack/jetpack/docs/automated-testing.md)
92 changes: 48 additions & 44 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,72 +50,85 @@ body:
attributes:
label: Steps to reproduce
placeholder: |
E.g., What happened, and what did you expect to happen? Add images,
GIFs, and videos if you have them on hand.
1. Start at `site-domain.com/blog`.
2. Click on any blog post.
3. Click on the 'Like' button.
4. ...
Add any information that may be relevant, such as:
- Browser/Platform
- Theme
- Logs/Errors
validations:
required: true
- type: textarea
id: expected
attributes:
label: A clear and concise description of what you expected to happen.
placeholder: |
eg. Post should be liked.
- type: textarea
id: actual

- type: markdown
attributes:
label: What actually happened
placeholder: |
eg. Clicking the button does nothing visibly.
value: |
<br>
## Impact
Please help us understand more about the impact of this issue to help determine next steps.
If you are unsure about anything, please use your judgment to make an educated guess.
- type: dropdown
id: users-affected
id: impact
attributes:
label: Impact
description: Approximately how many users are impacted?
label: Site owner impact
description: Approximately what percentage of the total users of the platform are impacted? Unsure? Please provide your most educated guess!
options:
- One
- Some (< 50%)
- Most (> 50%)
- All
- Fewer than 20% of the total website/platform users
- Between 20% and 60% of the total website/platform users
- More than 60% of the total website/platform users
validations:
required: true
- type: dropdown
id: workarounds
id: severity
attributes:
label: Available workarounds?
label: Severity
description: What is the severity of this issue? Please take a look at the descriptions below for further context.<br>
<br> - **Critical:** Prevents core functionality or has severe impact on the website/platform.
<br> - **Major:** Significantly impairs important features or has notable impact on the website/platform.
<br> - **Moderate:** Affects non-critical features or has limited impact on the website/platform.
<br> - **Minor:** Causes inconvenience or has minimal impact on functionality.
options:
- No and the platform is unusable
- No but the platform is still usable
- Yes, difficult to implement
- Yes, easy to implement
- There is no user impact
- Critical
- Major
- Moderate
- Minor
validations:
required: true
- type: dropdown
id: additional-impact
attributes:
label: What other impact(s) does this issue have?
description: You may select more than one
options:
- Platform revenue
- Agency or developer revenue
- Individual site owner revenue
- No revenue impact
multiple: true

- type: markdown
attributes:
value: |
<br>
## Optional Information
- type: textarea
id: workaround-detail
id: workaround
attributes:
label: If the above answer is "Yes...", outline the workaround.
label: If a workaround is available, please outline it here.
placeholder: |
Provide details of the specific steps to take that resolve the issue, e.g.:
- Open "Setting X".
- Toggle "Option Y".
- Click "Button Z".
- type: markdown
attributes:
value: |
<br>
## Optional Information
The following section is optional.
- type: dropdown
id: site-type
attributes:
Expand All @@ -126,12 +139,3 @@ body:
- Atomic
- Self-hosted
multiple: true
- type: textarea
id: logs
attributes:
label: Logs or notes
placeholder: |
Add any information that may be relevant, such as:
- Browser/Platform
- Theme
- Logs/Errors
1 change: 0 additions & 1 deletion .github/files/coverage-munger/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"private": true,
"name": "jetpack-gh-config-munger",
"devDependencies": {
"istanbul-merge": "^2.0.0",
"nyc": "^17.1.0"
Expand Down
4 changes: 2 additions & 2 deletions .github/files/coverage-munger/process-coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ fi
TMP=$( find "$PWD/coverage" -name '*.json' )
if [[ -n "$TMP" ]]; then
echo "::group::Combining JS coverage"
pnpm --filter=jetpack-gh-config-munger exec istanbul-merge --out "$PWD"/artifacts/js-combined.json $TMP
pnpm --filter=./.github/files/coverage-munger/ exec istanbul-merge --out "$PWD"/artifacts/js-combined.json $TMP
perl -i -pwe 'BEGIN { $prefix = shift; $prefix=~s!/*$!/!; $re = qr/\Q$prefix\E/; } s!"$re!"!g' "$GITHUB_WORKSPACE" artifacts/js-combined.json
echo '::endgroup::'

echo "::group::Creating JS coverage summary"
mkdir "$TMP_DIR/js"
cp artifacts/js-combined.json "$TMP_DIR/js"
pnpm --filter=jetpack-gh-config-munger exec nyc report --no-exclude-after-remap --report-dir="$TMP_DIR" --temp-dir="$TMP_DIR/js" --reporter=json-summary
pnpm --filter=./.github/files/coverage-munger/ exec nyc report --no-exclude-after-remap --report-dir="$TMP_DIR" --temp-dir="$TMP_DIR/js" --reporter=json-summary
jq -r 'to_entries[] | select( .key != "total" ) | [ .key, .value.lines.total, .value.lines.covered ] | @tsv' "$TMP_DIR/coverage-summary.json" > "$TMP_DIR/js-summary.tsv"
echo '::endgroup::'
else
Expand Down
Loading

0 comments on commit d7c3a8d

Please sign in to comment.