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

chore: update to new multiformats #200

Merged
merged 4 commits into from
Jul 6, 2021

Conversation

achingbrain
Copy link
Member

Replaces cids and multibase with the new multiformats module.

BREAKING CHANGE: uses the CID class from the new multiformats module

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",
Copy link
Member

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

Copy link
Member Author

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?

Copy link
Member

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?

Copy link
Member Author

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') {
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@vasco-santos vasco-santos left a 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

@achingbrain achingbrain marked this pull request as ready for review July 6, 2021 10:55
@vasco-santos vasco-santos merged commit 7e3aff9 into master Jul 6, 2021
@vasco-santos vasco-santos deleted the chore/update-to-new-multiformats branch July 6, 2021 11:17
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

Successfully merging this pull request may close these issues.

2 participants