-
Notifications
You must be signed in to change notification settings - Fork 798
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
Calypsoify: Copy the module code to the Calypsoify package #37339
Conversation
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. Once your PR is ready for review, check one last time that all required checks appearing at the bottom of this PR are passing or skipped. |
'file_suppressions' => [ | ||
'src/class-jetpack-calypsoify.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchPropertyDefault', 'PhanUndeclaredClassMethod'], |
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.
I re-created the baseline file, and ran jetpack phan packages/calypsoify --update-baseline
which automatically added these suppressions. I had previously fixed an issue with the Jetpack version constant declaration which was flagged by phan test results - the remaining issues appear to be false positives or issues that previously existed, though I'll be able to clarify any issues when actually hooking everything up in the follow-up PR.
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.
Edit to add the file has been updated now, so the only ignores are two pre-existing issues from what I can see, and I'll be able to test out possible fixes if needed when hooking everything up:
Error: TypeError PhanTypeMismatchPropertyDefault Default value for object $instance can't be false of type false based on phpdoc types
projects/packages/calypsoify/src/class-jetpack-calypsoify.php:70
Error: TypeError PhanTypeMismatchArgumentProbablyReal Argument 3 ($deps) is false of type false but \wp_enqueue_style() takes array|string[] (no real type) defined at /home/runner/work/jetpack/jetpack/vendor/php-stubs/wordpress-stubs/wordpress-stubs.php:114134 (the inferred real argument type has nothing in common with the parameter's phpdoc type)
projects/packages/calypsoify/src/class-jetpack-calypsoify.php:71
*/ | ||
public function enqueue_for_gutenberg() { | ||
$site_suffix = ( new Status() )->get_site_suffix(); | ||
wp_enqueue_style( 'calypsoify_wpadminmods_css', plugin_dir_url( __FILE__ ) . 'style-gutenberg.min.css', false, self::PACKAGE_VERSION ); |
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.
Since we changed the file structure with css files currently living under the css
folder we'll need to fix the path here as well.
I guess the style-gutenberg.min.css
will be created on build but added to the .gitignore
too?
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.
Good point, thanks!
wp_style_add_data( 'calypsoify_wpadminmods_css', 'rtl', 'replace' ); | ||
wp_style_add_data( 'calypsoify_wpadminmods_css', 'suffix', '.min' ); | ||
|
||
wp_enqueue_script( 'calypsoify_wpadminmods_js', plugin_dir_url( __FILE__ ) . 'mods-gutenberg.js', array( 'jquery' ), self::PACKAGE_VERSION, false ); |
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.
Since we changed the file structure with js files currently living under the js
folder we'll need to fix the path here as well.
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
wp_enqueue_style( 'calypsoify_wpadminmods_css', plugin_dir_url( __FILE__ ) . 'build/style-gutenberg.css', false, self::PACKAGE_VERSION ); | ||
wp_style_add_data( 'calypsoify_wpadminmods_css', 'rtl', 'replace' ); | ||
wp_style_add_data( 'calypsoify_wpadminmods_css', 'suffix', '.min' ); | ||
|
||
wp_enqueue_script( 'calypsoify_wpadminmods_js', plugin_dir_url( __FILE__ ) . 'build/mods-gutenberg.js', array( 'jquery' ), self::PACKAGE_VERSION, false ); |
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.
After changing the paths, I will need to double check this is all working correctly once hooking everything up in the next PR, but this should be ok to leave as is for this PR.
For example the .min file is actually the current .css file, so I will need to either remove this line or change the build output depending on whether it will work to have no defined min file, but will investigate more 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.
Yeah I'm also not sure what is the best way to handle rtl
.
Based on my understanding so far, webpack by default will create an rtl file for eg style.css
named style.rtl.css
however wordpress expects style-rtl.css
when setting the rtl
property.
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.
Ideally the JS files should be built with our normal monorepo webpack config and then we should use our jetpack-assets package to enqueue things with Assets::register_script()
. That handles a lot of the various bits for us.
I have no idea whether making that happen here would be a lot of work though.
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.
Let's 🚢 this to unblock you and we can fully test if assets are properly enqueued/rtl
respected etc in a follow up PR :)
Resolves https://github.com/Automattic/vulcan/issues/319
Proposed changes:
Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
No.
Testing instructions:
jetpack build packages/calypsoify --production
. You should see a 'build' directory created with 3 files - the minified JS, CSS and a RTL CSS file.