electron-userland / electron-userland/electron-builder
Proper way to use custom publisher and provider
- Dominant language
- TypeScript
- Stars
- 14.7k
- Forks
- 1.9k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 48
Description
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.updateProvider` property 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.publish` or `electron-builder.publishArtifactsWithOptions` functions, 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 the `provider` string 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.
Contributor guide
Research direction
Start by reading the configuration handling around publish.provider, publish.updateProvider, electron-builder.publish, and electron-builder.publishArtifactsWithOptions. Compare the current custom-publisher loading behavior, including electron-publisher-custom.js in the build directory, with the requested configuration options. Done should be a decided, documented way to configure custom publishers and providers without unintentionally packaging them.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- electron, typescript
- Domain
- build-system, release
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100