Page MenuHomePhabricator

cdnjs mirror not recommending latest version
Closed, ResolvedPublic

Description

I see that our mirror is recommending outdated versions for "Use latest". https://tools.wmflabs.org/cdnjs/
E.g. Angular-touch is at version 1.6.5 but our mirror says "Use latest (1.5.7)".
The latest version is available at https://tools-static.wmflabs.org/cdnjs/ajax/libs/angular-touch/ but is not being recommended.

@zhuyifei1999 notes that: The relevant code for generating the index is https://github.com/wikimedia/labs-tools-cdnjs-index

(IIUC, it is *not* related to https://github.com/cdnjs/cdnjs#latest-version-url-support and we should actually be linking devs to the latest available version in our UI, as they do at https://cdnjs.com/)

Event Timeline

The generator script is blowing up with:

Traceback (most recent call last):
  File "generate.py", line 31, in <module>
    'version': package['version'],
KeyError: 'version'

Where is cdnjsurl pointing to? I can't seem to reproduce this on https://cdnjs.com/packages.json

Change 368600 had a related patch set uploaded (by BryanDavis; owner: Bryan Davis):
[labs/tools/cdnjs-index@master] Handle packages missing a version key

https://gerrit.wikimedia.org/r/368600

Change 368600 merged by BryanDavis:
[labs/tools/cdnjs-index@master] Handle packages missing a version key

https://gerrit.wikimedia.org/r/368600

bd808 triaged this task as Medium priority.

I fixed the index generation script so that it would deal with the busted https://tools-static.wmflabs.org/cdnjs/ajax/libs/isomorphic-fetch/ package. I also added a cron to the tool account to rebuild the index each day so that it reflects the latest packages that are being mirrored.