Closed joemcgill closed 5 months ago
I think I would prefer option 1, as it allows automatic updates easily (simply via Performance Lab). It's also not a lot of additional work required since most of the necessary infrastructure is implemented already.
Any code could start as a module, and once it's approved as standalone plugin, it can be deployed that way. Users would then see the migration notice as needed, and 1-2 releases later the module would be removed from PL.
The main difference that doing this long-term would potentially require is to adjust the standalone plugin build process slightly:
modules
directory.plugins
).modules
and plugins
directories for the standalone plugins we have and depending on where the plugin code comes from use either the "module to plugin deployment" or the "plugin deployment" logic.I put a bit of time into investigating what we would need to do to publish zips of standalone plugins to the releases page of this repo and if we did want to do this, we would need to update a few parts of our current workflow automation.
Currently, publishing a new release triggers both the main Deploy to WordPress.org workflow as well as the Deploy standalone plugins to WordPress.org workflow.
Both of these workflows would need to be altered so that we could publish a standalone plugin release (or pre-release) that would automate the creation of a new release tag without triggering additional deployment workflows. We could probably use tag filtering (step.if
) to accomplish this, but we may want to rethink the whole automation flow so that the published release on the repo is the final result of the release workflow, rather than the trigger to initiate the workflow. We could also consider automating the creation of standalone plugin specific branches, from which each plugin could be tagged and deployed.
All this to say, I do think that option 1 will be less effort initially, though I would like for us to have a better long-term way of offering downloads of standalone plugins—including pre-release versions—for testing purposes outside of the official plugins repo. I do like the idea of moving standalone plugins to a separate folder that is organized as plugin folders rather than needing and think that if we make that change, then keeping a separation between what is a "plugin" and what is a "module" would simplify things a bit.
How about we start with the following workflow for modules that graduate into standalone plugins:
modules
folder, the same way as today.npm run build-plugins
(after temporarily adding the module to plugins.json
, without actually committing) to get the plugin version of the module, then submit to .org for review.perflab_get_standalone_plugins_constants()
function to include the module/plugin.plugins.json
to include the module/plugin.perflab_get_standalone_plugins()
function to include the plugin.modules
to the plugins
folder (that would be a new top-level folder in the repository).plugins.json
and in the perflab_get_standalone_plugins_constants()
function.This would pretty much be the workflow.
To make that happen, only a few infrastructure changes would need to be implemented:
plugins
folder.plugins.json
structure to allow managing both modules that are also deployed as plugins (i.e. from modules
folder), as well as plugins that are purely standalone plugins (i.e. from plugins
folder).php-test-standalone-plugins.yml
and deploy-standalone-plugins.yml
commands to also cover plugins from the plugins
folder. That should be quite straightforward, since, if anything, it involves less work, since those are already plugins, i.e. they don't need to be "built" from modules into plugins.Once all of this infrastructure exists, we would document the workflow in the Performance Team Handbook, similar to the other documentation that already exists on writing a module. A few points in that existing documentation should probably be updated then as well.
LMKWYT.
TLGTM! 😜
For now I think we should separate discussion about moving standalone plugins to a separate built plugins directory from the problem this issue is trying to solve. For now, manually building a plugin before it's released seems like a fine workaround to get the review process started. We could even upload those zips manually to the GH release page if we wanted to make it easier for folks to test pre-releases before they're on the .org repo.
Until a module is available on the .org repo, keeping it available as an option to enable seems sensible. Once it's available, we can migrate it to whatever the current process is for managing the standalone plugins. Let's start a new issue for reorganizing published modules within the codebase in the meantime.
Happy to break this apart, but I think the separate built plugins directory is a given anyway. We can't have those continue to live in the modules
directory when they shouldn't be modules in PL anymore.
I agree though that the infrastructural change related to having both modules
and plugins
directories should be implemented regardless of what we decide for this issue here. Even if we end up deciding that we won't start new standalone plugins as a module first, that'll be needed. In that case, we would probably start a new standalone plugin in the plugins
directory right away, but then there would need to be another approach if we wanted to make it available before .org approval.
Happy to break this apart, but I think the separate built plugins directory is a given anyway. We can't have those continue to live in the
modules
directory when they shouldn't be modules in PL anymore.
Sorry if this was already discussed...
What if they actually are kept in modules
and all of the standalone plugins continue to get shipped as part of the PL plugin as modules? This would make migration to standalone plugins much easier, as a site owner could switch over to the standalone plugin at any time. There would be no back-compat breakage. In this way
As soon as someone installs a standalone plugin for a PL module, the module code would then short-circuit so that only one copy of the functionality is active at a time. The PL module could get deactivated (in the plugin DB option) when the standalone plugin is activated, ensuring that when a site owner deactivates the module it doesn't result in the module's behavior (from the PL plugin) from continuing to run unexpectedly. This would be the essence of the migration logic.
This would also solve the problem of the plugin review queue taking so long to approve new plugins. The long wait would not hold up immediate testing of the new module bundled with the PL plugin: it's just that the module wouldn't be able to be tested standalone until the standalone plugin is published on the directory.
@westonruter Having the features as modules and plugins was ruled out during the initial project definition as an option. See the conversation starting in https://github.com/WordPress/performance/issues/618#issuecomment-1432785852 for context.
@joemcgill Given that we won't use modules anymore, we may want to close this issue. Or at the very least rename it to maybe use "features" instead of "modules".
Personally, I'm not sure there's realistically a need for this in terms of making those features available at scale, as the plugin reviews have become much faster again, so I don't envision us being blocked from that anymore.
What is worth thinking about as you were mentioning the other day is how to make pre-release versions of features easier to test, but that's probably mostly a DX issue to improve for the contributors to the project rather than at scale (as in the 100k+ Performance Lab end users). It may fit better into a new dedicated issue that explains that goal.
Thanks @felixarntz. I would like to keep this issue open until we have a documented process for testing standalone plugins in development prior to being released on the .org repo. I've renamed the issue to no longer refer to "modules" in order to be more clear. There are two main reasons this is still needed:
As I've thought more about this, the easiest way for us to solve all of these issues is to make sure all of our standalone plugins are loaded automatically as part of the .wp-env.json
config, like this:
{
"plugins": [
".",
"./plugins/auto-sizes/auto-sizes.php",
"./plugins/speculation-rules/load.php"
]
}
That way the standalone plugins are auto-installed locally without additional workarounds.
Somewhat related, I think it would be nice to update our release workflows so that each plugin gets included individually in our releases page, with zip files attached for each standalone plugin release, along with changelogs, etc. This could also allow us to generate pre-releases if needed.
@joemcgill I like your wp-env
proposal, that would be a very straightforward start that would already improve DX a lot.
👍🏻 PR incoming for that shortly.
Removing this from the 3.0.0 milestone as it is not really relevant for end users of the plugin and thus doesn't have to be solved by that release.
@joemcgill I think this is done now, right?
Yes, I think we can close this. The standalone plugin folders are automatically loaded into the wp-env container since #1028. We can also build production versions locally using npm run build-plugins
since #1033.
Feature Description
Once #656 is complete, the intention was that new modules would be initially released as standalone plugins, and not bundled with the main Performance Lab plugin. This creates a situation where new plugin modules can not easily be tested or used prior to them being available on the plugin repo. Given the current long wait times for new plugins to be approved on the repo, this would create a significant problem for efficiently developing and testing out new features and no clear way of testing the feature prior to an initial release.
Currently, a new module can be activated from the Performance Lab settings screen before it has been removed as a standalone plugin, so a new module can be tested by checking out a feature branch of this repo that includes the new module and activating it in the settings screen.
Initial ideas to consider
As originally discussed in https://github.com/WordPress/performance/pull/904#issuecomment-1858540201, there are a few ways to address this issue:
Currently effected modules in development
556
805
886
897
904