Skip to content

Add link to latest release in readme - #395

Merged
jgierer12 merged 13 commits into
refined-github:masterfrom
jgierer12:enhancement/readme-release
Jun 1, 2017
Merged

jgierer12 merged 13 commits into
refined-github:masterfrom
jgierer12:enhancement/readme-release

Conversation

@jgierer12

@jgierer12 jgierer12 commented May 1, 2017 •

Copy link
Copy Markdown
Contributor

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: Readme buttons

@paulmolluzzo paulmolluzzo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@jgierer12

Copy link
Copy Markdown
Contributor Author

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.
Maybe we should make it more obvious (not hidden behind an icon), so they immediately see that the README has been updated since the latest release. We'd certainly need an API call for that to work though.

@sindresorhus

sindresorhus commented May 2, 2017 •

Copy link
Copy Markdown
Member

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.

@paulmolluzzo

paulmolluzzo commented May 3, 2017 •

Copy link
Copy Markdown
Contributor

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.

@hkdobrev

hkdobrev commented May 3, 2017 •

Copy link
Copy Markdown
Contributor

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.

@sindresorhus

Copy link
Copy Markdown
Member

GitHub has no sense of semver, it sorts tags by date.

@hkdobrev

hkdobrev commented May 9, 2017

Copy link
Copy Markdown
Contributor

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:

  • a. Use the latest tag by date and add some short note to the link saying it's the latest by date. This would work for the majority of the repos as most people are not supporting multiple major/minor branches.
  • b. Add some semver parsing library so we can use the last semver tag. It's more complex, but semver would make sense I think for most users of the extension and would fix some problems with a.

Could you please vote on these with emoji?

a. 🎉 Launch sooner
b. ❤️ Launch with semver support

@jgierer12
jgierer12 force-pushed the enhancement/readme-release branch from 669e5c2 to 3441a05 Compare May 10, 2017 21:46
@sindresorhus

Copy link
Copy Markdown
Member

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 latestSemver().

@jgierer12

jgierer12 commented May 12, 2017 •

Copy link
Copy Markdown
Contributor Author

I've made a module to make this easier: https://github.com/sindresorhus/latest-semver
Here's a browserified version we can bundle directly

@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 latest-semver returns

@sindresorhus

Copy link
Copy Markdown
Member

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 semverRegex().test('something').

@sindresorhus

Copy link
Copy Markdown
Member

Here is to-semver browserified: https://gist.github.com/sindresorhus/c6ebcc0075fc08189a1197a953c3bfa9

You can use it as toSemver(['v0.1.0', 'v1.0.0']).


For reference, the script I'm using:

browserify --standalone=toSemver . | uglifyjs > browser.js

Make sure you have https://www.npmjs.com/package/uglify-es installed, and not normal Uglify.

@jgierer12

Copy link
Copy Markdown
Contributor Author

@sindresorhus Thank you, I think that's the last one I'll need 😅

@sindresorhus

Copy link
Copy Markdown
Member

I can't wait for us to be able to use ES2015 modules.

@sindresorhus

sindresorhus commented May 12, 2017 •

Copy link
Copy Markdown
Member

I think the button is a tiny bit too close to the edit button.


View this file at 1.16.1

Maybe: View the latest tagged version (1.16.1) of this file or something similar and shorter.

@hkdobrev

Copy link
Copy Markdown
Contributor

@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?

image

@jgierer12

Copy link
Copy Markdown
Contributor Author

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 book? That might be misleading though since it's also used for the wiki

Maybe: View the latest tagged version (1.16.1) of this file or something similar.

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.

@hkdobrev

hkdobrev commented May 12, 2017 •

Copy link
Copy Markdown
Contributor

Maybe: View the latest tagged version (1.16.1) of this file or something similar and shorter.

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.

@jgierer12

Copy link
Copy Markdown
Contributor Author

We can actually add such link to every blob in a repo quite easily

👍 for putting it next to the branch selector

@sindresorhus

Copy link
Copy Markdown
Member

👍 for putting it next to the branch selector

👍

@jgierer12

Copy link
Copy Markdown
Contributor Author

LGTM and leave #395 (comment) for a separate PR

@fregante

fregante commented May 29, 2017 •

Copy link
Copy Markdown
Member

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.

@sindresorhus

Copy link
Copy Markdown
Member

@jgierer12 Can you fix the merge conflict?

@bfred-it Feel free to fix the merge conflict and merge right away if you want.

@jgierer12
jgierer12 force-pushed the enhancement/readme-release branch 2 times, most recently from 23bf52d to b0251ef Compare June 1, 2017 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

5 participants