Skip to content

Conversation

@felixarntz
Copy link
Member

@felixarntz felixarntz commented Mar 4, 2024

Summary

The speculation-rules plugin was missing the defined( 'ABSPATH' ) checks that are sort of mandatory for plugins.

Checklist

  • PR has either [Focus] or Infrastructure label.
  • PR has a [Type] label.
  • PR has a milestone or the no milestone label.

@felixarntz felixarntz added Infrastructure Issues for the overall performance plugin infrastructure no milestone PRs that do not have a defined milestone for release Creating standalone plugins [Plugin] Performance Lab Issue relates to work in the Performance Lab Plugin only [Plugin] Speculative Loading Issues for the Speculative Loading plugin (formerly Speculation Rules) labels Mar 4, 2024
@felixarntz felixarntz requested a review from joemcgill as a code owner March 4, 2024 18:59
@github-actions
Copy link

github-actions bot commented Mar 4, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: felixarntz <[email protected]>
Co-authored-by: thelovekesh <[email protected]>
Co-authored-by: mukeshpanchal27 <[email protected]>
Co-authored-by: westonruter <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@felixarntz felixarntz added [Type] Bug An existing feature is broken [Plugin] Enhanced Responsive Images Issues for the Enhanced Responsive Images plugin (formerly Auto Sizes) labels Mar 4, 2024
@westonruter
Copy link
Member

I thought the root .gitattributes was updated to account for these standalone plugin development files. The initial / was removed from the relevant paths so that the files are excluded anywhere in the directory tree. (As I recall. Currently AFK and can't easily confirm.)

@westonruter
Copy link
Member

westonruter commented Mar 4, 2024 via email

@felixarntz
Copy link
Member Author

felixarntz commented Mar 4, 2024

@westonruter

I thought the root .gitattributes was updated to account for these standalone plugin development files. The initial / was removed from the relevant paths so that the files are excluded anywhere in the directory tree. (As I recall. Currently AFK and can't easily confirm.)

I initially thought this would do it, but missed to consider the important part: To publish the plugins (just like for the modules) the 10up deploy script is instructed to look at the specific plugin folder. So it'll basically be as if the root .gitattributes doesn't exist, so we need those individual ones. It's still not a bad idea to make the root exclusions more generic, but I don't think it's sufficient for this.

This is similar to my #1011 review I just left. cc @thelovekesh

@thelovekesh
Copy link
Member

@felixarntz please check my comment here - #1011 (comment)

Since we are passing BUILD_DIR for standalone plugins, I don't think the 10up deploy script will take plugin-specific .gitattributes into account as per - https://github.com/10up/action-wordpress-plugin-deploy/blob/abb939a0d0bfd01063e8d1933833209201557381/deploy.sh#L149

@thelovekesh
Copy link
Member

To produce plugin builds, please also refer to #1008, which introduces Webpack (extending WP Script configs) and is capable of handling almost every use case.

This allows us to keep utilizing a single global .distignore file rather than several ignore files. It may also generate any plugin build with a single command, such as this one (which is presently limited to the main plugin):

npm run build-plugin -- --env plugin=perflab # Build the main plugin
npm run build-plugin -- --env plugin=speculation-rules # Build the speculation-rules plugin

@felixarntz
Copy link
Member Author

@thelovekesh Great point. Let's continue the discussion on how we want to solve this problem in #1008, given neither .gitattributes nor .distignore work.

I've removed that part from this PR, so it should be good to go, only focusing on the ABSPATH checks now.

@felixarntz felixarntz changed the title Fix missing .gitattributes files and ABSPATH checks in standalone plugins Fix missing ABSPATH checks in Speculation Rules plugin Mar 5, 2024
@felixarntz felixarntz requested a review from westonruter March 5, 2024 16:57
@thelovekesh
Copy link
Member

@felixarntz SGTM. Just out of curiosity, I wanted to know where .distignore is causing the issues. AFAIK it's just an ignore file that contains some patterns and is mostly used by multiple tools out there to ignore such patterns from distribution, because .gitignore and .gitattributes are bound to git specific things.

Copy link
Member

@thelovekesh thelovekesh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@thelovekesh thelovekesh mentioned this pull request Mar 5, 2024
3 tasks
@felixarntz felixarntz merged commit ad4070b into trunk Mar 5, 2024
@felixarntz felixarntz deleted the fix/speculation-rules-missing-abspath-check branch March 5, 2024 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Infrastructure Issues for the overall performance plugin infrastructure no milestone PRs that do not have a defined milestone for release [Plugin] Enhanced Responsive Images Issues for the Enhanced Responsive Images plugin (formerly Auto Sizes) [Plugin] Performance Lab Issue relates to work in the Performance Lab Plugin only [Plugin] Speculative Loading Issues for the Speculative Loading plugin (formerly Speculation Rules) [Type] Bug An existing feature is broken

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants