NPM stopped returning the maintainers key from the registry when viewing a versioned package. Is this intentional? Nobody knows. I have a support ticket open with NPM since last Thursday, and the thread on GitHub Communities hasn't seen a response. This change has prevented the Homebridge UI from showing a plugin's author, as well as showing users that there is a Homebridge UI update from within Homebridge.
:bulb: Proposed solution
Update how a plugin's author is determined: first, attempt to get it from the latest package from NPM (which is what is currently done). If it's not set there, get it from the top-level package metadata. Since getting it from the top-level package metadata can be expensive for packages with many versions, cache the author for 24 hours. This change will continue to work if NPM starts setting maintainers at the version level again, or if they never revert the change that stopped setting maintainers at the version level.
:recycle: Current situation
NPM stopped returning the
maintainers
key from the registry when viewing a versioned package. Is this intentional? Nobody knows. I have a support ticket open with NPM since last Thursday, and the thread on GitHub Communities hasn't seen a response. This change has prevented the Homebridge UI from showing a plugin's author, as well as showing users that there is a Homebridge UI update from within Homebridge.:bulb: Proposed solution
Update how a plugin's author is determined: first, attempt to get it from the latest package from NPM (which is what is currently done). If it's not set there, get it from the top-level package metadata. Since getting it from the top-level package metadata can be expensive for packages with many versions, cache the author for 24 hours. This change will continue to work if NPM starts setting
maintainers
at the version level again, or if they never revert the change that stopped settingmaintainers
at the version level.