Skip to content

Implement CLI command to for a build process to transform modules into standalone plugins #635

@felixarntz

Description

@felixarntz

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

  • Add a config file (e.g. something like 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 the image/webp-uploads module. For example:
{
  "images/webp-uploads": {
    "slug": "webp-uploads",
    "version": "1.0.0"
  }
}
  • Implement a new Node CLI command build-plugins in bin/commands that does the following:
    • Copy over all module directories based on the above config file (i.e. for now only image/webp-uploads) into a (git-ignored) build directory.
    • After copying over, replace each load.php file's module header with a corresponding plugin header:
      • Plugin Name and Plugin 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.
      • All other fields (requirements, author, license, ...) should match what is in the Performance Lab plugin's own plugin header.
    • Replace all usages of the 'performance-lab' text domain with the correct text domain for the individual plugin based on its slug (see above).

Metadata

Metadata

Labels

InfrastructureIssues for the overall performance plugin infrastructure[Plugin] Performance LabIssue relates to work in the Performance Lab Plugin only[Type] EnhancementA suggestion for improvement of an existing feature

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions