Create a Practice Tutorial
Create a CodeRoad tutorial
Follow these instructions carefully to create your first CodeRoad tutorial.
Create a repo
- Go to GitHub and create a new repository for yourself named
first-tutorial - After you click create, it takes you to the repo. Copy the URL for the repo, it should look like:
https://github.com/your-username/first-tutorial.git - Open a terminal locally and find a place to clone your repo. Enter
git clone https://github.com/your-username/first-tutorial.gitwith the repo URL you copied in place of that URL to clone it - Create a
.gitignorefile in your repo and add this to it:
Add anything else that may interfere such as .DS_Store if you are on a mac.
Create the markdown
- Create a new file in your repo named
TUTORIAL.md.
This is the file that describes the structure of a tutorial. It contains all the lessons, lesson titles, descriptions, test text and all the other verbiage that will be displayed to a user. Enter this markdown into the file and save it:
The above tutorial has an introduction page and one lesson.
Commit to GitHub
- Back in the terminal, add all your new files to be committed with
git add . - Commit them with
git commit -m "create markdown" - Push them to GitHub with
git push origin master
Create a version branch
- Create and checkout a new orphan branch with
git checkout --orphan v0.1.0.
This will make a branch that isn't created from master, so it has no commit history. It will hold the tests for your tutorial. Each test is its own commit. You can also add an optional commit for a solution to each test.
- Check your
git status - Delete the tutorial file from this branch with
git rm -f TUTORIAL.md
Create your project files
This branch is also where users create their projects, modify files for a tutorial, and anything else that they need to do.
- Make a new folder named
coderoadon your branch.
This folder will hold as much of the CodeRoad stuff as it can so users aren't confused with extra files in their projects.
- Go to the
coderoadfolder in your terminal and runnpm init. Press enter until you are through the setup. - Open the
package.jsonfile you just made and make it look like this...
These scripts will be for CodeRoad and for you to test things.
- From the terminal, in your
coderoadfolder, runnpm install --save mocha mocha-tap-reporterto install some depenedencies - Go back to the main repo folder and add your changes with
git add . - Commit your files with
git commit -m "INIT"
The message of INIT in all caps is necessary. This message is used to add project setup files and anthing else you want to add before a user starts the tutorial.
- Push and Create a branch on your remote with
git push -u origin v0.1.0
Create the first test
- Go in the
coderoadfolder and create new folder namedtestin it - Create a file named
first-tutorial.test.jsin thetestfolder - Add this to the file: