-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Try canonical block plugins using the Time to Read block #61504
Closed
Closed
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
30673e9
add time to read block
d95e917
Update settings to register and render block
creativecoder 6721a9f
Updates time to read block plugin
creativecoder 11462ad
Remove example-static plugin
creativecoder b0f4a71
Adds small fixes/edits
creativecoder b08f7ad
Resolve linting issues and integrate phpcs config better with monorepo
creativecoder 85c208c
Fix merged changes to phpcs.xml.dist
creativecoder df2f4a1
Fix lint:pkg-json errors
creativecoder 12fb053
Runs plugin commands from root of repo
creativecoder 548f82b
Adds e2e test for Time to Read block
creativecoder a24347f
Improve e2e tests
creativecoder e56ed35
Adds phpunit tests
creativecoder 6e4ceee
Adds block plugins to snapshot tests
creativecoder ba61b17
Uses block supports for textAlign rather than manual attribute
creativecoder eb0d85b
Remove var_dump statement
creativecoder 9f5a4c0
WIP Adds plugins readme
creativecoder f52c7b4
Removes plugin package lock file
creativecoder b8db311
Expands plugins readme with details about file structure, testing, etc
creativecoder 308a111
Attempts to get unit tests working in CI
creativecoder 3ce89b0
Moves block.json file to make it accessible in phpunit test environment
creativecoder 070d7dd
Updates block.json path glob for fixture tests
creativecoder ca79a46
Updates readme with block.json location
creativecoder cf4ee72
Adds .npmpackagejsonlintrc.json for plugins directory to use WordPres…
creativecoder 9b9d044
Excludes plugins/ from core backport check
creativecoder 7dc75fa
Updates the description to indicate the reading time is an estimate
creativecoder 6e204c9
Updates backport check exclusion
creativecoder 8e1b30d
Moves scripts for php into bin/ folder
creativecoder 0c10e45
Updates block plugin description in plugins readme
creativecoder 417c8db
Switches to use mappings in wp-env so plugins are not activated by de…
creativecoder File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
./vendor/bin/phpcbf --standard=phpcs.xml.dist --report-summary --report-source | ||
|
||
for dir in ./plugins/*/ | ||
do | ||
if [ -d "$dir" ] && [ -f "$dir/phpcs.xml.dist" ]; then | ||
./vendor/bin/phpcbf --standard="$dir/phpcs.xml.dist" --report-summary --report-source | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
./vendor/bin/phpcs --standard=phpcs.xml.dist | ||
|
||
for dir in ./plugins/*/ | ||
do | ||
if [ -d "$dir" ] && [ -f "$dir/phpcs.xml.dist" ]; then | ||
./vendor/bin/phpcs --standard="$dir/phpcs.xml.dist" | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
<?xml version="1.0"?> | ||
<ruleset name="WordPress Coding Standards for Gutenberg monorepo"> | ||
<description>Sniffs defaults for all PHP files in the Gutenberg monorepo</description> | ||
|
||
<!-- Check for cross-version support for PHP 7.2 and higher. --> | ||
<config name="testVersion" value="7.2-"/> | ||
<rule ref="PHPCompatibilityWP"> | ||
<include-pattern>*\.php$</include-pattern> | ||
</rule> | ||
|
||
<rule ref="WordPress-Core"/> | ||
<rule ref="WordPress.WP.I18n"> | ||
<properties> | ||
<property name="text_domain" type="array"> | ||
<element value="gutenberg"/> | ||
<element value="default"/> | ||
</property> | ||
</properties> | ||
</rule> | ||
|
||
<rule ref="VariableAnalysis.CodeAnalysis.VariableAnalysis"> | ||
<properties> | ||
<property name="allowUnusedParametersBeforeUsed" value="true"/> | ||
</properties> | ||
</rule> | ||
|
||
<rule ref="PEAR.Functions.FunctionCallSignature"> | ||
<properties> | ||
<property name="allowMultipleArguments" value="false"/> | ||
</properties> | ||
</rule> | ||
|
||
<rule ref="WordPress.WP.I18n.MissingArgDomainDefault"> | ||
<exclude-pattern>/lib/compat/*</exclude-pattern> | ||
<exclude-pattern>/packages/block-library/src/*</exclude-pattern> | ||
<exclude-pattern>/build/block-library/*</exclude-pattern> | ||
</rule> | ||
|
||
<arg value="ps"/> | ||
<arg name="extensions" value="php"/> | ||
|
||
<!-- Cache the scan results and re-use those for unchanged files on the next scan. --> | ||
<arg name="cache" value=".cache/phpcs.json"/> | ||
|
||
<!-- Check up to 20 files simultaneously. --> | ||
<arg name="parallel" value="20"/> | ||
|
||
<!-- Exclude generated files --> | ||
<exclude-pattern>/packages/block-serialization-spec-parser/parser\.php$</exclude-pattern> | ||
<exclude-pattern>/node_modules/*</exclude-pattern> | ||
<exclude-pattern>/build/*</exclude-pattern> | ||
|
||
<!-- Exclude third party libraries --> | ||
<exclude-pattern>/vendor/*</exclude-pattern> | ||
<exclude-pattern>/test/php/gutenberg-coding-standards/*</exclude-pattern> | ||
|
||
<!-- Exclude files maintained in WordPress Core and backported to Gutenberg | ||
DO NOT REMOVE these rules; these files are "built" artifacts from Core | ||
and when they are removed it prevents keeping the repos in sync. --> | ||
<exclude-pattern>/lib/compat/wordpress-*/html-api/*\.php$</exclude-pattern> | ||
|
||
<!-- Ignore filename error since it requires WP core build process change --> | ||
<rule ref="WordPress.Files.FileName.InvalidClassFileName"> | ||
<exclude-pattern>/phpunit/*</exclude-pattern> | ||
<exclude-pattern>/packages/block-library/src/navigation/index\.php$</exclude-pattern> | ||
</rule> | ||
|
||
<!-- Ignore empty files in tests/gutenberg-test-themes --> | ||
<rule ref="Internal.NoCodeFound"> | ||
<exclude-pattern>/test/gutenberg-test-themes/*</exclude-pattern> | ||
</rule> | ||
|
||
<!-- Exclude PHPUnit tests from file and class name sniffs (for Core parity). --> | ||
<rule ref="WordPress.Files.FileName.NotHyphenatedLowercase"> | ||
<exclude-pattern>/phpunit/*</exclude-pattern> | ||
<exclude-pattern>*\.asset\.php$</exclude-pattern> | ||
</rule> | ||
<rule ref="PEAR.NamingConventions.ValidClassName.Invalid"> | ||
<exclude-pattern>/phpunit/*</exclude-pattern> | ||
</rule> | ||
|
||
<!-- Enforce checks against redeclaration for functions and classes. --> | ||
<rule ref="Gutenberg.CodeAnalysis.GuardedFunctionAndClassNames"> | ||
<exclude-pattern>/phpunit/*</exclude-pattern> | ||
<exclude-pattern>/packages/*</exclude-pattern> | ||
<exclude-pattern>/bin/generate-gutenberg-php\.php$</exclude-pattern> | ||
<properties> | ||
<property name="functionsWhiteList" type="array"> | ||
<element value="/^_?gutenberg.+/"/> | ||
</property> | ||
<property name="classesWhiteList" type="array"> | ||
<element value="/^Gutenberg.+/"/> | ||
<element value="/^.+_Gutenberg$/"/> | ||
</property> | ||
</properties> | ||
</rule> | ||
</ruleset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The question to be asked is whether we want to build plugins when we're working on Gutenberg. Building plugins for now is probably very fast but I expect that as we increase the number of canonical blocks, it might become a burden and developers would want to focus on one thing in particular: Gutenberg, a specific block... An option to build everything, would be handy too but I wonder if it should be the default or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My personal expectation is that the primary build command will build the entire project, and that I shouldn't need to run any other commands for a complete build. That said, having a
build:gutenberg
or similar that only builds the main Gutenberg plugin (and packages) seems like a good idea.