-
Notifications
You must be signed in to change notification settings - Fork 101
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
Implement CLI command to for a build process to transform modules into standalone plugins #635
Comments
@felixarntz I think these requirements for a build process look pretty good to me. The main thing I think we should add here is that each built plugin should also include a README file (covered in #636, but should be thought of together with this task, I think). I think it would be easiest if we were to add module-specific readme's in folders with each module. Having a folder for each module would also allow us to add independent configuration files in each that would responsible for things like text-domains, plugin slugs, etc. if we wanted to keep those independent from a single |
@joemcgill I think we can handle #635 and #636 separately. I'd prefer to iterate and we don't have to do all of that in one PR. Coming up with the readme content itself will be a bit of extra work, and that IMO shouldn't block us from working on this issue. #636 would include expanding the build process implemented in this issue here accordingly, to build the The changes proposed in this issue here can already work by themselves, so I don't see why we would need to combine both issues.
Agreed, we already have the module directories so we can just add the readme files to them. Though per my above reply I think we should work on that as part of #636.
To me, a single |
@felixarntz one question Do we need to use any cc. @joemcgill |
Additional question: Do we need can-load.php file in standalone plugin? |
Great question. I think for now we don't have any, so let's not worry about it for now. We can follow up separately on that to see whether there's a chance for us to get some good icons / banner for those standalone plugins.
That's another great question. I think we should keep it for now in both, because it is critical even for the plugin that they don't run their functionality / add their hooks when those conditions from the For the PL plugin, the check is run prior to activation, which of course for a plugin doesn't work. But in the plugin it would need to happen when the plugin is already activated. I think we should add something like the following to the top of every module's function moduleprefix_can_load() {
$can_load = require __DIR__ . '/can-load.php';
if ( $can_load() ) {
return true;
}
add_action(
'admin_notices',
function() {
// Render an error notice that the plugin cannot be initialized because of the conditions not being met.
}
);
return false;
}
// Do not run the plugin if conditions are not met.
if ( ! moduleprefix_can_load() ) {
return;
} |
@felixarntz Some functions have two cc. @joemcgill |
@mukeshpanchal27 In many cases, a second |
closed this as completed in #662 |
Feature Description
Following #618 (comment), we now have an initial path forward for unbundling the Performance Lab plugin and creating standalone plugins from modules. While it is still being discussed whether we will publish all modules as standalone plugins or just a subset of them, we can definitely start working on the infrastructure changes needed.
For the purpose of this issue, let's simply start with one module,
images/webp-uploads
. This is just so that we can get started with one plugin.database/sqlite
would be the other big priority to publish as standalone plugin, but that one is already available through the separate repo, so it's not a good idea to cover it here. In fact, it should be handle in a separate issue as bringing the codebase back into this monorepo will have its own little quirks to consider.Requirements
plugins.json
) which contains a map of module directories and their associated standalone plugin configuration (for now probably just the WordPress.org plugin repository slug and intended version). The file should for now only contain theimage/webp-uploads
module. For example:build-plugins
inbin/commands
that does the following:image/webp-uploads
) into a (git-ignored) build directory.load.php
file's module header with a corresponding plugin header:Plugin Name
andPlugin Description
should use the module name and description respectively.Plugin URI
should point to the module's directory in this GitHub repository.Text Domain
should match the target plugin's slug.Version
should use the target version from the config file.'performance-lab'
text domain with the correct text domain for the individual plugin based on its slug (see above).The text was updated successfully, but these errors were encountered: