Repository navigation
Add link to latest release in readme - #395
Conversation
paulmolluzzo
left a comment
There was a problem hiding this comment.
Maybe I'm just missing something, but isn't the master README usually the same as the latest release? Sure, the README might have changed since the latest release, but even if that's the case I would think they want you to use the README that's on master.
Before I reviewed this PR I was thinking the link would have taken you to the release notes for the latest version. That's more valuable to me than seeing the README as it was for the latest release.
Thoughts?
|
Taking this repo as an example, when a new feature gets added to the README but hasn't made it into a release yet, people reading the README might wonder why that feature "doesn't work". With this button they can view the README at the state of the latest release. |
|
I think this makes sense. Not sure about how far we should take it though. Most projects use master as the development branch and new features might be in the readme before they're out in a release. |
|
I see the point then, thanks for more info. I don't have a strong opinion about this one. I'm not sure how to resolve the issue @jgierer12 pointed out when a project doesn't use semver. |
|
Big 👍 on this feature! On the order of tags - I don't think GitHub is sorting them alphabetically. GitHub is sorting them either based on date or based on semver. If it was sorting them alphabetically, then 1.10 would be before 1.16. However, if a project supports two major branches and has 1.13 created after 2.0.1. Then we'd take the 1.13 release if GitHub is sorting them by creation date. The selection from tags selector works only if GitHub is doing some semver ordering (which they may do). Otherwise, we may create a request to the releases page where GitHub marks which the latest release (if the project is using GitHub releases and not just tags) and also pre-releases are not considered as latest which we won't exclude otherwise. So as much as I'd like to have this feature, it's not as straightforward as I'd like unless we have some support from GitHub. |
|
GitHub has no sense of semver, it sorts tags by date. |
|
I've labelled as "under discussion" since not really sure if we've decided on implementation which works for us. So for now without API calls we can do one of those:
Could you please vote on these with emoji? a. 🎉 Launch sooner |
669e5c2 to
3441a05
Compare
|
If we're going to do this, we should do it properly. Many projects backport bug fixes to older versions, like Electron: https://github.com/electron/electron/tags (Notice the v1.3.15). I've made a module to make this easier: https://github.com/sindresorhus/latest-semver Here's a browserified version we can bundle directly: https://gist.github.com/sindresorhus/ae3a8d9275bae19c9f3cfa22c77b8251 Just use it as a global |
@sindresorhus Thanks! Could you also make a browserified version of https://github.com/sindresorhus/semver-regex? I need that seperately since I want to get the full branch name of the latest release instead of the "cleaned" name that |
|
Sure, here you go: (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.semverRegex=f()}})(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){"use strict";module.exports=function(){return/\bv?(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[\da-z\-]+(?:\.[\da-z\-]+)*)?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?\b/gi}},{}]},{},[1])(1)});Call it with |
|
Here is You can use it as For reference, the script I'm using: Make sure you have https://www.npmjs.com/package/uglify-es installed, and not normal Uglify. |
|
@sindresorhus Thank you, I think that's the last one I'll need 😅 |
|
I can't wait for us to be able to use ES2015 modules. |
|
I think the button is a tiny bit too close to the edit button.
Maybe: |
|
@sindresorhus @jgierer12 👏 This is awesome! Thanks! When browsing projects with this I've noticed I'd prefer the link to the latest release to be somewhere to the top. Some projects have a big list of files and folders in the root and the readme is pushed down a lot. Having that button visibly accessible as soon as you open the repo page would be more useful in my opinion. I think just to the right of the branch selector would be best. That's not to say the link from the readme should be removed, though. What do you think? Could we put this above the repo file browser on the left side, to the right of the branch/tag selector? |
That's a great idea, but I think we should use another icon for that. Maybe
I tried to keep it short and in line with GitHub's native tooltips, but I agree we should make it clear that it's the latest release. |
This got me thinking... We can actually add such link to every blob in a repo quite easily. We can have it in readme on the main page of the repo when the file header is not visible, but on blob pages we can have it either next to the branch selector or in the file header with the other buttons. P.S. Probably in another PR, though. Just let me know your thoughts and I could try it out when this is merged. |
👍 for putting it next to the branch selector |
👍 |
|
LGTM and leave #395 (comment) for a separate PR |
|
Merge? I'm looking to work on the build once approved, and that would create a lot of conflicts since most files will be moved. |
|
@jgierer12 Can you fix the merge conflict? @bfred-it Feel free to fix the merge conflict and merge right away if you want. |
23bf52d to
b0251ef
Compare
b0251ef to
38abcb1
Compare

Fixes #288.
Only works if using semver since the tags are sorted alphabetically 😕 - perhaps it would be better to make an AJAX call to the API?
Screenshot: