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

feat!: replace ipld-dag-pb with @ipld/dag-pb #330

Merged
merged 21 commits into from
Oct 5, 2022

Conversation

SgtPooki
Copy link
Member

@SgtPooki SgtPooki commented Jul 9, 2022

FYI: Much of this was me scrambling in the dark without knowing 1/4th of what I'm doing. IDK what:

1. the correct interface is supposed to be (the docs and source-code of dependencies are out of date or otherwise incorrect)
2. what exactly ipld/pb/cbor is supposed to do, especially in this repo
3. Any and everything else you may assume I know

With that said, comments & feedback that are typically given noobs and to the otherwise clueless are more than welcome and honestly expected.

fixes #329

I could use some eyes from the experts in this space. @achingbrain @lidel @mikeal

@SgtPooki SgtPooki linked an issue Jul 9, 2022 that may be closed by this pull request

const { CID, hasher, bytes } = multiformats

export const sha256 = hasher.from({
Copy link
Member Author

Choose a reason for hiding this comment

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

sha256 is not exported from multiformats correctly even though it says I can import it from multiformats/hashes/sha2

image

Copy link
Member

@rvagg rvagg Jul 12, 2022

Choose a reason for hiding this comment

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

import { sha256 } from 'multiformats/hashes/sha2'

if the docs are wrong, a PR would be appreciated, but the export is there and we actively use it in many places

Copy link
Member Author

Choose a reason for hiding this comment

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

That import doesn't even work :(

Copy link
Member

Choose a reason for hiding this comment

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

what runtime or bundler is this using? perhaps something needs to be updated here to support proper export maps?

Copy link
Member

Choose a reason for hiding this comment

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

react@16.14 is probably the culprit here, I don't think they'd nailed down their export maps functionality quite right back then but I don't know why this import specifically would fail tbh

but I bet upgrading react here would be a major pain too! so go with whatever works I suppose.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm assuming this has something to do with migrating js-ipfs stuff to esm, but the GUI packages all still being cjs

Copy link
Member Author

@SgtPooki SgtPooki left a comment

Choose a reason for hiding this comment

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

self-review completed.. trivial errors and unnecessary comments should be gone

@SgtPooki SgtPooki requested review from lidel and hacdias July 9, 2022 02:07
@SgtPooki SgtPooki self-assigned this Jul 11, 2022
src/lib/cid.js Show resolved Hide resolved
@rvagg
Copy link
Member

rvagg commented Jul 12, 2022

I don't understand the TextEncoder & TextDecoder problem here, why is it borking on those such that they need to be imported from 'util'? They've been standard globals for quite a while now: https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder/TextDecoder#browser_compatibility

Do we need to update runtimes used in CI here or something?

@hacdias
Copy link
Member

hacdias commented Jul 15, 2022

@SgtPooki maybe I missed it, but is there any reason to not use ipld/js-blockcodec-to-ipld-format to convert the new format to the old format (and therefore be supported here) like it was done in #319?

@rvagg
Copy link
Member

rvagg commented Jul 19, 2022

@RangerMauve ping on the export maps / react / tooling discussion - here's a pain-point I think, see discussion inline about sha256.

@RangerMauve
Copy link

Gonna look into this early next week as part of the ESM migration stuff.

@SgtPooki
Copy link
Member Author

@SgtPooki maybe I missed it, but is there any reason to not use ipld/js-blockcodec-to-ipld-format to convert the new format to the old format (and therefore be supported here) like it was done in #319?

I would say the main reason is that it leaves our code in a state of perpetual deprecation. I'll try it just to keep the code-changes down, but we still need a better story for moving forward.

Also, Instead of us maintaining something like https://github.com/ipld/js-blockcodec-to-ipld-format (last update 16 months ago), creating a tool that migrates old code to the new code would be much better.

@SgtPooki
Copy link
Member Author

I don't understand the TextEncoder & TextDecoder problem here, why is it borking on those such that they need to be imported from 'util'? They've been standard globals for quite a while now: https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder/TextDecoder#browser_compatibility

Do we need to update runtimes used in CI here or something?

it's a jsdom thing. I believe I have a workaround. See jsdom/jsdom#2524

@BigLep BigLep requested a review from rvagg September 12, 2022 21:04
@BigLep
Copy link

BigLep commented Sep 12, 2022

@rvagg : can you give feedback on whether @SgtPooki is doing things right/correct now?

src/lib/cid.js Outdated Show resolved Hide resolved
@SgtPooki SgtPooki requested a review from a team as a code owner September 15, 2022 20:40
@SgtPooki SgtPooki changed the title chore: replace ipld-dag-pb with @ipld/dag-pb [WIP] chore: replace ipld-dag-pb with @ipld/dag-pb Sep 23, 2022
@SgtPooki
Copy link
Member Author

ping for review from @lidel and @rvagg

@SgtPooki SgtPooki changed the title [WIP] chore: replace ipld-dag-pb with @ipld/dag-pb chore: replace ipld-dag-pb with @ipld/dag-pb Sep 29, 2022
Copy link
Member

@hacdias hacdias left a comment

Choose a reason for hiding this comment

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

Codewise, it looks good to me. However, I would like to actually try running this, perhaps using https://github.com/ipld/explore.ipld.io to make sure it works properly. Sadly, I did not manage to make it work with either npm link, or npx link. Besides the storybooks, how did you try this out?

SgtPooki added a commit to SgtPooki/explore.ipld.io that referenced this pull request Oct 4, 2022
@SgtPooki
Copy link
Member Author

SgtPooki commented Oct 4, 2022

Codewise, it looks good to me. However, I would like to actually try running this, perhaps using https://github.com/ipld/explore.ipld.io to make sure it works properly. Sadly, I did not manage to make it work with either npm link, or npx link. Besides the storybooks, how did you try this out?

I just used storybook. I just attempted https://github.com/ipld/explore.ipld.io too, but that will require updating ipld-dag-pb in that repo as well. Getting it to work in that repo just to prove that it works here (which it does, fine, in storybook) seems excessive. If we have to do that for every change needed to resolve ipfs/ipfs-webui#1965 then that issue will be the death of webui.

Copy link
Member

@hacdias hacdias left a comment

Choose a reason for hiding this comment

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

You're right, let's do it!

@SgtPooki SgtPooki changed the title chore: replace ipld-dag-pb with @ipld/dag-pb !feat: replace ipld-dag-pb with @ipld/dag-pb Oct 4, 2022
@SgtPooki SgtPooki changed the title !feat: replace ipld-dag-pb with @ipld/dag-pb feat!: replace ipld-dag-pb with @ipld/dag-pb Oct 4, 2022
@SgtPooki
Copy link
Member Author

SgtPooki commented Oct 4, 2022

@hacdias marked PR title with feat! instead of chore: to indicate that this is a breaking change. thanks for the callout

@hacdias
Copy link
Member

hacdias commented Oct 5, 2022

Great. I'm fine to merge this.

@SgtPooki SgtPooki merged commit 8cd0b23 into master Oct 5, 2022
@SgtPooki SgtPooki deleted the 329-replace-ipld-dag-pb-with-iplddag-pb branch October 5, 2022 17:42
github-actions bot pushed a commit that referenced this pull request Oct 5, 2022
## [3.0.0](v2.6.1...v3.0.0) (2022-10-05)

### ⚠ BREAKING CHANGES

* replace `ipld-dag-pb` with `@ipld/dag-pb` (#330)

### Features

* replace `ipld-dag-pb` with `@ipld/dag-pb` ([#330](#330)) ([8cd0b23](8cd0b23))
@github-actions
Copy link
Contributor

github-actions bot commented Oct 5, 2022

🎉 This PR is included in version 3.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Replace ipld-dag-pb with @ipld/dag-pb
5 participants