Proper way to use custom publisher and provider
I am trying to implement a custom publisher as none of the default fits my current situation/requirements. Implementing such a publisher and provider should be straight forward, but it gets akward due to lack of configurability.
The only good source on how to configure things is a post last updated in 2022 which does seem to work, but requires lots of comprimises. https://github.com/electron-userland/electron-builder/issues/3261
In short:
publish.provider = "generic"seems to do nothing.publish.provider = "custom"gives the opportunity to create a customPublisher and/or provider.- There is a
publish.updateProviderproperty when creating the config in a javascript/typescript file which seems to provide an update-provider-instance-supplier (not sure why its there as the update-provider should be within the application, not as part of the build/publish phase?), but there is no version for the publisher. - In order for a custom-publisher to work it needs to be placed inside the build-directory, which means it gets packed with the application when not explicitely excluded in the electron-builder configuration!
- The custom-publisher file has to have the name
electron-publisher-custom.js, and needs to default-export the publisher-class. - There is no (easy) way to circumvent this with manually triggering the build and publish sequence using
electron-builder.publishorelectron-builder.publishArtifactsWithOptionsfunctions, as they only accept the configuration-data but do not allow for direct custom-publisher-initialization
Eventhough it is technically possible to have custom-publishers and providers it is a mess IMO.
Ways to improve:
- Offer a
publish.updatePublisher(or something similarly named) for the javascript/typescript config-version - In the issue linked above there was a mention
electron-publisher-${provider}should be a format that works. This would be great if we would be able to actually replace theproviderstring with a custom-string (not the literal 'custom'). This way multple custom-publishers can be created/used within a single project. Besides it creates the opportunity to allow third-party publishers/providers to be created. - Allow a custom directory to be chosen as to where to search for any custom-publishers as they should not be part of the application itself, and therefore should preferably not be placed in the build-directory.
- For some added controll, maybe add a 'register-function' exposed within the 'electron-builder' package.
As I am rather new to this project, I am not sure if I have missed some easier/cleaner way to accomplish a 'customPublisher' configuration. So any input regarding the improvement of configuring the 'customPublisher/provider' as wel as idea's/info on how to do things better using the current version are welcome.
Source: electron-userland/electron-builder