automotiveMastermind / prompt

A spectacular prompt for *nix distributions.
MIT License
9 stars 6 forks source link

refactor: redesign prompt update #62

Open dmccaffery opened 4 years ago

dmccaffery commented 4 years ago

When auto-update is enabled, prompt currently checks for new versions on every execution of the profile, which includes every terminal window / tab that is opened. This has a side effect of significantly slowing down profile execution performance as well as being somewhat abusive of the GitHub api, which is what we use to check for new versions.

To avoid these drawbacks in 8.0, we disabled the auto update feature by default, but this will only effect net-new installations of prompt.

A better approach would be to perform a check once per day, or even once per week.

This could be done by writing a timestamp into the SHA marker file and evaluate (on every profile execution) whether or not that timestamp is more than a day or week old and only then checking for updates.

As part of doing this, we should disable the existing env var and replace it with a string based var containing one of the following values:

What does the community think of this idea? Any better alternatives?

sjk07 commented 3 years ago

This was one of the things that bothered me a lot. The check would take quite a bit of time and if you are not connected to the internet it would wait for a timeout. This is something we can definitely improve on!

I think a default of once per week makes sense. with the ability to overwrite. The prompt should still output the current version and last date checked to inform the user to manually update if they like.

we could also extend this in the future to opt into pre-releases for breaking change versions to obtain feedback from users.

github-actions[bot] commented 3 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

sjk07 commented 3 years ago

Now that we have github releases working I think we we should extend this issue a little bit.

Updating prompt should be based on releases. we can keep using the commit sha to allow for the most flexibility but we should also be showing the release version that is currently running / what the user can update to. (I see there is already a sh script to hit the github api to do this.

I also think we should allow users to opt into the pre-release cycle. At the moment this is possible by doing it manually via an argument but the side effect is that once you do this prompt will always show that it is out of date since it uses the sha on the master branch to determine what the latest release is.