Am I the only one that finds the documentation to develop a custom plugin is severly lacking (in English that is).
I find myself constantly having to check out how the core plugins are programmed in order to try to derive how something works, and how to use it, costing me a lot more time to develop even basic functionality in my plugin.
The same for reloading a plugin’s server side when developing on it, which has to be done manually, which slows my development speed down even more.
Would it be possible to get some pointers on how the core team does this? So we can also be productive?
Thanks!
We are working on the documentation, but it will still take some time.
Normally the server side is suppose to watch for code changes and reloads automatically. Could you please provide additional informations? For example, OS, NocoBase version and more details about your development process.
Thank you for your response;
I am using the latest version of nocobase (upgraded to v1.3.27-beta).
That is running inside of a docker-container using yarn run dev
, with the packages and storage folder mounted as a volume).
Indeed, if I change files inside of my plugin “client” folder, the reload happens correctly; Rather this isn’t the case for the “server” folder of the plugin.
I am working on migrations and adding a custom collection in my plugin, but the collection (and it’s fields) are not added to my collections (even though I based it of existing plugins). So I want to debug what’s happening when nocobase executes the async load().
According to the documentation (https://docs.nocobase.com/development/client#plugin-lifecycle) I suspect the load function only gets called on “installing” the plugin.
Seeing I don’t know how the proper plugin development flow is, I had to write an additional script to refresh my plugin like so:
yarn build @pluginname/events
docker exec -ti studio yarn pm disable @pluginname/events
docker exec -ti studio yarn pm remove @pluginname/events
docker exec -ti studio yarn pm add @pluginname/events
docker exec -ti studio yarn pm enable @pluginname/events
Which does it job correctly, but it just seems very cumbersome to me.
Any pointers on how you guys do this, to speed this up?
Thanks!
- As I just use the source code on my device directly for developing, I am not sure if
tsx
works correctly in a docker-container, maybe you can refer to this issue Watch not working with docker · Issue #266 · privatenumber/tsx · GitHub.
Refer to https://docs.nocobase.com/development/server/collections/configure, you are required to run yarn nocobase upgrade
if the plugin is already enabled.