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

npm package #327

Open
darrylyeo opened this issue Jun 5, 2023 · 7 comments
Open

npm package #327

darrylyeo opened this issue Jun 5, 2023 · 7 comments

Comments

@darrylyeo
Copy link
Contributor

I noticed there was an effort floated to have a JSON file derived from or maintained in parallel with the CSV (#305 / #311). For ease of consumption within the JavaScript ecosystem it would be great to have the list of codecs made available as an npm package too.

@rvagg
Copy link
Member

rvagg commented Jun 5, 2023

It used to be published as multicodec: https://github.com/multiformats/js-multicodec

We could potentially revive that package and autopublish it, although it might be doing a bit too much as it is.

However, with the growth of the table, we've mostly been recommending people use separate packages just for the codecs (addrs, etc.) that they need, rather than consume the entire table since it can really bloat dependency trees and bundles. It's typically much better to just target what you need for an application, e.g. the sha3 variants can be pulled in with @multiformats/sha3: https://github.com/multiformats/js-sha3/blob/master/index.js#L14-L23 and they have their codes hardwired in their package.

@rvagg
Copy link
Member

rvagg commented Jun 5, 2023

With that said, do you have a usecase that would necessitate having the entire table available?

@darrylyeo
Copy link
Contributor Author

darrylyeo commented Jun 5, 2023

I'm writing a CID utility tool and would like to be able to pull in the official names and descriptions for all the possible codecs.

Also, sites like cid.ipfs.tech appear to be manually converting the CSV from GitHub into JSON at build time which doesn't seem ideal.

@rvagg
Copy link
Member

rvagg commented Jun 6, 2023

Unfortunately there's not a lot of people-time to lend to something like this since it's a secondary use of this data, but we could revive js-multicodec, strip it right down so it's just publishing the table in some usable form, and set up auto updating (like we do for go-multicodec) and auto publishing so it can be kept updated without too much effort.
I'll put this on a project board as a TODO at some point, by someone who has time. If you're interested in tackling it yourself then let me know and maybe I can unarchive js-multicodec and you can propose some changes to it along these lines and get something started.

@darrylyeo
Copy link
Contributor Author

Sure, happy to give it a go!

@rvagg
Copy link
Member

rvagg commented Jun 9, 2023

OK, I've unarchived it; it's going to need a heavy overhaul - replacement or just severe simplification of the code, an action like the go-multicodec one to do checks and PR if there's updates here, and we'll also probably want to try and get it in to https://github.com/protocol/.github/blob/master/configs/js.json to get the full unified-ci suite that we use on other repos. That will probably mean inheriting the "aegir" based build and publish process; which you can look around at various ipfs, ipld and libp2p projects to see the latest form of. https://github.com/ipld/js-dag-json might be a simple one to look at that is published in this way. The ipfsl/helia* projects have newer typescript forms of this that you could also look at. I'm personally indifferent as long as this new thing is super simple, the table in a form that can be usable with an import, maybe a bit of sugar, but not much.

@darrylyeo
Copy link
Contributor Author

Let me know what you think!
multiformats/js-multicodec#83

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

3 participants
@rvagg @darrylyeo and others