Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Programmatically receive progress events #3493

Closed
davej opened this issue Nov 21, 2018 · 9 comments
Closed

Programmatically receive progress events #3493

davej opened this issue Nov 21, 2018 · 9 comments

Comments

@davej
Copy link
Contributor

davej commented Nov 21, 2018

  • Version: 20.29.0

I would like to consume the progress events of electron-builder programmatically. Currently, it looks like all I can do is try to parse the output from stdout. Is there a way to consume progress events without resorting to parsing stdout? If not, would this be considered as a feature request?

@develar
Copy link
Member

develar commented Nov 26, 2018

@davej
Copy link
Contributor Author

davej commented Nov 26, 2018

Thank you @develar, really appreciate your pointers. A few more questions which I would love your help on.

  1. Is it possible to get something like an artifactStarted event?
  2. Is it possible to get access to something like uploadStarted and uploadFinished events from publisher?
  3. Is it possible to provide my own logger instance (or somehow override the existing one) so I can parse it? (Instead of trying to parse stdout directly).

If you like, I can submit a PR with some documentation on this when I have a decent understanding?

@develar
Copy link
Member

develar commented Nov 26, 2018

@davej To ensure that I don't waste my time, could you please explain what do you want to achieve and for what do you need so tight integration?I want to understand your purpose to provide more concise tips.

@develar develar reopened this Nov 26, 2018
@davej
Copy link
Contributor Author

davej commented Nov 26, 2018

Of course. I'm working on an online tool that converts URLs into fully-built electron desktop apps that are ready for distribution.

The online builder currently reports progress events (and a progress bar) from the builder to the UI using Web Sockets. The current version doesn't use electron-builder and I call different packages (e.g..electron-winstaller) directly from my code. As a result of having more control, the progress bar on the UI is pretty granular and accurate.

So, to summarise: I would like to switch to electron-builder but still retain the accurate progress events and progress bar if possible.

@develar
Copy link
Member

develar commented Nov 26, 2018

I hope you are aware about https://github.com/electron-userland/electron-build-service.

Ok, so, indeed you should use the same approach as electron build service — see first link, https://github.com/electron-userland/electron-builder/blob/master/packages/app-builder-lib/src/remoteBuilder/builder-cli.ts#L74

Do you see? Private method _build is used.

artifactStarted event...

There are 2 approaches:

A. build exactly as CLI version does.
B. build in pre-packaged format and then build in distributable format.

electron build service uses B because of privacy — to build project into pre-packaged format we need all project sources. And then this pre-packaged transferred to remote server.

App can be build in several distributable formats in parallel.

So, what I want to say — if you will use fine-grained control over build, you don't need artifactStarted event. At first, you will package it in prepackaged format, then invoke (in parallel or whatever you want) electron-builder again with prepackaged option to build in distributable format.

Ok, ok, maybe it is too complicated and if your app does the whole job in one session on one machine, you can simply use app-builder-lib (again, I suggest to not use electron-builder directly programmatically to avoid yargs dependency).

I will add events till tomorrow morning CET.

@davej
Copy link
Contributor Author

davej commented Nov 26, 2018

I hope you are aware about https://github.com/electron-userland/electron-build-service.

No, I'm not aware of electron-build-service yet. Thanks for the link, I will take a look. Looks very interesting.

There are 2 approaches:

A. build exactly as CLI version does.
B. build in pre-packaged format and then build in distributable format.

Ok, I understand. Privacy is not such an issue for me, because I am building from publicly accessible resources anyway (i.e.. the website has to be hosted on a publicly accessible URL). I think eventually I will split out the build process so it can be parallelized more easily. For now, though, I want to keep it simple because I'm on a schedule and I want to rely on well-tested libraries because I have to ensure it works across 3 different build servers: Windows (because of EV hardware dongle signing), Mac and Linux.

I will add events till tomorrow morning CET.

Thank you, this is much appreciated! Will you be adding them as config hooks or events on packager out of interest?

develar added a commit to develar/electron-builder that referenced this issue Nov 27, 2018
@develar
Copy link
Member

develar commented Nov 30, 2018

artifactBuildStarted and artifactBuildCompleted added (released 3 days ago, forgot to comment here).

@davej
Copy link
Contributor Author

davej commented Dec 29, 2018

Thanks for this @develar.

Are there plans to add uploadStarted and uploadFinished events? I'm just asking because otherwise I will build my own custom uploader but it would be nicer to use electron-builder.

develar added a commit that referenced this issue Apr 1, 2019
@stale
Copy link

stale bot commented Jul 1, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the backlog label Jul 1, 2019
@stale stale bot closed this as completed Jul 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants