strapi / rfcs

RFCs for Strapi future changes
68 stars 33 forks source link

[V5] Plugin CLI #55

Open joshuaellis opened 10 months ago

joshuaellis commented 10 months ago

Introduce a dedicated plugin CLI to assist developers in creating plugins for strapi the right way easily

You can read it here

ComfortablyCoding commented 10 months ago

Posting here from discord per request from joshua.

This looks great!

Suggestions

One additional command that I would suggest is a db migration generation one. Enabling devs to generate knex migrations that will be picked up and executed at boot.

Questions

For me the last major pains for plugins are:

  1. Testing
    • When trying to test manually I need to install and have it within a strapi application which is not ideal, is it possible we would be able to do some sort of playground like nuxt modules can do? Is this what the link command is for?
    • Automated tests (both front-end and back-end) are not easily done. I assume that's why most plugins do not have any.
    • When testing the admin the errors are not descriptive or easy to find as build is awlays for prod.
  2. Extensibility of core
    • A lot of internal but useful things (utils, components, hooks etc) are not exported and easily consumable by a plugin. It forces the devs to re-implement duplicate logic.

Any chance these are being addressed/looked into as well?

joshuaellis commented 10 months ago

Thanks for the feedback @ComfortablyCoding.

Testing

the link command should easy the ability for testing as you can use your local plugin as if it were installed in a strapi app, your set up could look like:

my-plugin/
├─ demo/
├─ src/
│  ├─ index.ts
├─ package.json

Where demo is a local strapi app – alternatively if you're building a plugin for your strapi app you could link it anywhere on your pc – we'll be using yalc to facilitate this. RE. automated testing, I agree, it's not easy to test strapi-fe at the moment externally unless you have a lot of deep knowledge. From the work we're doing in V5 a small ambition is to export some test utils either from the admin-package or elsewhere so you have a testing harness e.g. a store built etc. Finally regarding the build, we're aware the source-maps don't exist and are not ideal, this is something else we want to address 😄

Extensibility of Core

It'd be great to understand what you feel you're missing on this side so we can look into providing these exports. I think the naming conventions in the codebase at the moment are not very user friendly and i'd like to look at exporting more for users with clear names and guides.

ComfortablyCoding commented 10 months ago

Nice, hopefully that resolves some issues.

In terms of the extensibility of the code it was more for the admin panel than the design system I guess. Technically unrelated here.

In terms of the design system their are common UI interfaces missing from the design system but present else where. For example the components exported from the helper plugin.

Possibly already addressed by https://github.com/strapi/design-system/issues/1269.