Skip to content

Upgrade to ipfs@0.41 #381

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

Merged
merged 38 commits into from
Apr 2, 2020
Merged

Upgrade to ipfs@0.41 #381

merged 38 commits into from
Apr 2, 2020

Conversation

zebateira
Copy link
Contributor

Closes #347

This was referenced Feb 17, 2020
@zebateira
Copy link
Contributor Author

zebateira commented Feb 17, 2020

@terichadbourne so I've created two PRs for us to see the differences between the two options that I see moving forward:

  1. ipfs@0.41 update: option 1 #384 Use for await...of loop

Screen Shot 2020-02-17 at 7 04 37 PM

  • Still working out how to solve the linting warnings on the monaco editor
  • Although it looks a bit convoluted, it might be a better choice if we don't want to introduce a module when teaching
  1. ipfs@0.41 update: option 2 #385 Use it-all package

Screen Shot 2020-02-17 at 7 06 01 PM

  • A bit more clean but it might be confusing for users to understand where to use the all function

This was referenced Feb 17, 2020
@zebateira
Copy link
Contributor Author

IMHO, I prefer the second option since it reduces the complexity of the code a lot. We need to consider that the last lessons of the tutorials would get much more complex with a lot of for loops if we don't use something like it-all.
We just need to explain to the user why we need to use it and include it in the initial code solution as much as possible.

@zebateira zebateira force-pushed the fix/ipfs-0.41-upgrade branch 3 times, most recently from f5b70c8 to bf86a3e Compare February 24, 2020 15:00
@zebateira zebateira force-pushed the fix/ipfs-0.41-upgrade branch from bf86a3e to b5ffffd Compare February 25, 2020 10:19
@zebateira
Copy link
Contributor Author

zebateira commented Feb 25, 2020

Update

Regarding all the points mentioned in #385 (comment) I think I've addressed them all except for:

  • More detailed explanation about Async Iterables
  • Add small observation to users that have completed the tutorial in the past and are now coming back to it: the cached code will not work anymore (@terichadbourne I think we could do this in a separate PR? just so split things up)

@zebateira zebateira self-assigned this Feb 25, 2020
@zebateira zebateira changed the title wip: upgrade to ipfs@0.41 Upgrade to ipfs@0.41 Feb 27, 2020
@zebateira zebateira marked this pull request as ready for review February 27, 2020 14:21
@zebateira
Copy link
Contributor Author

@terichadbourne ready for review, will address the "warning" message in another PR

@terichadbourne
Copy link
Member

@alanshaw Thanks for offering to give this one a proof!

Note that we'll also be adding a few callouts that appear only to folks who already visited the previous version of the affected tutorials, so what you're seeing is the text for new visitors.

@alanshaw
Copy link
Member

alanshaw commented Feb 27, 2020

Just a quick drive by comment...I'm hesitant to use it-all in examples or tutorials because of https://tc39.es/proposal-iterator-helpers/#sec-asynciteratorprototype-toarray - which will eventually allow you to await ipfs.add(files).toArray() to do the same thing without the use of an external module (more info here https://github.com/tc39/proposal-iterator-helpers).

Also because, where possible, I'd like to avoid buffering content into memory because:

[...] we should provide APIs that a) encourage developers to do the right thing and not buffer content into memory regardless of the size of the file they’re retrieving and b) reduce time to first byte, giving users visibility over progress and allowing them to differentiate between the file being unavailable or it being very large.

https://blog.ipfs.io/2020-02-01-async-await-refactor/#1-streaming-by-default

@terichadbourne
Copy link
Member

Any sense of how long "eventually" will be @alanshaw? I'd argue that if "using a thing that lets you nicely turn stuff into an array" is the preferred/easier method we want to teach, then rather than rip out the it-all and making the lessons harder by requiring all the JavaScript looping it might make more sense to add a note about the hopefully-upcoming-built-in-thing and let people know it will (hopefully) produce the same results as it-all does and we'll come back and update the content when that becomes available.

Probably worth us both working through the content in full to see how it flows before we decide.

@alanshaw
Copy link
Member

Any sense of how long "eventually" will be @alanshaw?

Not at all. It is currently at stage 2.

I'd argue that if "using a thing that lets you nicely turn stuff into an array" is the preferred/easier method we want to teach, then rather than rip out the it-all and making the lessons harder by requiring all the JavaScript looping it might make more sense to add a note about the hopefully-upcoming-built-in-thing and let people know it will (hopefully) produce the same results as it-all does and we'll come back and update the content when that becomes available.

That's fair, and I have no desire to make lessons harder, but if we're going to be turning stuff into an array and then looping over it we should consider just using a for loop instead (for example). I'll take a look tomorrow but I expect @zebateira has made sensible choices already.

@alanshaw
Copy link
Member

...there's also the small problem of require not being available in the browser and all the explanation you'd need to do around that 😅

@terichadbourne
Copy link
Member

Little UI bug: There used to be a white box around the log output, which still exists on the live site but not in this PR (and IIRC not in the Anatomy of a CID PR):
live site:
image
this branch:
image

@terichadbourne
Copy link
Member

@zebateira You had mentioned something about CID formatting in a chat recently. Just confirming the the format logged below is genuinely what's returned by IPFS, not you making it prettier or wrapping it in CID()?
image

@zebateira
Copy link
Contributor Author

@alanshaw

...there's also the small problem of require not being available in the browser and all the explanation you'd need to do around that 😅

Gosh I missed that. I guess we can make it global just like ipfs. @terichadbourne thoughts? Given this I think we should remove the require functionality and add the all to the globals as well.

@zebateira
Copy link
Contributor Author

You had mentioned something about CID formatting in a chat recently. Just confirming the the format logged below is genuinely what's returned by IPFS, not you making it prettier or wrapping it in CID()?

@terichadbourne What I mentioned is that I am formatting it to show CID() otherwise the output would be:

image

@zebateira
Copy link
Contributor Author

@terichadbourne

Little UI bug: There used to be a white box around the log output, which still exists on the live site but not in this PR (and IIRC not in the Anatomy of a CID PR):

Fixed!

Zé Bateira and others added 2 commits March 25, 2020 15:11
Co-Authored-By: Teri Chadbourne <terichadbourne@users.noreply.github.com>
@zebateira
Copy link
Contributor Author

@terichadbourne I think I went over all your suggestions now! Let me know if there's anything else missing.

Zé Bateira and others added 2 commits April 2, 2020 16:14
Co-Authored-By: Teri Chadbourne <terichadbourne@users.noreply.github.com>
zebateira and others added 2 commits April 2, 2020 16:30
Co-Authored-By: Teri Chadbourne <terichadbourne@users.noreply.github.com>
Zé Bateira and others added 2 commits April 2, 2020 16:43
Co-Authored-By: Teri Chadbourne <terichadbourne@users.noreply.github.com>
@terichadbourne terichadbourne merged commit ff17470 into code Apr 2, 2020
@terichadbourne terichadbourne deleted the fix/ipfs-0.41-upgrade branch April 2, 2020 16:05
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.

Update all tutorials to reflect async/await refactors to IPFS API
4 participants