Skip to content

Falling back to main branch instead of displaying docs for latest release #81

Description

@shadowspawn

Found via report that unreleased code showing in docs: yargs/yargs#2569 (comment)

Both the old jsonp sites are defunct, and falling through to main branch:

// use a service to wrap registry json in jsonp
var svcs = ['https://json2jsonp.com/', 'https://jsonp.afeld.me/']
var i = 0
var nextSvc = function () {
var svc = svcs[i++]
if (!svc) {
// no jsonp services worked, just use master
console.log('falling back to master branch :(')
return Flatdoc.run({
fetcher: Flatdoc.github('yargs/yargs', 'docs/api.md')
})
}
$.ajax(svc, {
data: {
url: 'https://registry.npmjs.org/yargs'
},
dataType: 'jsonp',
timeout: 2000,
jsonpCallback: svc.replace(/\W/g, ''),
success: function (data) {
var version = data['dist-tags'] && data['dist-tags'].latest
if (!version) return nextSvc()
console.log('determined latest version as %s via %s', version, svc)
Flatdoc.run({
fetcher: Flatdoc.file('https://raw.githubusercontent.com/yargs/yargs/v' + version + '/docs/api.md')
})
},
error: function () {
console.log('service failed: %s, trying next', svc)
nextSvc()
}

From console when loading docs:

service failed: https://json2jsonp.com/, trying next
TypeError: httpsjson2jsonpcom is not a function
[HUGE error omitted]
service failed: https://jsonp.afeld.me/, trying next
falling back to master branch :(

The docs are also slow to load, perhaps related to the failed attempts.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions