Skip to content

Conversation

@paulrobertlloyd
Copy link
Collaborator

@paulrobertlloyd paulrobertlloyd commented Feb 26, 2025

By using class inheritance with a base IndiekitPlugin class with child classes for the different plug-in types, it becomes possible to orchestrate common functionality and centralise debugging and error handling.

This becomes even more important if we want to use an event-based model with hooks, to allow multiple plugins (and of certain types) to perform functions at given points in the publishing lifecycle. The goal is to strike a balance between giving plug-ins flexibility to determine behaviour, but have a plug-in system that works in a reliable and consistent way.

We should try to keep largely to the existing plug-in API, but at least one required changed would be to have a plug-in inherit from a parent plugin class to continue working.

Todo

  • Initial proof of concept
  • Convert endpoint plug-ins
  • Convert post type plug-ins
  • Convert preset plug-ins
  • Convert store plug-ins
  • Convert syndicator plug-ins
  • Add checks for required properties and methods
  • Built-in error handling
  • Update tests
  • Add tests for base and type plug-ins
  • Add ADR
  • Update documentation

Later PRs

  • Automatic plug-in registration?
  • Publication presets set post/media paths without directly modifying postTypes object

@paulrobertlloyd paulrobertlloyd changed the title feat: use class inheritance for plug-in api [wip] [WIP]: Use class inheritance for plug-in API Feb 26, 2025
@paulrobertlloyd paulrobertlloyd added enhancement code quality Making things easier to understand core Core indiekit package plugin api labels Feb 26, 2025
@paulrobertlloyd paulrobertlloyd force-pushed the feat/plugin-api branch 14 times, most recently from 246fb38 to 00c33a7 Compare March 2, 2025 22:27
@paulrobertlloyd paulrobertlloyd added this to the v1.0 milestone Mar 2, 2025
@paulrobertlloyd paulrobertlloyd force-pushed the feat/plugin-api branch 2 times, most recently from aa0535f to d4c464e Compare March 3, 2025 00:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code quality Making things easier to understand core Core indiekit package plugin api

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants