[wp-meta] [Making WordPress.org] #5207: Improve heuristics for detecting block assets

Making WordPress.org noreply at wordpress.org
Tue Jul 28 22:20:48 UTC 2020


#5207: Improve heuristics for detecting block assets
------------------------------+---------------------------
 Reporter:  tellyworth        |       Owner:  coreymckrill
     Type:  enhancement       |      Status:  assigned
 Priority:  high              |   Milestone:
Component:  Plugin Directory  |  Resolution:
 Keywords:  needs-patch       |
------------------------------+---------------------------

Comment (by coreymckrill):

 The above patch does three things:

 * Adds info/warnings to the block plugin checker tool output to show how
 many JS/CSS asset files were found during the check.
 * Ensures that the block checker's call to
 `Import::find_possible_block_assets` includes other directories that might
 have asset files besides the plugin's root directory.
 * Updates the heurisitics in the `Import::find_possible_block_assets`
 method to recursively search possible directories for asset files, rather
 than only the directory itself.

 With these changes, the Voice Blocks plugin shows 2 JS files and 0 CSS
 files in the checker. It looks like there are CSS assets in the plugin,
 but they are in a separate directory with no connection to the block's
 script files, so I'm not sure how we'd find those without potentially
 introducing a ton of false positives.

 These changes themselves already do find a lot more files that are
 considered assets, and I'm not sure how many are false positives. When
 running `bin/check-block.php` (with some output modifications), here's the
 before and after for this patch:

 Before / After

 Total JS assets: 129 / 160
 Total CSS assets: 77 / 84
 Block plugins with no assets: 3 / 0

 I guess the question is, will introducing these additional assets, some of
 which might be false positives, break the block directory?

-- 
Ticket URL: <https://meta.trac.wordpress.org/ticket/5207#comment:14>
Making WordPress.org <https://meta.trac.wordpress.org/>
Making WordPress.org


More information about the wp-meta mailing list