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

Example of versions.json #1

Open
kipBO opened this issue Apr 1, 2023 · 2 comments
Open

Example of versions.json #1

kipBO opened this issue Apr 1, 2023 · 2 comments

Comments

@kipBO
Copy link

kipBO commented Apr 1, 2023

It might be a simple question but I can't find a example of the versions.json file. Could you add it so we know how it should be build?

@TheJaredWilcurt
Copy link
Member

Great question.

  • This project is not ready for use yet. When it is, it will be bumped to version 1.0.0 and published on npm. But thanks for the early interest
  • The versionUrl part of the API can be set to any URL you like, the version.json that is shown there is just an example. It can be any endpoint, even one that just returns plain text of the latest version number.
  • Whatever content is returned will then be passed into the confirmNewVersion and downloadPath functions you provide.
    • confirmNewVersion - You define whatever function you want here, I will hand it the response from the network request (from versionUrl) as well as the latestLocal which will be a string like 1.2.5 (whatever the current latest version of your app is that was previously downloaded). If it is the first time it is ran, then latestLocal will be undefined. You can then use whatever data your network response returned to decide if a new version is available and should be downloaded. If a new version is available return a string of the newer version number so we can create folders where downloads will be stored. If your function determines that the latest remote version is already on the local machine then it can return false to skip downloading/extracting a new version, and instead just launch the current local copy of the app.
    • downloadPath - You define whatever function you want here. This function will only be called if the confirmNewVersion function returned a string, instead of false. I will hand it the response from the network request (from versionUrl). Your logic can then either find the url to the latest ZIP in that response, or compose a url (if it is a predictable pattern), or even make it's own async network calls to get the details. Whatever you want! But ultimately, it needs to return a string of a url to a zip file to be downloaded/extracted.
  • The idea here is that everyone will have a different system and way of keeping track of things, so we want to give you as much control as possible.
  • I'll update the README later to try to make it more clear that it's just an example.

@kipBO
Copy link
Author

kipBO commented Apr 1, 2023

Thanks for the reply, I will wait for the release. Already looking forward to is, if you could make a demo like you did for the nw-splash you would do me a big favor. Keep up the good work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants