Skip to content
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

Support npm scoped package names #24

Open
subfuzion opened this issue Jun 1, 2015 · 22 comments
Open

Support npm scoped package names #24

subfuzion opened this issue Jun 1, 2015 · 22 comments

Comments

@subfuzion
Copy link

npm now provides support for scopes, which is a way of grouping related packages together.

Here is an example of a scoped package: @atomiq/promisify.

This is the same exact package also currently published without a scope: promisify-iojs

Expected behavior:

nodei.co should be able to create a badge for a scoped package:

https://www.npmjs.com/package/@atomiq/promisify =>

  <a href="https://nodei.co/npm/@atomiq/promisify/">
    <img src="https://nodei.co/npm/@atomiq/promisify.png">
  </a>

Actual behavior:

nodei.co successfully creates a badge for a standard package name, but provides the following error when attempting to create a badge for a scoped package:

Invalid package name: @atomiq/promisify
@timoxley
Copy link
Contributor

Looks like just need to update lib/valid-name.js with latest name validation logic from normalize-package-data: https://github.com/npm/normalize-package-data/blob/master/lib/fixer.js#L309-L333

@rvagg
Copy link
Owner

rvagg commented Jun 25, 2015

The / in the path name makes this really complicated to route, but I've managed to do it on my end but now I don't know what the npm endpoint is to fetch package data is:

Neither of these work. Does anyone care to dredge through the npm-www source to figure this one out?

@ljharb
Copy link

ljharb commented Jul 23, 2015

Found this when I made my first scoped package https://nodei.co/npm/@ljharb/eslint-config.png?downloads=true&stars=true :-(

I've asked the npm folks, and it appears that scoped packages are not on skimdb at this time. If they were, the link would have the @ not escaped and the slash escaped. ie https://registry.npmjs.org/@ljharb%2Feslint-config and thus https://skimdb.npmjs.com/registry/@ljharb%2Feslint-config

@rvagg
Copy link
Owner

rvagg commented Jul 25, 2015

I know this is a pain, and download ranks are borked too, but I'm flat-out pushing io.js 3 out so we can get the timing for Node 4 and that's taking top priority atm. I'll get to this though because I understand the pain!

@ljharb
Copy link

ljharb commented Jul 25, 2015

Totally fair :-)

@ljharb
Copy link

ljharb commented Aug 14, 2015

@rvagg now that iojs 3 is out, any chance of taking a look at nodei.co for scoped packages?

@ljharb
Copy link

ljharb commented Sep 21, 2015

This now appears to be somewhat fixed - npm doesn't actually give out download counts on scoped packages right now, afaik because they have to write the code to distinguish private from public downloads.

@rvagg
Copy link
Owner

rvagg commented Sep 22, 2015

the only thing that https://nodei.co/npm/@ljharb/eslint-config.png?downloads=true&stars=true really does is verify that the package name isn't bogus (I fixed package name validation in a recent round of changes), in the same that https://nodei.co/npm/this-is-not-a-valid-package-but-the-package-name-is-fine.png?downloads=true&stars=true works, it doesn't manage to get anything from skimdb about the package so can't verify what it is but fails silently anyway .. so you get a badge with the name, but that's it.

@ljharb
Copy link

ljharb commented Aug 23, 2016

@rvagg it looks like replicate.npmjs.com now supports public scoped packages - could you use that to have your badge support scoped packages?

@rvagg
Copy link
Owner

rvagg commented Aug 24, 2016

I can't find any docs on what even that is and I can't connect to it anyway so 🤷

@ljharb
Copy link

ljharb commented Aug 24, 2016

oops, I'll ping here when I find them :-p

mikermcneil added a commit to sailshq/lodash that referenced this issue Jan 13, 2017
(tldr: nodei.co doesn't support scoped package names yet)
@silvelo
Copy link

silvelo commented Jan 5, 2018

Whe you install npm package, in package.json appear:

{"raw": "@telegram-actions/transmission",
"name": "@telegram-actions/transmission",
"escapedName": "@telegram-actions%2ftransmission",
}

https://skimdb.npmjs.com/registry/@telegram-actions%2ftransmission

https://registry.npmjs.org/@telegram-actions%2ftransmission

@motss
Copy link

motss commented Jan 14, 2018

Is this solved yet?

@joggienl
Copy link

Is there an update on this issue? Curious to know if this will be supported!

@katagatame
Copy link

Seems to still be an issue.

@mathiscode
Copy link

mathiscode commented Jun 25, 2019

+1 - is this being worked on?

To be clear: I can get the image, but it doesn't include download stats, etc.

@rvagg
Copy link
Owner

rvagg commented Jun 26, 2019

Yeah, I'll probably get to this soon, I've been back at the code, fixing it up and making it work again after much breakage due to neglect. I think that this should be much more easily solvable with npm's new APIs.

@alexindigo
Copy link

@rvagg Just curious what's new API? :)

@rvagg
Copy link
Owner

rvagg commented Jun 26, 2019

"new" in a relative sense, relative to the age of this project, not actually that new: https://github.com/npm/registry/tree/master/docs

They've also been busy taking some things away so certain things have become difficult or impossible, like I have no way to get the number of packages depend on a package, "dependedUpon", so that's had to be dropped from the badges sadly. I'm in the process of considering whether to bite the bullet and just mirror the entire registry sans tarballs so I can do some of these things myself. But that's purely a leisure activity so I'm in no hurry.

@alexindigo
Copy link

Thanks. It is new to me :)
When I built https://github.com/alexindigo/ndash download counts for scoped modules weren't available. And yes, with all the recent changes over there, I fear app will be broken soon,
so if you're actually thinking of mirroring the meta data, I'd like to collaborate with you on that and maybe get some cross pollination between the badges and the app, looks like they both target the same crowd :)

@rvagg
Copy link
Owner

rvagg commented Jun 26, 2019

ah, cool, it does look like we have significant overlap

One of my original ideas for nodei.co was to provide an the API that npm didn't have, simple queries to get simple data that was otherwise difficult to piece together from npm. Since that time they've both improved and regressed. There's probably not a place for an API replacement, but there's certainly a place for a mirror-minus-tarballs that could be used to build such a thing.

It'll probably be a case of a simple follow and reconstruct a local database representing what npm has. It could even be as simple as just mirroring the .json files like registry-static does and leaving out the tarballs. But I kind of want to push it a bit further than that and make something more easily queryable.

My current track has me pondering how to do this on top of IPLD which I'm working on these days. While interesting for me and helpful to extend IPLD, it probably wouldn't lead to an optimal solution in the short term! I'll keep you informed as (/if) I make progress, this one's been niggling at me for a while.

@alexindigo
Copy link

Awesome idea. Last time I poked around npm (like 3-4 years ago) I remember they used elastic for packages stats/meta data, don't remember details though. But if it could be achieved with just a mirror – it's great.

As for IPLD :) totally understand your passion in that space, been poking around DAT myself recently :)
Curious to see how your progress with that going. :) And good luck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants