-
Notifications
You must be signed in to change notification settings - Fork 792
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
Masterbar: Copy module code to package #37342
base: trunk
Are you sure you want to change the base?
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. |
projects/packages/masterbar/src/nudges/additional-css/js/additional-css.js
Fixed
Show fixed
Hide fixed
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
@Automattic/jetpack-vulcan How do we usually handle the ESLint failing tests related to missing JSDoc elements? Should I manually fix those or add an ignore rule? |
DependencyExtractionPlugin: false, | ||
I18nLoaderPlugin: false, | ||
I18nCheckPlugin: false, | ||
MiniCssWithRtlPlugin: false, | ||
WebpackRtlPlugin: 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.
This webpack config should mostly work here as things are, because none of the JS files use i18n or modules and you're adding back the MiniCssWithRtlPlugin
and WebpackRtlPlugin
plugins where it really matters below. The main thing you'll be missing is that there won't be any .asset.php
files for the Assets package to get version hashes from.
To do it more right, you'd want to update the JS files to import
their corresponding CSS files, and any other modules they might need (looks like none need any at the moment). That should let you drop the separate masterBarCssFiles
and enable all these plugins for the masterBarJsFiles
block.
One possible drawback to doing that is that a JS file has to exist to import
the CSS file, even if the JS file is otherwise empty. The Assets package doesn't (currently) have support for CSS-only assets.
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 gave this a shot with 0fc9c9e
I've not looked through the full list of phan flagged issues, but certainly some look like false positives, eg |
Added a phan baseline via 30e2dd2 which includes all the remaining phan issues I plan to fix gradually in follow-up PRs while switching the usage to the package. |
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.
Left some comments about Phan issues currently being ignored that should be easy to fix or should be suppressed.
projects/packages/masterbar/src/admin-menu/class-base-admin-menu.php
Outdated
Show resolved
Hide resolved
projects/packages/masterbar/src/inline-help/class-inline-help.php
Outdated
Show resolved
Hide resolved
projects/packages/masterbar/tests/php/test-class-base-admin-menu.php
Outdated
Show resolved
Hide resolved
…nu.php Co-authored-by: Brad Jorsch <anomiex@users.noreply.github.com>
…nu.php Co-authored-by: Brad Jorsch <anomiex@users.noreply.github.com>
Co-authored-by: Brad Jorsch <anomiex@users.noreply.github.com>
…ttic/jetpack into update/copy-masterbar-code-to-pkg
wp_enqueue_style( 'noticons', $this->wpcom_static_url( '/i/noticons/noticons.css' ), array(), Main::PACKAGE_VERSION . '-' . gmdate( 'oW' ) ); | ||
} | ||
|
||
wp_enqueue_script( |
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.
TODO: Check if accessible-focus.js
is used anywhere else and move it to this package if not. This will currently not work.
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.
Actually I've confirmed this will still work because Assets::get_file_url_for_environment
will set the $plugin_path
to Jetpack_Constants::get_constant( 'JETPACK__PLUGIN_FILE' )
if the $package_path
argument is empty.
As a reminder, this package will be only used by Simple and WoA sites, where the JETPACK__PLUGIN_FILE
constant should be always defined.
Added a unit test too via 0ecda4f
This PR copies the Masterbar module codebase to the
masterbar
package. In the process:Jetpack::is_module_active
has been replaced by( new Modules() )->is_module_active
JETPACK__VERSION
used for cache busting when enqueueing scripts and styles is now replaced byMain::PACKAGE_VERSION
jetpack-masterbar
fromjetpack
rtl
files are now generated with a custom config (we used to refer to them as weird RTL entries because-rtl
was appended instead of.rtl
) and the corresponding code references as well.dist
folderAssets
packageOther information:
Jetpack product discussion
pfwV0U-3U-p2
Does this pull request change what data or activity we track or use?
No
Testing instructions:
jetpack build packages/masterbar
with/without--production
and inspect the generated assets in thedist
folder