Repository navigation
Open
Description
Add a icon url field to the package.json spec, which would be returned in the search results.
Edit: This link would be available in the search API results.
So, using the example result from a search below, a field would be returned in the package object:
{
"objects": [
{
"downloads": {
"monthly": 17877,
"weekly": 3863
},
"dependents": "177",
"updated": "2025-12-22T14:06:11.084Z",
"searchScore": 294.53653,
"package": {
"name": "homebridge-lib",
"keywords": [
"homekit",
"homebridge"
],
"version": "7.2.0",
"description": "Library for homebridge plugins",
"sanitized_name": "homebridge-lib",
"icon": "https://github.com/ebaauw/homebridge-lib/path/to/icon_file.png",
"publisher": {
"email": "[email protected]",
"username": "ebaauw"
},
"maintainers": [
{
"email": "[email protected]",
"username": "ebaauw"
}
],
"license": "Apache-2.0",
"date": "2025-12-08T13:57:14.187Z",
"links": {
"homepage": "https://github.com/ebaauw/homebridge-lib#readme",
"repository": "git+https://github.com/ebaauw/homebridge-lib.git",
"bugs": "https://github.com/ebaauw/homebridge-lib/issues",
"npm": "https://www.npmjs.com/package/homebridge-lib"
}
},
"score": {
"final": 294.53653,
"detail": {
"popularity": 1,
"quality": 1,
"maintenance": 1
}
},
"flags": {
"insecure": 0
}
}
],
"total": 1,
"time": "2025-12-25T20:42:48.227Z"
}
Metadata
Metadata
Assignees
Labels
No labels
Activity
justjam2013 commentedon Dec 29, 2025
Created from [FEATURE] Add an icon url field
ljharb commentedon Dec 30, 2025
If it's a URL that's hardcoded into the packument, then what happens if npm is unable to download the image? What happens when the URL eventually changes its contents, or when the URL goes offline?
If it's an included file, then that would inflate the size of every tarball published with an icon, but the unreliability and mutability of URLs doesn't apply.
justjam2013 commentedon Dec 30, 2025
I never said that npm downloads the image. Npm simply provides the link in the search results. The client receiving the results can choose to download the icon or not download it.
The new icon is available for download. The icon can be updated without having to publish a new release.
The icon is no longer available for download. Seems logical.
This icon field would not be required, but it would allow for sharing an icon primarily from a github repo without packaging it into the tarball, as you mentioned. Maybe it could be placed in the
linksobject:None of the links is required and if the links go dead, then no more
homepage,repository,icon, etc.adithya1770 commentedon Dec 30, 2025
Multiple fallback links could be used instead of a single URL. If none of them work, a temporary placeholder icon can be shown until it’s fixed. Since this is just a web link, it doesn’t need to be included in the package.
ljharb commentedon Dec 30, 2025
I think it's pretty illogical to add information to a packument that isn't immutably stored forever (and I'm including the target of the URL as well as the URL itself - I'm aware that there's lots of URLs npm doesn't cache but those already exist)
justjam2013 commentedon Dec 30, 2025
What happens when the author of a package decides to delete the github repo, or their entire github account?
What happens when someone closes an email account they no longer use?
Removing those entries above, in case those scenarios happen, just to be on the safe side, would be illogical. Circumstances change and you cannot control for all of them. Arguing against adding a useful feature because someone might abandon a package, along with what all that entails, means not adding any functionality at all where you cannot control the future.
At the point when this happens, the fact that the icon is missing is quite likely going to be a potential symptom of a much larger problem. And you deal with this if and when it happens. Maybe by someone else taking over the package maintenance, or migrating to a currently maintained package. I have seen a number of packages on npm with 100+ open bugs and that haven't been updated in 5+ years or longer. Worrying about a missing icon seems to be missing the forest for the trees.
ljharb commentedon Dec 30, 2025
Indeed, those are examples of pre existing non immutable things. I’m suggesting that no new ones should be added.