diff --git a/scripts/__tests__/protowizard/__snapshots__/lessons.spec.js.snap b/scripts/__tests__/protowizard/__snapshots__/lessons.spec.js.snap index e610b665e..3732f05c9 100644 --- a/scripts/__tests__/protowizard/__snapshots__/lessons.spec.js.snap +++ b/scripts/__tests__/protowizard/__snapshots__/lessons.spec.js.snap @@ -4,9 +4,9 @@ exports[`protowizard 2. create lesson 2.1. should create lesson after creating a exports[`protowizard 2. create lesson 2.1. should create lesson after creating a new tutorial (skips resource creation) 2`] = `"Let's create the files you need to build your tutorial. I'll ask you a few questions to get started."`; -exports[`protowizard 2. create lesson 2.1. should create lesson after creating a new tutorial (skips resource creation) 3`] = `"Thanks! I've created a directory for your tutorial at \`src/tutorials/0010-new-tut-10/\`."`; +exports[`protowizard 2. create lesson 2.1. should create lesson after creating a new tutorial (skips resource creation) 3`] = `"Thanks! I've created a directory for your tutorial at \`src/tutorials/0011-new-tut-11/\`."`; -exports[`protowizard 2. create lesson 2.1. should create lesson after creating a new tutorial (skips resource creation) 4`] = `"To preview your tutorial, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-10/"`; +exports[`protowizard 2. create lesson 2.1. should create lesson after creating a new tutorial (skips resource creation) 4`] = `"To preview your tutorial, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-11/"`; exports[`protowizard 2. create lesson 2.1. should create lesson after creating a new tutorial (skips resource creation) 5`] = `"Let's create your first lesson!"`; @@ -15,14 +15,14 @@ exports[`protowizard 2. create lesson 2.1. should create lesson after creating a ‣ 01.md (for writing the text of your lesson)" `; -exports[`protowizard 2. create lesson 2.1. should create lesson after creating a new tutorial (skips resource creation) 7`] = `"To preview this lesson, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-10/01"`; +exports[`protowizard 2. create lesson 2.1. should create lesson after creating a new tutorial (skips resource creation) 7`] = `"To preview this lesson, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-11/01"`; exports[`protowizard 2. create lesson 2.1. should create lesson after creating a new tutorial (skips resource creation) 8`] = ` -"Okay, sounds like we're done. Here are all the lessons now included in \\"New Tutorial (10)\\": +"Okay, sounds like we're done. Here are all the lessons now included in \\"New Tutorial (11)\\": ‣ 1 - Lesson 1 (text)" `; -exports[`protowizard 2. create lesson 2.1. should create lesson after creating a new tutorial (skips resource creation) 9`] = `"You can find all the files you'll need for these lessons in the \`src/tutorials/0010-new-tut-10/\` directory."`; +exports[`protowizard 2. create lesson 2.1. should create lesson after creating a new tutorial (skips resource creation) 9`] = `"You can find all the files you'll need for these lessons in the \`src/tutorials/0011-new-tut-11/\` directory."`; exports[`protowizard 2. create lesson 2.1. should create lesson after creating a new tutorial (skips resource creation) 10`] = `"All tutorials have a resources page where users can find opportunities for further learning."`; @@ -41,14 +41,14 @@ exports[`protowizard 2. create lesson 2.2. should create a lesson and add it to ‣ 01.md (for writing the text of your lesson)" `; -exports[`protowizard 2. create lesson 2.2. should create a lesson and add it to the latest tutorial (skips resource creation) 5`] = `"To preview this lesson, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-10/01"`; +exports[`protowizard 2. create lesson 2.2. should create a lesson and add it to the latest tutorial (skips resource creation) 5`] = `"To preview this lesson, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-11/01"`; exports[`protowizard 2. create lesson 2.2. should create a lesson and add it to the latest tutorial (skips resource creation) 6`] = ` -"Okay, sounds like we're done. Here are all the lessons now included in \\"New Tutorial (10)\\": +"Okay, sounds like we're done. Here are all the lessons now included in \\"New Tutorial (11)\\": ‣ 1 - Lesson (text)" `; -exports[`protowizard 2. create lesson 2.2. should create a lesson and add it to the latest tutorial (skips resource creation) 7`] = `"You can find all the files you'll need for these lessons in the \`src/tutorials/0010-new-tut-10/\` directory."`; +exports[`protowizard 2. create lesson 2.2. should create a lesson and add it to the latest tutorial (skips resource creation) 7`] = `"You can find all the files you'll need for these lessons in the \`src/tutorials/0011-new-tut-11/\` directory."`; exports[`protowizard 2. create lesson 2.2. should create a lesson and add it to the latest tutorial (skips resource creation) 8`] = `"All tutorials have a resources page where users can find opportunities for further learning."`; @@ -75,10 +75,10 @@ exports[`protowizard 2. create lesson 2.3. should list the lessons created so fa ‣ 05.md (for writing the text of your lesson)" `; -exports[`protowizard 2. create lesson 2.3. should list the lessons created so far 6`] = `"To preview this lesson, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-10/05"`; +exports[`protowizard 2. create lesson 2.3. should list the lessons created so far 6`] = `"To preview this lesson, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-11/05"`; exports[`protowizard 2. create lesson 2.3. should list the lessons created so far 7`] = ` -"Okay, sounds like we're done. Here are all the lessons now included in \\"New Tutorial (10)\\": +"Okay, sounds like we're done. Here are all the lessons now included in \\"New Tutorial (11)\\": ‣ 1 - Lesson 1 (text) ‣ 2 - Lesson 2 (text) ‣ 3 - Lesson 3 (text) @@ -86,13 +86,13 @@ exports[`protowizard 2. create lesson 2.3. should list the lessons created so fa ‣ 5 - Lesson (text)" `; -exports[`protowizard 2. create lesson 2.3. should list the lessons created so far 8`] = `"You can find all the files you'll need for these lessons in the \`src/tutorials/0010-new-tut-10/\` directory."`; +exports[`protowizard 2. create lesson 2.3. should list the lessons created so far 8`] = `"You can find all the files you'll need for these lessons in the \`src/tutorials/0011-new-tut-11/\` directory."`; -exports[`protowizard 2. create lesson 2.3. should list the lessons created so far 9`] = `"Awesome work! \\"New Tutorial (10)\\" has both lesson files and resources!"`; +exports[`protowizard 2. create lesson 2.3. should list the lessons created so far 9`] = `"Awesome work! \\"New Tutorial (11)\\" has both lesson files and resources!"`; -exports[`protowizard 2. create lesson 2.3. should list the lessons created so far 10`] = `"To preview your tutorial, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-10/"`; +exports[`protowizard 2. create lesson 2.3. should list the lessons created so far 10`] = `"To preview your tutorial, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-11/"`; -exports[`protowizard 2. create lesson 2.3. should list the lessons created so far 11`] = `"To create the content of your lessons, edit the files in the \`src/tutorials/0010-new-tut-10/\` directory. (Learn more at https://bit.ly/protoschool-content.)"`; +exports[`protowizard 2. create lesson 2.3. should list the lessons created so far 11`] = `"To create the content of your lessons, edit the files in the \`src/tutorials/0011-new-tut-11/\` directory. (Learn more at https://bit.ly/protoschool-content.)"`; exports[`protowizard 2. create lesson 2.3. should list the lessons created so far 12`] = `"To update your tutorial's title, description, or resources, edit its entry in the \`src/static/tutorials.json\` file. (Learn more at https://bit.ly/protoschool-metadata.)"`; diff --git a/scripts/__tests__/protowizard/__snapshots__/quizzes.spec.js.snap b/scripts/__tests__/protowizard/__snapshots__/quizzes.spec.js.snap index 44b513063..1cab5f341 100644 --- a/scripts/__tests__/protowizard/__snapshots__/quizzes.spec.js.snap +++ b/scripts/__tests__/protowizard/__snapshots__/quizzes.spec.js.snap @@ -4,13 +4,13 @@ exports[`protowizard 4. create quiz 4.1 should add quiz to pristine lesson 1`] = exports[`protowizard 4. create quiz 4.1 should add quiz to pristine lesson 2`] = ` "Great! You've chosen to build a quiz for: - ‣ Tutorial: New Tutorial (10) + ‣ Tutorial: New Tutorial (11) ‣ Lesson: Lesson 1" `; exports[`protowizard 4. create quiz 4.1 should add quiz to pristine lesson 3`] = `"When we create a quiz together, it will overwrite any existing content. If you think you may have previously updated this quiz manually, you may want to double check before proceeding."`; -exports[`protowizard 4. create quiz 4.1 should add quiz to pristine lesson 4`] = `"To preview the quiz in its current state, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-10/01"`; +exports[`protowizard 4. create quiz 4.1 should add quiz to pristine lesson 4`] = `"To preview the quiz in its current state, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-11/01"`; exports[`protowizard 4. create quiz 4.1 should add quiz to pristine lesson 5`] = `"Now it's time to write the question for your multiple-choice quiz and provide answer choices, with positive or negative feedback for each. Wrong answers, and the feedback associated with them, are a great way to address common misconceptions about the topic. Be sure to make your feedback as helpful as possible, to guide the learner to the right choice. You'll need to create 1 correct answer and 2-3 incorrect answers. (I'll take care of randomizing their order later.)"`; @@ -32,9 +32,9 @@ exports[`protowizard 4. create quiz 4.1 should add quiz to pristine lesson 13`] exports[`protowizard 4. create quiz 4.1 should add quiz to pristine lesson 14`] = `"You currently have 1 correct answer and 2 wrong answers. (I recommend providing 2-3 incorrect options.)"`; -exports[`protowizard 4. create quiz 4.1 should add quiz to pristine lesson 15`] = `"To preview your quiz, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-10/01"`; +exports[`protowizard 4. create quiz 4.1 should add quiz to pristine lesson 15`] = `"To preview your quiz, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-11/01"`; -exports[`protowizard 4. create quiz 4.1 should add quiz to pristine lesson 16`] = `"To make changes to your quiz, you can edit this file directly: src/tutorials/0010-new-tut-10/01.js"`; +exports[`protowizard 4. create quiz 4.1 should add quiz to pristine lesson 16`] = `"To make changes to your quiz, you can edit this file directly: src/tutorials/0011-new-tut-11/01.js"`; exports[`protowizard 4. create quiz 4.1 should add quiz to pristine lesson 17`] = `"Okay, no problem. You can summon me later to add more quizzes."`; @@ -46,13 +46,13 @@ exports[`protowizard 4. create quiz 4.2 should add quiz to existing lesson 2`] = exports[`protowizard 4. create quiz 4.2 should add quiz to existing lesson 3`] = ` "Great! You've chosen to build a quiz for: - ‣ Tutorial: New Tutorial (10) + ‣ Tutorial: New Tutorial (11) ‣ Lesson: Lesson 1" `; exports[`protowizard 4. create quiz 4.2 should add quiz to existing lesson 4`] = `"When we create a quiz together, it will overwrite any existing content. If you think you may have previously updated this quiz manually, you may want to double check before proceeding."`; -exports[`protowizard 4. create quiz 4.2 should add quiz to existing lesson 5`] = `"To preview the quiz in its current state, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-10/01"`; +exports[`protowizard 4. create quiz 4.2 should add quiz to existing lesson 5`] = `"To preview the quiz in its current state, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-11/01"`; exports[`protowizard 4. create quiz 4.2 should add quiz to existing lesson 6`] = `"Now it's time to write the question for your multiple-choice quiz and provide answer choices, with positive or negative feedback for each. Wrong answers, and the feedback associated with them, are a great way to address common misconceptions about the topic. Be sure to make your feedback as helpful as possible, to guide the learner to the right choice. You'll need to create 1 correct answer and 2-3 incorrect answers. (I'll take care of randomizing their order later.)"`; @@ -68,21 +68,21 @@ exports[`protowizard 4. create quiz 4.2 should add quiz to existing lesson 11`] exports[`protowizard 4. create quiz 4.2 should add quiz to existing lesson 12`] = `"You currently have 1 correct answer and 1 wrong answer. (I recommend providing 2-3 incorrect options.)"`; -exports[`protowizard 4. create quiz 4.2 should add quiz to existing lesson 13`] = `"To preview your quiz, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-10/01"`; +exports[`protowizard 4. create quiz 4.2 should add quiz to existing lesson 13`] = `"To preview your quiz, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-11/01"`; -exports[`protowizard 4. create quiz 4.2 should add quiz to existing lesson 14`] = `"To make changes to your quiz, you can edit this file directly: src/tutorials/0010-new-tut-10/01.js"`; +exports[`protowizard 4. create quiz 4.2 should add quiz to existing lesson 14`] = `"To make changes to your quiz, you can edit this file directly: src/tutorials/0011-new-tut-11/01.js"`; exports[`protowizard 4. create quiz 4.2 should add quiz to existing lesson 15`] = `"Let's create a multiple-choice quiz! This will only work if you've already created the tutorial and lesson files."`; exports[`protowizard 4. create quiz 4.2 should add quiz to existing lesson 16`] = ` "Great! You've chosen to build a quiz for: - ‣ Tutorial: New Tutorial (10) + ‣ Tutorial: New Tutorial (11) ‣ Lesson: Lesson 1" `; exports[`protowizard 4. create quiz 4.2 should add quiz to existing lesson 17`] = `"It looks like you've already created the quiz for this lesson."`; -exports[`protowizard 4. create quiz 4.2 should add quiz to existing lesson 18`] = `"To preview the existing version, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-10/01"`; +exports[`protowizard 4. create quiz 4.2 should add quiz to existing lesson 18`] = `"To preview the existing version, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-11/01"`; exports[`protowizard 4. create quiz 4.2 should add quiz to existing lesson 19`] = `"Now it's time to write the question for your multiple-choice quiz and provide answer choices, with positive or negative feedback for each. Wrong answers, and the feedback associated with them, are a great way to address common misconceptions about the topic. Be sure to make your feedback as helpful as possible, to guide the learner to the right choice. You'll need to create 1 correct answer and 2-3 incorrect answers. (I'll take care of randomizing their order later.)"`; @@ -104,9 +104,9 @@ exports[`protowizard 4. create quiz 4.2 should add quiz to existing lesson 27`] exports[`protowizard 4. create quiz 4.2 should add quiz to existing lesson 28`] = `"You currently have 1 correct answer and 2 wrong answers. (I recommend providing 2-3 incorrect options.)"`; -exports[`protowizard 4. create quiz 4.2 should add quiz to existing lesson 29`] = `"To preview your quiz, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-10/01"`; +exports[`protowizard 4. create quiz 4.2 should add quiz to existing lesson 29`] = `"To preview your quiz, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-11/01"`; -exports[`protowizard 4. create quiz 4.2 should add quiz to existing lesson 30`] = `"To make changes to your quiz, you can edit this file directly: src/tutorials/0010-new-tut-10/01.js"`; +exports[`protowizard 4. create quiz 4.2 should add quiz to existing lesson 30`] = `"To make changes to your quiz, you can edit this file directly: src/tutorials/0011-new-tut-11/01.js"`; exports[`protowizard 4. create quiz 4.2 should add quiz to existing lesson 31`] = `"Okay, no problem. You can summon me later to add more quizzes."`; @@ -118,15 +118,15 @@ exports[`protowizard 4. create quiz 4.3 should cancel overwrite of non-pristine exports[`protowizard 4. create quiz 4.3 should cancel overwrite of non-pristine lesson 3`] = ` "Great! You've chosen to build a quiz for: - ‣ Tutorial: New Tutorial (10) + ‣ Tutorial: New Tutorial (11) ‣ Lesson: Lesson 1" `; exports[`protowizard 4. create quiz 4.3 should cancel overwrite of non-pristine lesson 4`] = `"It looks like you've already created the quiz for this lesson."`; -exports[`protowizard 4. create quiz 4.3 should cancel overwrite of non-pristine lesson 5`] = `"To preview the existing version, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-10/01"`; +exports[`protowizard 4. create quiz 4.3 should cancel overwrite of non-pristine lesson 5`] = `"To preview the existing version, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-11/01"`; -exports[`protowizard 4. create quiz 4.3 should cancel overwrite of non-pristine lesson 6`] = `"Okay, no problem. You can edit your existing quiz directly in this file: src/tutorials/0010-new-tut-10/01.js"`; +exports[`protowizard 4. create quiz 4.3 should cancel overwrite of non-pristine lesson 6`] = `"Okay, no problem. You can edit your existing quiz directly in this file: src/tutorials/0011-new-tut-11/01.js"`; exports[`protowizard 4. create quiz 4.3 should cancel overwrite of non-pristine lesson 7`] = ` " @@ -169,12 +169,12 @@ exports[`protowizard 4. create quiz 4.4 should cancel overwrite of pristine less exports[`protowizard 4. create quiz 4.4 should cancel overwrite of pristine lesson 3`] = ` "Great! You've chosen to build a quiz for: - ‣ Tutorial: New Tutorial (10) + ‣ Tutorial: New Tutorial (11) ‣ Lesson: Lesson 1" `; exports[`protowizard 4. create quiz 4.4 should cancel overwrite of pristine lesson 4`] = `"When we create a quiz together, it will overwrite any existing content. If you think you may have previously updated this quiz manually, you may want to double check before proceeding."`; -exports[`protowizard 4. create quiz 4.4 should cancel overwrite of pristine lesson 5`] = `"To preview the quiz in its current state, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-10/01"`; +exports[`protowizard 4. create quiz 4.4 should cancel overwrite of pristine lesson 5`] = `"To preview the quiz in its current state, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-11/01"`; -exports[`protowizard 4. create quiz 4.4 should cancel overwrite of pristine lesson 6`] = `"Okay, no problem. You can edit your existing quiz directly in this file: src/tutorials/0010-new-tut-10/01.js"`; +exports[`protowizard 4. create quiz 4.4 should cancel overwrite of pristine lesson 6`] = `"Okay, no problem. You can edit your existing quiz directly in this file: src/tutorials/0011-new-tut-11/01.js"`; diff --git a/scripts/__tests__/protowizard/__snapshots__/resources.spec.js.snap b/scripts/__tests__/protowizard/__snapshots__/resources.spec.js.snap index 23d204528..ef02133d3 100644 --- a/scripts/__tests__/protowizard/__snapshots__/resources.spec.js.snap +++ b/scripts/__tests__/protowizard/__snapshots__/resources.spec.js.snap @@ -4,24 +4,24 @@ exports[`protowizard 3. create resource 3.1. should create resource after creati exports[`protowizard 3. create resource 3.1. should create resource after creating a new tutorial (skips lesson creation) 2`] = `"Let's create the files you need to build your tutorial. I'll ask you a few questions to get started."`; -exports[`protowizard 3. create resource 3.1. should create resource after creating a new tutorial (skips lesson creation) 3`] = `"Thanks! I've created a directory for your tutorial at \`src/tutorials/0010-new-tut-10/\`."`; +exports[`protowizard 3. create resource 3.1. should create resource after creating a new tutorial (skips lesson creation) 3`] = `"Thanks! I've created a directory for your tutorial at \`src/tutorials/0011-new-tut-11/\`."`; -exports[`protowizard 3. create resource 3.1. should create resource after creating a new tutorial (skips lesson creation) 4`] = `"To preview your tutorial, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-10/"`; +exports[`protowizard 3. create resource 3.1. should create resource after creating a new tutorial (skips lesson creation) 4`] = `"To preview your tutorial, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-11/"`; exports[`protowizard 3. create resource 3.1. should create resource after creating a new tutorial (skips lesson creation) 5`] = `"Let's create your first resource!"`; exports[`protowizard 3. create resource 3.1. should create resource after creating a new tutorial (skips lesson creation) 6`] = `"I've added \\"Resource 1\\" to your resources list."`; exports[`protowizard 3. create resource 3.1. should create resource after creating a new tutorial (skips lesson creation) 7`] = ` -"Okay, sounds like we're done. Here are all the resources now included in \\"New Tutorial (10)\\": +"Okay, sounds like we're done. Here are all the resources now included in \\"New Tutorial (11)\\": ‣ Resource 1 (demo)" `; -exports[`protowizard 3. create resource 3.1. should create resource after creating a new tutorial (skips lesson creation) 8`] = `"To preview your resources page, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-10/resources"`; +exports[`protowizard 3. create resource 3.1. should create resource after creating a new tutorial (skips lesson creation) 8`] = `"To preview your resources page, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-11/resources"`; exports[`protowizard 3. create resource 3.1. should create resource after creating a new tutorial (skips lesson creation) 9`] = `"Need to change something? You can edit your resources in the file \`src/static/tutorials.json\`."`; -exports[`protowizard 3. create resource 3.1. should create resource after creating a new tutorial (skips lesson creation) 10`] = `"Looks like your \\"New Tutorial (10)\\" tutorial doesn't have any lessons yet."`; +exports[`protowizard 3. create resource 3.1. should create resource after creating a new tutorial (skips lesson creation) 10`] = `"Looks like your \\"New Tutorial (11)\\" tutorial doesn't have any lessons yet."`; exports[`protowizard 3. create resource 3.1. should create resource after creating a new tutorial (skips lesson creation) 11`] = `"Okay, no problem. You can summon me later to add lessons."`; @@ -36,15 +36,15 @@ exports[`protowizard 3. create resource 3.2. should create a resource and add it exports[`protowizard 3. create resource 3.2. should create a resource and add it to the latest tutorial (skips lesson creation) 4`] = `"I've added \\"Resource\\" to your resources list."`; exports[`protowizard 3. create resource 3.2. should create a resource and add it to the latest tutorial (skips lesson creation) 5`] = ` -"Okay, sounds like we're done. Here are all the resources now included in \\"New Tutorial (10)\\": +"Okay, sounds like we're done. Here are all the resources now included in \\"New Tutorial (11)\\": ‣ Resource (demo)" `; -exports[`protowizard 3. create resource 3.2. should create a resource and add it to the latest tutorial (skips lesson creation) 6`] = `"To preview your resources page, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-10/resources"`; +exports[`protowizard 3. create resource 3.2. should create a resource and add it to the latest tutorial (skips lesson creation) 6`] = `"To preview your resources page, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-11/resources"`; exports[`protowizard 3. create resource 3.2. should create a resource and add it to the latest tutorial (skips lesson creation) 7`] = `"Need to change something? You can edit your resources in the file \`src/static/tutorials.json\`."`; -exports[`protowizard 3. create resource 3.2. should create a resource and add it to the latest tutorial (skips lesson creation) 8`] = `"Looks like your \\"New Tutorial (10)\\" tutorial doesn't have any lessons yet."`; +exports[`protowizard 3. create resource 3.2. should create a resource and add it to the latest tutorial (skips lesson creation) 8`] = `"Looks like your \\"New Tutorial (11)\\" tutorial doesn't have any lessons yet."`; exports[`protowizard 3. create resource 3.2. should create a resource and add it to the latest tutorial (skips lesson creation) 9`] = `"Okay, no problem. You can summon me later to add lessons."`; diff --git a/scripts/__tests__/protowizard/__snapshots__/tutorials.spec.js.snap b/scripts/__tests__/protowizard/__snapshots__/tutorials.spec.js.snap index fe76b2579..1fa7afc44 100644 --- a/scripts/__tests__/protowizard/__snapshots__/tutorials.spec.js.snap +++ b/scripts/__tests__/protowizard/__snapshots__/tutorials.spec.js.snap @@ -2,9 +2,9 @@ exports[`protowizard 1. create tutorial 1.1. should create tutorial (skips lesson creation) 1`] = `"Let's create the files you need to build your tutorial. I'll ask you a few questions to get started."`; -exports[`protowizard 1. create tutorial 1.1. should create tutorial (skips lesson creation) 2`] = `"Thanks! I've created a directory for your tutorial at \`src/tutorials/0010-new-tut-10/\`."`; +exports[`protowizard 1. create tutorial 1.1. should create tutorial (skips lesson creation) 2`] = `"Thanks! I've created a directory for your tutorial at \`src/tutorials/0011-new-tut-11/\`."`; -exports[`protowizard 1. create tutorial 1.1. should create tutorial (skips lesson creation) 3`] = `"To preview your tutorial, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-10/"`; +exports[`protowizard 1. create tutorial 1.1. should create tutorial (skips lesson creation) 3`] = `"To preview your tutorial, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-11/"`; exports[`protowizard 1. create tutorial 1.1. should create tutorial (skips lesson creation) 4`] = `"Okay, no problem. You can summon me later to add lessons."`; @@ -14,23 +14,23 @@ exports[`protowizard 1. create tutorial 1.2. should create tutorial with one tex exports[`protowizard 1. create tutorial 1.2. should create tutorial with one text lesson 2`] = `"Let's create the files you need to build your tutorial. I'll ask you a few questions to get started."`; -exports[`protowizard 1. create tutorial 1.2. should create tutorial with one text lesson 3`] = `"Thanks! I've created a directory for your tutorial at \`src/tutorials/0010-new-tut-10/\`."`; +exports[`protowizard 1. create tutorial 1.2. should create tutorial with one text lesson 3`] = `"Thanks! I've created a directory for your tutorial at \`src/tutorials/0011-new-tut-11/\`."`; -exports[`protowizard 1. create tutorial 1.2. should create tutorial with one text lesson 4`] = `"To preview your tutorial, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-10/"`; +exports[`protowizard 1. create tutorial 1.2. should create tutorial with one text lesson 4`] = `"To preview your tutorial, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-11/"`; exports[`protowizard 1. create tutorial 1.2. should create tutorial with one text lesson 5`] = ` "Tada! I've created the following files that you'll need for this lesson: ‣ 01.md (for writing the text of your lesson)" `; -exports[`protowizard 1. create tutorial 1.2. should create tutorial with one text lesson 6`] = `"To preview this lesson, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-10/01"`; +exports[`protowizard 1. create tutorial 1.2. should create tutorial with one text lesson 6`] = `"To preview this lesson, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-11/01"`; exports[`protowizard 1. create tutorial 1.2. should create tutorial with one text lesson 7`] = ` -"Okay, sounds like we're done. Here are all the lessons now included in \\"New Tutorial (10)\\": +"Okay, sounds like we're done. Here are all the lessons now included in \\"New Tutorial (11)\\": ‣ 1 - Lesson 1 (text)" `; -exports[`protowizard 1. create tutorial 1.2. should create tutorial with one text lesson 8`] = `"You can find all the files you'll need for these lessons in the \`src/tutorials/0010-new-tut-10/\` directory."`; +exports[`protowizard 1. create tutorial 1.2. should create tutorial with one text lesson 8`] = `"You can find all the files you'll need for these lessons in the \`src/tutorials/0011-new-tut-11/\` directory."`; exports[`protowizard 1. create tutorial 1.2. should create tutorial with one text lesson 9`] = `"All tutorials have a resources page where users can find opportunities for further learning."`; @@ -42,31 +42,31 @@ exports[`protowizard 1. create tutorial 1.3. should create tutorial with two tex exports[`protowizard 1. create tutorial 1.3. should create tutorial with two text lessons 2`] = `"Let's create the files you need to build your tutorial. I'll ask you a few questions to get started."`; -exports[`protowizard 1. create tutorial 1.3. should create tutorial with two text lessons 3`] = `"Thanks! I've created a directory for your tutorial at \`src/tutorials/0010-new-tut-10/\`."`; +exports[`protowizard 1. create tutorial 1.3. should create tutorial with two text lessons 3`] = `"Thanks! I've created a directory for your tutorial at \`src/tutorials/0011-new-tut-11/\`."`; -exports[`protowizard 1. create tutorial 1.3. should create tutorial with two text lessons 4`] = `"To preview your tutorial, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-10/"`; +exports[`protowizard 1. create tutorial 1.3. should create tutorial with two text lessons 4`] = `"To preview your tutorial, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-11/"`; exports[`protowizard 1. create tutorial 1.3. should create tutorial with two text lessons 5`] = ` "Tada! I've created the following files that you'll need for this lesson: ‣ 01.md (for writing the text of your lesson)" `; -exports[`protowizard 1. create tutorial 1.3. should create tutorial with two text lessons 6`] = `"To preview this lesson, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-10/01"`; +exports[`protowizard 1. create tutorial 1.3. should create tutorial with two text lessons 6`] = `"To preview this lesson, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-11/01"`; exports[`protowizard 1. create tutorial 1.3. should create tutorial with two text lessons 7`] = ` "Tada! I've created the following files that you'll need for this lesson: ‣ 02.md (for writing the text of your lesson)" `; -exports[`protowizard 1. create tutorial 1.3. should create tutorial with two text lessons 8`] = `"To preview this lesson, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-10/02"`; +exports[`protowizard 1. create tutorial 1.3. should create tutorial with two text lessons 8`] = `"To preview this lesson, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-11/02"`; exports[`protowizard 1. create tutorial 1.3. should create tutorial with two text lessons 9`] = ` -"Okay, sounds like we're done. Here are all the lessons now included in \\"New Tutorial (10)\\": +"Okay, sounds like we're done. Here are all the lessons now included in \\"New Tutorial (11)\\": ‣ 1 - Lesson 1 (text) ‣ 2 - Lesson 2 (text)" `; -exports[`protowizard 1. create tutorial 1.3. should create tutorial with two text lessons 10`] = `"You can find all the files you'll need for these lessons in the \`src/tutorials/0010-new-tut-10/\` directory."`; +exports[`protowizard 1. create tutorial 1.3. should create tutorial with two text lessons 10`] = `"You can find all the files you'll need for these lessons in the \`src/tutorials/0011-new-tut-11/\` directory."`; exports[`protowizard 1. create tutorial 1.3. should create tutorial with two text lessons 11`] = `"All tutorials have a resources page where users can find opportunities for further learning."`; @@ -78,42 +78,42 @@ exports[`protowizard 1. create tutorial 1.4. should create tutorial with one les exports[`protowizard 1. create tutorial 1.4. should create tutorial with one lesson and one resource 2`] = `"Let's create the files you need to build your tutorial. I'll ask you a few questions to get started."`; -exports[`protowizard 1. create tutorial 1.4. should create tutorial with one lesson and one resource 3`] = `"Thanks! I've created a directory for your tutorial at \`src/tutorials/0010-new-tut-10/\`."`; +exports[`protowizard 1. create tutorial 1.4. should create tutorial with one lesson and one resource 3`] = `"Thanks! I've created a directory for your tutorial at \`src/tutorials/0011-new-tut-11/\`."`; -exports[`protowizard 1. create tutorial 1.4. should create tutorial with one lesson and one resource 4`] = `"To preview your tutorial, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-10/"`; +exports[`protowizard 1. create tutorial 1.4. should create tutorial with one lesson and one resource 4`] = `"To preview your tutorial, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-11/"`; exports[`protowizard 1. create tutorial 1.4. should create tutorial with one lesson and one resource 5`] = ` "Tada! I've created the following files that you'll need for this lesson: ‣ 01.md (for writing the text of your lesson)" `; -exports[`protowizard 1. create tutorial 1.4. should create tutorial with one lesson and one resource 6`] = `"To preview this lesson, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-10/01"`; +exports[`protowizard 1. create tutorial 1.4. should create tutorial with one lesson and one resource 6`] = `"To preview this lesson, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-11/01"`; exports[`protowizard 1. create tutorial 1.4. should create tutorial with one lesson and one resource 7`] = ` -"Okay, sounds like we're done. Here are all the lessons now included in \\"New Tutorial (10)\\": +"Okay, sounds like we're done. Here are all the lessons now included in \\"New Tutorial (11)\\": ‣ 1 - Lesson 1 (text)" `; -exports[`protowizard 1. create tutorial 1.4. should create tutorial with one lesson and one resource 8`] = `"You can find all the files you'll need for these lessons in the \`src/tutorials/0010-new-tut-10/\` directory."`; +exports[`protowizard 1. create tutorial 1.4. should create tutorial with one lesson and one resource 8`] = `"You can find all the files you'll need for these lessons in the \`src/tutorials/0011-new-tut-11/\` directory."`; exports[`protowizard 1. create tutorial 1.4. should create tutorial with one lesson and one resource 9`] = `"All tutorials have a resources page where users can find opportunities for further learning."`; exports[`protowizard 1. create tutorial 1.4. should create tutorial with one lesson and one resource 10`] = `"I've added \\"Resource 1\\" to your resources list."`; exports[`protowizard 1. create tutorial 1.4. should create tutorial with one lesson and one resource 11`] = ` -"Okay, sounds like we're done. Here are all the resources now included in \\"New Tutorial (10)\\": +"Okay, sounds like we're done. Here are all the resources now included in \\"New Tutorial (11)\\": ‣ Resource 1 (demo)" `; -exports[`protowizard 1. create tutorial 1.4. should create tutorial with one lesson and one resource 12`] = `"To preview your resources page, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-10/resources"`; +exports[`protowizard 1. create tutorial 1.4. should create tutorial with one lesson and one resource 12`] = `"To preview your resources page, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-11/resources"`; exports[`protowizard 1. create tutorial 1.4. should create tutorial with one lesson and one resource 13`] = `"Need to change something? You can edit your resources in the file \`src/static/tutorials.json\`."`; -exports[`protowizard 1. create tutorial 1.4. should create tutorial with one lesson and one resource 14`] = `"Awesome work! \\"New Tutorial (10)\\" has both lesson files and resources!"`; +exports[`protowizard 1. create tutorial 1.4. should create tutorial with one lesson and one resource 14`] = `"Awesome work! \\"New Tutorial (11)\\" has both lesson files and resources!"`; -exports[`protowizard 1. create tutorial 1.4. should create tutorial with one lesson and one resource 15`] = `"To preview your tutorial, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-10/"`; +exports[`protowizard 1. create tutorial 1.4. should create tutorial with one lesson and one resource 15`] = `"To preview your tutorial, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-11/"`; -exports[`protowizard 1. create tutorial 1.4. should create tutorial with one lesson and one resource 16`] = `"To create the content of your lessons, edit the files in the \`src/tutorials/0010-new-tut-10/\` directory. (Learn more at https://bit.ly/protoschool-content.)"`; +exports[`protowizard 1. create tutorial 1.4. should create tutorial with one lesson and one resource 16`] = `"To create the content of your lessons, edit the files in the \`src/tutorials/0011-new-tut-11/\` directory. (Learn more at https://bit.ly/protoschool-content.)"`; exports[`protowizard 1. create tutorial 1.4. should create tutorial with one lesson and one resource 17`] = `"To update your tutorial's title, description, or resources, edit its entry in the \`src/static/tutorials.json\` file. (Learn more at https://bit.ly/protoschool-metadata.)"`; @@ -123,23 +123,23 @@ exports[`protowizard 1. create tutorial 1.5. should create tutorial with one les exports[`protowizard 1. create tutorial 1.5. should create tutorial with one lesson and two resources 2`] = `"Let's create the files you need to build your tutorial. I'll ask you a few questions to get started."`; -exports[`protowizard 1. create tutorial 1.5. should create tutorial with one lesson and two resources 3`] = `"Thanks! I've created a directory for your tutorial at \`src/tutorials/0010-new-tut-10/\`."`; +exports[`protowizard 1. create tutorial 1.5. should create tutorial with one lesson and two resources 3`] = `"Thanks! I've created a directory for your tutorial at \`src/tutorials/0011-new-tut-11/\`."`; -exports[`protowizard 1. create tutorial 1.5. should create tutorial with one lesson and two resources 4`] = `"To preview your tutorial, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-10/"`; +exports[`protowizard 1. create tutorial 1.5. should create tutorial with one lesson and two resources 4`] = `"To preview your tutorial, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-11/"`; exports[`protowizard 1. create tutorial 1.5. should create tutorial with one lesson and two resources 5`] = ` "Tada! I've created the following files that you'll need for this lesson: ‣ 01.md (for writing the text of your lesson)" `; -exports[`protowizard 1. create tutorial 1.5. should create tutorial with one lesson and two resources 6`] = `"To preview this lesson, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-10/01"`; +exports[`protowizard 1. create tutorial 1.5. should create tutorial with one lesson and two resources 6`] = `"To preview this lesson, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-11/01"`; exports[`protowizard 1. create tutorial 1.5. should create tutorial with one lesson and two resources 7`] = ` -"Okay, sounds like we're done. Here are all the lessons now included in \\"New Tutorial (10)\\": +"Okay, sounds like we're done. Here are all the lessons now included in \\"New Tutorial (11)\\": ‣ 1 - Lesson 1 (text)" `; -exports[`protowizard 1. create tutorial 1.5. should create tutorial with one lesson and two resources 8`] = `"You can find all the files you'll need for these lessons in the \`src/tutorials/0010-new-tut-10/\` directory."`; +exports[`protowizard 1. create tutorial 1.5. should create tutorial with one lesson and two resources 8`] = `"You can find all the files you'll need for these lessons in the \`src/tutorials/0011-new-tut-11/\` directory."`; exports[`protowizard 1. create tutorial 1.5. should create tutorial with one lesson and two resources 9`] = `"All tutorials have a resources page where users can find opportunities for further learning."`; @@ -148,20 +148,20 @@ exports[`protowizard 1. create tutorial 1.5. should create tutorial with one les exports[`protowizard 1. create tutorial 1.5. should create tutorial with one lesson and two resources 11`] = `"I've added \\"Resource 2\\" to your resources list."`; exports[`protowizard 1. create tutorial 1.5. should create tutorial with one lesson and two resources 12`] = ` -"Okay, sounds like we're done. Here are all the resources now included in \\"New Tutorial (10)\\": +"Okay, sounds like we're done. Here are all the resources now included in \\"New Tutorial (11)\\": ‣ Resource 1 (demo) ‣ Resource 2 (demo)" `; -exports[`protowizard 1. create tutorial 1.5. should create tutorial with one lesson and two resources 13`] = `"To preview your resources page, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-10/resources"`; +exports[`protowizard 1. create tutorial 1.5. should create tutorial with one lesson and two resources 13`] = `"To preview your resources page, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-11/resources"`; exports[`protowizard 1. create tutorial 1.5. should create tutorial with one lesson and two resources 14`] = `"Need to change something? You can edit your resources in the file \`src/static/tutorials.json\`."`; -exports[`protowizard 1. create tutorial 1.5. should create tutorial with one lesson and two resources 15`] = `"Awesome work! \\"New Tutorial (10)\\" has both lesson files and resources!"`; +exports[`protowizard 1. create tutorial 1.5. should create tutorial with one lesson and two resources 15`] = `"Awesome work! \\"New Tutorial (11)\\" has both lesson files and resources!"`; -exports[`protowizard 1. create tutorial 1.5. should create tutorial with one lesson and two resources 16`] = `"To preview your tutorial, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-10/"`; +exports[`protowizard 1. create tutorial 1.5. should create tutorial with one lesson and two resources 16`] = `"To preview your tutorial, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-11/"`; -exports[`protowizard 1. create tutorial 1.5. should create tutorial with one lesson and two resources 17`] = `"To create the content of your lessons, edit the files in the \`src/tutorials/0010-new-tut-10/\` directory. (Learn more at https://bit.ly/protoschool-content.)"`; +exports[`protowizard 1. create tutorial 1.5. should create tutorial with one lesson and two resources 17`] = `"To create the content of your lessons, edit the files in the \`src/tutorials/0011-new-tut-11/\` directory. (Learn more at https://bit.ly/protoschool-content.)"`; exports[`protowizard 1. create tutorial 1.5. should create tutorial with one lesson and two resources 18`] = `"To update your tutorial's title, description, or resources, edit its entry in the \`src/static/tutorials.json\` file. (Learn more at https://bit.ly/protoschool-metadata.)"`; @@ -171,9 +171,9 @@ exports[`protowizard 1. create tutorial 1.6. should not allow to create two tuto exports[`protowizard 1. create tutorial 1.6. should not allow to create two tutorials with the same title or url 2`] = `"Let's create the files you need to build your tutorial. I'll ask you a few questions to get started."`; -exports[`protowizard 1. create tutorial 1.6. should not allow to create two tutorials with the same title or url 3`] = `"Thanks! I've created a directory for your tutorial at \`src/tutorials/0010-new-tut-10/\`."`; +exports[`protowizard 1. create tutorial 1.6. should not allow to create two tutorials with the same title or url 3`] = `"Thanks! I've created a directory for your tutorial at \`src/tutorials/0011-new-tut-11/\`."`; -exports[`protowizard 1. create tutorial 1.6. should not allow to create two tutorials with the same title or url 4`] = `"To preview your tutorial, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-10/"`; +exports[`protowizard 1. create tutorial 1.6. should not allow to create two tutorials with the same title or url 4`] = `"To preview your tutorial, first run \`npm start\` in a separate terminal window or tab, then visit this page in your web browser: http://localhost:3000/new-tut-11/"`; exports[`protowizard 1. create tutorial 1.6. should not allow to create two tutorials with the same title or url 5`] = `"Okay, no problem. You can summon me later to add lessons."`; diff --git a/src/static/courses.json b/src/static/courses.json index 4f4136637..599055a1b 100644 --- a/src/static/courses.json +++ b/src/static/courses.json @@ -8,7 +8,8 @@ "0005", "0002", "0003", - "0006" + "0006", + "0010" ], "featured": [ "0001", @@ -43,4 +44,4 @@ "0002", "0003" ] -} +} \ No newline at end of file diff --git a/src/static/tutorials.json b/src/static/tutorials.json index 9430525f0..71087d46b 100644 --- a/src/static/tutorials.json +++ b/src/static/tutorials.json @@ -479,5 +479,18 @@ "description": "Many of the applications that incorporate libp2p for _process addressing_ also use _content addressing_ to identify the data shared among peers on a decentralized network. Learn more about content addressing in our most popular ProtoSchool tutorial." } ] + }, + "0010": { + "id": 10, + "formattedId": "0010", + "url": "hands-on-with-libp2p", + "project": "libp2p", + "title": "Hands-on with libp2p", + "description": "Learn how to use libp2p one step at a time.", + "newMessage": "", + "updateMessage": "", + "createdAt": "2021-02-22T18:51:09.030Z", + "updatedAt": "2021-02-22T18:51:09.030Z", + "resources": [] } -} +} \ No newline at end of file diff --git a/src/tutorials/0010-hands-on-with-libp2p/01.js b/src/tutorials/0010-hands-on-with-libp2p/01.js new file mode 100644 index 000000000..ced50398c --- /dev/null +++ b/src/tutorials/0010-hands-on-with-libp2p/01.js @@ -0,0 +1,32 @@ +/* eslint quotes: ["error", "double"] */ + +// #PRISTINE# This file was auto-generated. Please remove this line when updating the file manually. + +// Question must be a string +const question = "What is the name for a single participant in a p2p network?" + +// Choices must be an array of objects, each with the properties: +// `answer` (string), `correct` (boolean), and `feedback` (string) +// Only one answer can be correct. +const choices = [ + { + answer: "Peer", + correct: true, + feedback: "Great job! Peer-to-peer networks are made of, well, peers!" + }, + { + answer: "Protocol", + correct: false, + feedback: "A **protocol** tells us _how_ to talk to each other. But what do we call _who_ we're talking to?" + }, + { + answer: "Host", + correct: false, + feedback: "So close! The `Host` is one of the most important interfaces in go-libp2p though!" + } +] + +export default { + question, + choices +} diff --git a/src/tutorials/0010-hands-on-with-libp2p/01.md b/src/tutorials/0010-hands-on-with-libp2p/01.md new file mode 100644 index 000000000..4f5323fd0 --- /dev/null +++ b/src/tutorials/0010-hands-on-with-libp2p/01.md @@ -0,0 +1,41 @@ +--- + title: "What is a Peer?" + type: "multiple-choice" # can be "text", "code", "file-upload" or "multiple-choice" +--- + +In the [Introduction to libp2p Tutorial][intro-libp2p-tutorial], we learned that libp2p helps us build _peer-to-peer_ applications that don't depend on centralized servers. + +In this tutorial, we'll cover some of the core functionality of peer-to-peer applications by exploring the `Libp2p` node object, +the main "command center" for [js-libp2p][js-libp2p]. Since js-libp2p runs in web browsers, we can even explore a node interactively! + +Before we get into the details, let's talk about some of the terms we'll be using. The words "peer," "node," and "host" are used throughout libp2p's documentation (and peer-to-peer networking in general) to refer to very similar concepts. + +Generally speaking, a "peer" is a single participant in a peer-to-peer system. +Each peer is represented by a piece of software running on a user's device, and peers can talk directly to one another without having to go through a central server first. + +While "peer" and "node" are almost synonymous, in this tutorial, we'll generally use _"peer"_ to refer to the abstract idea of a single member of the network. +For example, we might say "a peer sends its ID in a message to another peer." + +When talking about the actual software that defines a peer's behavior, we'll use the word _"node"_, for example, "we can use our node's `start` method to connect to the network." + +Finally, we won't use the word _"host"_ much in this tutorial, but you may see it in the documentation for [go-libp2p][go-libp2p], where the main "command center" interface is called the `Host`. + +## The libp2p Node + +Now that we know what we mean by "peer" and "node," let's look at what they can do. + +The [js-libp2p API reference][js-libp2p-api-docs] lists a whole lot of methods, but we're only going to focus on a few key features for this tutorial: + +- Every node has a unique "Peer ID" that distinguishes them from other peers in the network. +- Each node can open a secure communication channel to another node, if they know the other node's Peer ID and at least one valid network address. +- Nodes communicate with each other using application-defined _protocols_ that specify how they should talk to each other. + +Those may seem like simple features, but they are the building blocks for all of libp2p's more complex functionality. + +We'll get into more detail about each of these in the next few lessons! + + +[intro-libp2p-tutorial]: ../introduction-to-libp2p +[js-libp2p-api-docs]: https://github.com/libp2p/js-libp2p/blob/master/doc/API.md +[js-libp2p]: https://github.com/libp2p/js-libp2p +[go-libp2p]: https://github.com/libp2p/go-libp2p \ No newline at end of file diff --git a/src/tutorials/0010-hands-on-with-libp2p/02.js b/src/tutorials/0010-hands-on-with-libp2p/02.js new file mode 100644 index 000000000..2e7550445 --- /dev/null +++ b/src/tutorials/0010-hands-on-with-libp2p/02.js @@ -0,0 +1,32 @@ +/* eslint quotes: ["error", "double"] */ + +// #PRISTINE# This file was auto-generated. Please remove this line when updating the file manually. + +// Question must be a string +const question = "How does a brand new libp2p peer get a Peer ID?" + +// Choices must be an array of objects, each with the properties: +// `answer` (string), `correct` (boolean), and `feedback` (string) +// Only one answer can be correct. +const choices = [ + { + answer: "They request an ID from the identity service.", + correct: false, + feedback: "Identity services work great in centralized systems, but we can't rely on them in a fully peer-to-peer network." + }, + { + answer: "They make up a random number and start using it as a Peer ID.", + correct: false, + feedback: "Almost! A completely random ID could be hijacked by another peer, unless there's a way to prove who it belongs to." + }, + { + answer: "They generate a private key and share the CID of its corresponding public key.", + correct: true, + feedback: "Exactly! A peer can use the private key to prove that they (and only they!) are the owner of the public key that the Peer ID is based on." + } +] + +export default { + question, + choices +} diff --git a/src/tutorials/0010-hands-on-with-libp2p/02.md b/src/tutorials/0010-hands-on-with-libp2p/02.md new file mode 100644 index 000000000..778812ddd --- /dev/null +++ b/src/tutorials/0010-hands-on-with-libp2p/02.md @@ -0,0 +1,55 @@ +--- + title: "Peer IDs" + type: "multiple-choice" # can be "text", "code", "file-upload" or "multiple-choice" +--- + +One of the most fundamental questions when building a system with many participants is how to keep track of them all. + +The answer generally involves some sort of identifier or ID, a number that uniquely identifies a single "thing" in the system. +For example, Mark Zuckerberg has the Facebook user ID `4`, and each new Facebook user is issued the next ID in the sequence. + +In a centralized service like Facebook, one database can be in charge of tracking all user IDs, which is how the service knows what number to hand out next. +Just take the ID of the most recently added user, increase it by one, and you're all set. + +But what if we don't have a centralized "ID service"? Can we still uniquely identify the users in our system? + +One way would be to just have the users make up their own IDs, so they don't have to ask a service for one. +This actually works really well if you have a large enough "number space" for the range of possible IDs. +For example, if you encode your IDs using 256 bits, you can have about as many unique IDs as the estimated number of atoms in the observable universe. +This is great, because it makes it unlikely that two users will randomly choose the same ID. + +The problem of course is that any user can choose any ID, even one that's already been used by someone else. +This means that it would be easy for any user to impersonate someone else, just by using the same ID. +What we need is a way for users to independently "claim" an ID in a way that can easily be verified by others, without requiring a central service for coordination. + +It turns out that [public key cryptography][pk-explainer] gives us just what we need. Instead of a single random number, each participant generates a **private key**, which is just a special number that they keep secret and never reveal to anyone else on the network. The private key has an associated **public key**, which is safe to share with everyone. Since the public key can be easily shared, we can either use it as an ID directly, or we can derive an ID from the key using a hash function, so that the same key will always result in the same ID. + +Now when two peers connect to each other, they can exchange IDs and public keys. Each peer then uses their own private key to digitally "sign" some piece of data, which proves that they have the private key. Since only the creator of the ID should know the private key, we can trust that the ID belongs to the peer that created it. + +As you may have guessed, this is exactly what libp2p does. + +In libp2p, each peer has a unique **Peer ID** which has a relationship to the peer's public key that can't be forged. In the case of small keys used by elliptic curve algorithms like [ed25519][ed25519], the Peer ID contains the key itself. Larger keys like those required by the [RSA algorithm][rsa-explainer] are fed into a [hash function][hash-explainer], and the Peer ID contains the hash output. + +Here's what a libp2p Peer ID looks like: + +``` +bafzbeigweq4zr4x4ky2dvv7nanbkw6egutvrrvzw6g3h2rftp7gidyhtt4 +``` + +You might also see Peer IDs that look like this: + +``` +QmckZzdVd72h9QUFuJJpQqhsZqGLwjhh81qSvZ9BhB2FQi +``` + +If you've ever used [IPFS](https://ipfs.io), those strings of gibberish might look familiar! Peer IDs in libp2p are also [CID][docs-cid]s, or Content Identifiers, which are used in IPFS to locate content on the network, among other things. When used as a Peer ID, the content that a CID identifies is the public key of the libp2p peer. + +The two examples above look a little different because they're using different versions of the CID standard. The one that starts with `bafz` is a newer version 1 CID, while the ID beginning with `Qm` is an older, version 0 CID. If you want to learn all about CIDs, check out the [Anatomy of a CID tutorial][cid-tutorial] here on ProtoSchool! + + +[pk-explainer]: https://simple.wikipedia.org/wiki/Public-key_cryptography +[ed25519]: https://ed25519.cr.yp.to/ +[rsa-explainer]: https://en.wikipedia.org/wiki/RSA_(cryptosystem) +[hash-explainer]: https://simple.wikipedia.org/wiki/Cryptographic_hash_function +[docs-cid]: https://docs.ipfs.io/concepts/content-addressing +[cid-tutorial]: https://proto.school/anatomy-of-a-cid \ No newline at end of file diff --git a/src/tutorials/0010-hands-on-with-libp2p/03-challenge.md b/src/tutorials/0010-hands-on-with-libp2p/03-challenge.md new file mode 100644 index 000000000..a7e38ed1b --- /dev/null +++ b/src/tutorials/0010-hands-on-with-libp2p/03-challenge.md @@ -0,0 +1 @@ +Describe the challenge here. diff --git a/src/tutorials/0010-hands-on-with-libp2p/03.js b/src/tutorials/0010-hands-on-with-libp2p/03.js new file mode 100644 index 000000000..8e074c125 --- /dev/null +++ b/src/tutorials/0010-hands-on-with-libp2p/03.js @@ -0,0 +1,32 @@ +const validate = async (result, ipfs) => { + return { success: 'Validation coming soon!' } +} + +const code = `/* global ipfs, all, toBuffer */ + const run = async () => { + // Your code here +} +return run +` + +const solution = `/* global ipfs, all, toBuffer */ + const run = async () => { + // Your solution here +} +return run +` + +// for more on the available options: +// https://github.com/ProtoSchool/protoschool.github.io/blob/main/DEVELOPING_TUTORIALS.md#lesson-file +const options = { + overrideErrors: false, + createTestFile: false, + createTestTree: false +} + +export default { + validate, + code, + solution, + options +} diff --git a/src/tutorials/0010-hands-on-with-libp2p/03.md b/src/tutorials/0010-hands-on-with-libp2p/03.md new file mode 100644 index 000000000..129c3a3ea --- /dev/null +++ b/src/tutorials/0010-hands-on-with-libp2p/03.md @@ -0,0 +1,9 @@ +--- + title: "Get a Peer ID" + type: "code" # can be "text", "code", "file-upload" or "multiple-choice" +--- + +TODO: + +- [ ] show the API method for getting a peer id from a libp2p node +- [ ] coding challenge diff --git a/src/tutorials/0010-hands-on-with-libp2p/04-challenge.md b/src/tutorials/0010-hands-on-with-libp2p/04-challenge.md new file mode 100644 index 000000000..a7e38ed1b --- /dev/null +++ b/src/tutorials/0010-hands-on-with-libp2p/04-challenge.md @@ -0,0 +1 @@ +Describe the challenge here. diff --git a/src/tutorials/0010-hands-on-with-libp2p/04.js b/src/tutorials/0010-hands-on-with-libp2p/04.js new file mode 100644 index 000000000..8e074c125 --- /dev/null +++ b/src/tutorials/0010-hands-on-with-libp2p/04.js @@ -0,0 +1,32 @@ +const validate = async (result, ipfs) => { + return { success: 'Validation coming soon!' } +} + +const code = `/* global ipfs, all, toBuffer */ + const run = async () => { + // Your code here +} +return run +` + +const solution = `/* global ipfs, all, toBuffer */ + const run = async () => { + // Your solution here +} +return run +` + +// for more on the available options: +// https://github.com/ProtoSchool/protoschool.github.io/blob/main/DEVELOPING_TUTORIALS.md#lesson-file +const options = { + overrideErrors: false, + createTestFile: false, + createTestTree: false +} + +export default { + validate, + code, + solution, + options +} diff --git a/src/tutorials/0010-hands-on-with-libp2p/04.md b/src/tutorials/0010-hands-on-with-libp2p/04.md new file mode 100644 index 000000000..6ba33eb7a --- /dev/null +++ b/src/tutorials/0010-hands-on-with-libp2p/04.md @@ -0,0 +1,10 @@ +--- + title: "Dialing Another Peer" + type: "code" # can be "text", "code", "file-upload" or "multiple-choice" +--- + +TODO: + +- [ ] Explain how dialing / listening works at a high level +- [ ] Show an example using the `libp2p.dial` method +- [ ] Write coding challenge. \ No newline at end of file