framework icon indicating copy to clipboard operation
framework copied to clipboard

feat: introduce frontend extenders

Open SychO9 opened this issue 2 years ago • 0 comments

Changes proposed in this pull request: Prior to this, frontend extenders never actually worked before, nor could any extension use them at all as they weren't exported in compat either. This PR does the following:

  • Refactor extenders in core for them to actually work:
    • They are now in the common/extenders directory to avoid conflicts with the extend.ts module).
    • An IExtender interface has been introduced.
    • Th Routes and PostTypes extenders have been adapted to the new changes and the Model extender was removed for a separate PR.
  • Make use of the Routes and PostTypes extenders in bundled extensions.
  • The extenders can be accessed by exposing an extend module from the extension, which contains an array of extenders.

Reviewers should focus on:

  • JS Tests are only failing because check-typings is running before new typings are built.
  • The bundled extension changes were made here as an example, but I can extract them into another PR if wanted. The commits are separated though, so it should be easy to review.

Necessity

  • [ ] Has the problem that is being solved here been clearly explained?
  • [ ] If applicable, have various options for solving this problem been considered?
  • [ ] For core PRs, does this need to be in core, or could it be in an extension?
  • [ ] Are we willing to maintain this for years / potentially forever?

Confirmed

  • [ ] Frontend changes: tested on a local Flarum installation.
  • [ ] Backend changes: tests are green (run composer test).
  • [ ] Core developer confirmed locally this works as intended.
  • [ ] Tests have been added, or are not appropriate here.

SychO9 avatar Sep 16 '22 17:09 SychO9