webiny-js icon indicating copy to clipboard operation
webiny-js copied to clipboard

Extensions

Open adrians5j opened this issue 1 year ago • 0 comments
trafficstars

Changes

This PR improves the way developers are developing on top of Webiny.

Prior to this PR, we've had multiple approaches when it comes to locating custom code (plugins/extensions), where sometimes we'd be creating code inside of the apps/{project-application} folder , and sometimes outside of it, within a new yarn workspace, .e.g. packages/myPackage. Our docs contain examples with both approaches being used.

And not only that. Once a piece of code was written, users would still manually have to import it in an entrypoint file, like:

  • GraphQL API - apps/api/graphql/src/index.ts (a ~150 LOC file 🫢)
  • Admin - apps/admin/src/App.tsx

So, all in all, not only there wasn't a one-and-only approach of doing things / locating the code, but also, having to perform multiple steps in order to bring a plugin/extension to life was simply not ideal DX and error-prone.

With this PR, we are fixing this, by basically introducing the extensions folder in project root, and making it the central place where users will be creating their plugins/extensions. So, this way, users won't have to deal much (if at all) with the apps folder.

Users won't even have to register their plugins in mentioned entrypoint files, because, via the new New Extension scaffold that we're also introducing with this PR, this daunting step is automatically done for them.

image

One other improvement we did here was moving the apps/theme folder into extensions/theme, so that, again, users have less reasons to go into the apps folder. Which also finally makes the apps folder only contain the actual project applications, which makes 100% sense:

image

How Has This Been Tested?

Manually.

Documentation

Changelog. Docs. Videos.

adrians5j avatar May 05 '24 21:05 adrians5j