-
Notifications
You must be signed in to change notification settings - Fork 64
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
chore: update to new multiformats #200
Conversation
Replaces cids and multibase with the new multiformats module. BREAKING CHANGE: uses the CID class from the new multiformats module
@@ -10,7 +10,7 @@ | |||
"test": "npm run test:node && npm run test:browser", | |||
"test:node": "aegir test --ts -t node", | |||
"test:browser": "aegir test -t browser", | |||
"build": "aegir build", | |||
"prepare": "aegir build", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be reverted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without this you can't depend on a branch of this repo as otherwise it has no types after install. prepare
is run during release so it shouldn't break anything?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can keep it, but I would not remove the build script. Perhaps just add a new one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can do, but then it'll build twice during release since npm runs prepare
and aegir runs build
src/convert.js
Outdated
@@ -163,8 +163,22 @@ function bytes2str (buf) { | |||
* @param {string | Uint8Array | CID} hash | |||
*/ | |||
function mh2bytes (hash) { | |||
let cid | |||
|
|||
if (typeof hash === 'string') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have this same logic in PeerId
as well. Thinking if cid could offer a way of doing it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could probably add it to CID.asCID
, though I think that's supposed to convert between old and new CID instances, not try to parse whatever we throw at it. This is quite a common use case though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is quite a common use case though
Can we export an util static function for this in multiformats then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've created multiformats/js-multiformats#92
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Let me know when we have all the other PRs ready, as this will need to ship and also has its version updated everywhere given the breaking change CID
Replaces cids and multibase with the new multiformats module.
BREAKING CHANGE: uses the CID class from the new multiformats module