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
GitHub url does not work when there are no releases #18101
Comments
"latest" links only support releases. Commits (branches) change too often and couldn't be cached effectively plus there would be a high chance of breaking changes. |
I think you can use the same algorithm that is used for the latest release. https://cdn.jsdelivr.net/gh/jquery/jquery/dist/jquery.min.js I don't think "change too often" is a good argument because someone could do several releases in a matter of minutes.
Maybe that's true for some repos but many have CI so that breaking changes are never merged into master. The one I linked to would never have breaking changes because it only contains data. https://github.com/jsonmc/jsonmc
Now that RawGit is going down, there are going to be users flocking to jsdelivr. If you can't meet their needs, they'll go elsewhere. https://rawgit.com/ |
We will consider adding this. |
Thank you for considering! 👍 I'll give you another use case to think about. The marked.js project has a demo page that we use to verify a bug occurs in the most recent npm release. We have considered adding a dropdown to pick a version of marked to load so we can see when a bug was introduced. That should be relatively easy to implement since jsdelivr lets you pick a verison. What we are unable to do now is to load the master branch version of marked to see if a bug is already fixed but hasn't been released yet (we go months between releases and bugs can get reported many times but are already fixed). Using jsdelivr to load from master branch would be superb! |
Just a note that even if we allow this, we'll most likely use 7 days cache time (like for current latest release); 24 hours would be absolute minimum. Of course you can purge the link via our API in CI build but at that point you could also do what ractive.js does - publish every single build to npm, tag it as |
I think that would be acceptable for this use case. Typically, months go by without a release as you can see from the npm version history.
That sounds really cool! Where can I find this API?
That is an interesting workaround. I think typescript does something similar. This would require a little more work and giving CI ability to publish to npm which we don't currently do. I'll think about this too. |
We also publish master as npm prereleases using Travis which works quite well :) https://github.com/video-dev/hls.js/blob/master/scripts/travis.sh |
It looks like your competitor, Staticaly, already implemented this feature using a dev flag. https://cdn.staticaly.com/gh/markedjs/marked/master/lib/marked.js?env=dev In fact, it looks like they copied a lot of what jsdelivr does and how it looks. |
We're aware, the last time I checked even some pages on their website were exact word-to-word copies of jsdelivr.com. |
Guess what just landed on our servers 😉 https://cdn.jsdelivr.net/gh/jsonmc/jsonmc/ |
@MartinKolarik Thank you so much! I will continue to proclaim @jsdelivr as the greatest service ever! 😄 |
Amazing, @MartinKolarik ✨ If you wouldn’t mind adding the Thanks again 👍🏼 |
@MartinKolarik, does committing and pushing changes to a branch not update the branch file? I committed and updated changes to it a good 15 minutes ago, yet changes haven’t shown up. link |
Saw this, thanks! jsdelivr/www.jsdelivr.com#179 (comment) |
@heymartinadams there's no example at https://www.jsdelivr.com/?docs=gh but the first line mentions it:
I agree the readme should be updated too though. |
I discovered that jsdelivr won't fetch the master branch if there are already release versions. I tried to fetch a fork of flatdoc but the url failed to load. This is the url I trying to load: |
@AlienKevin there's no master branch in that repo, only gh-pages branch, and your file path is wrong as well. It's theme-slate/style.css, not slate-theme/style.css. The correct link is https://cdn.jsdelivr.net/gh/Thrilleratplay/flatdoc@gh-pages/theme-slate/style.css |
I just "convinced" google/code-prettify to switch from RawGit, only to realize we still have issues because we're using master directly. @MartinKolarik, is the 7 day policy you mentioned in place? Because the change was made 7 weeks ago, and cdn.jsdelivr.net is still serving the old version (cache-control is also one year, immutable). Is purging the only answer? I'm not trying to get you to change anything, rather I want to understand the system, so we can figure something out. |
@ncruces We also had this problem with |
Yes, that works. The problem with google/code-prettify is that the main js file loads plugins (other js and css files). And those URLs (which now point into master) are hard coded into the source. Commit hashes can't fix this. Tagging releases (and changing the code to match) can. |
@ncruces there was a bug about 2 months ago, which caused some @Branch files to be marked as static/immutable. The affected version of our code was live for about a week and some URLs cached at that time might have longer cache-control expiration. I purged your URLs and now they have correct headers. |
@MartinKolarik Thank you! That solves my problem. |
I would expect the github url to work even when there are no releases and instead, use the master branch.
For example, /gh/jsonmc/jsonmc/ has the following response:
Or at the very least, could there be an option to use a branch instead of a tag such as
@master
?The text was updated successfully, but these errors were encountered: