ProtoSchool / protoschool.github.io

The code that runs the ProtoSchool website. Visit https://proto.school for interactive tutorials on decentralized web protocols. Explore IPFS and Filecoin through code challenges, code-free lessons, and local events.
https://proto.school
Other
166 stars 67 forks source link

Lesson Feedback: https://proto.school/mutable-file-system/08 (Mutable File System | Lesson 8 of 11) #657

Open mklilley opened 3 years ago

mklilley commented 3 years ago

URL of the lesson that's confusing: https://proto.school/mutable-file-system/08 - Mutable File System | Lesson 8 of 11

What's confusing about this lesson? I was curious why ipfs.files.mv didn't accept an array of files as an input when other functions, like ipfs.files.cp and ipfs.files.rm did and instead the tutorial suggested using js spread syntax. I went to the docs to find in the examples that it did accept an array after-all. I then looked back at the tutorial and found Remember that you can pass an array into files.mv as the from value in the box before the code section. Encouraged by this, I tried without the spread syntax, the code validation gave me an error.

Specifically, the following didn't work:

/* global ipfs, all */

const run = async (files) => {
  await Promise.all(files.map(f => ipfs.files.write('/' + f.name, f, { create: true })))
  await ipfs.files.mkdir('/some/stuff', { parents: true })
  const rootDirectoryContents = await all(ipfs.files.ls('/'))

  const filepathsToMove = rootDirectoryContents.filter(file => file.type === 0).map(file => '/' + file.name)
  await ipfs.files.mv(filepathsToMove, '/some/stuff')

  const someStuffDirectoryContents = await all(ipfs.files.ls('/some/stuff'))
  return someStuffDirectoryContents
}

return run

But below did:

/* global ipfs, all */

const run = async (files) => {
  await Promise.all(files.map(f => ipfs.files.write('/' + f.name, f, { create: true })))
  await ipfs.files.mkdir('/some/stuff', { parents: true })
  const rootDirectoryContents = await all(ipfs.files.ls('/'))

  const filepathsToMove = rootDirectoryContents.filter(file => file.type === 0).map(file => '/' + file.name)
  await ipfs.files.mv(...filepathsToMove, '/some/stuff')

  const someStuffDirectoryContents = await all(ipfs.files.ls('/some/stuff'))
  return someStuffDirectoryContents
}

return run

(Note the only difference is the spread syntax). Not sure if this is an error in code validation or something else.

What additional context could we provide to help you succeed? At the start of the lesson, tell learner that they can use array as input. This will make it consistent with the other lessons.

What other feedback would you like to share about ProtoSchool? Loving what you are doing here and I hope to be able to contribute once I become a bit more knowledgable

zebateira commented 3 years ago

Thank you for the reporting this @mklilley! Our team is looking into it.

terichadbourne commented 3 years ago

@mklilley We discovered that ProtoSchool hasn't quite caught up with the latest release of IPFS, which is likely why you're seeing disagreements between documentation. You can learn more about the new release in this announcement.

We're working on updating the lesson content and code verification to match the new docs and will let you know when this is fixed. Thanks again for flagging!