Skip to content

Commit c7ed3f6

Browse files
committed
Add template files for the create function
1 parent aabe925 commit c7ed3f6

File tree

2 files changed

+166
-0
lines changed

2 files changed

+166
-0
lines changed

src/templates/TUTORIAL.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
## Insert Tutorial's Title here
2+
3+
> Short description to be shown as a tutorial's subtitle
4+
5+
6+
## L1 Put Level's title here
7+
8+
> Level's summary: a short description of the level's content in one line.
9+
10+
The level is identified and distributed following the regex:
11+
12+
```js
13+
/^(##\s(?<levelId>L\d+)\s(?<levelTitle>.*)\n*(>\s*(?<levelSummary>.*))?\n+(?<levelContent>[^]*))/
14+
```
15+
16+
The Level can be split into steps or have no steps. Levels without steps are meant to be used as only informative content, for example: use a Level without steps at the end of the tutorial to congratulate the student and provide some additional related resources.
17+
18+
Tutorial's content. It can span through multiple paragraphs and use headers `####` and `#####`.
19+
20+
Steps are identified and their content described using the following regex:
21+
22+
```js
23+
/^(###\s(?<stepId>(?<levelId>L\d+)S\d+)\s(?<stepTitle>.*)\n+(?<stepContent>[^]*))/
24+
```
25+
26+
The numbers identifying the levels and steps are irrelevant but keep in mind that they will be executed in order. A level with id `10` will be executed before another one with id `20` and so on. These `ids` should have a match in the configuration file (`coderoad.yaml`).
27+
28+
29+
### L1S1 A step title (not being shown on the extension at this moment)
30+
31+
Short description of the step's purpose. Should be short and fit in one line
32+
33+
**Important**
34+
1. Both level and step ids must have an entry with the same id on the configuration file;
35+
2. Step Ids are based on its level id. Any step from level `L234` must start with `L234S`, followed by the sequential digits.
36+
37+
38+
### L1S2 Another step
39+
40+
Step's short description.

src/templates/coderoad.yaml

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# A configuration file for a CodeRoad Tutorial
2+
# This is a YAML-formatted file.
3+
## Your personal version of the tutorial
4+
##
5+
version: '0.1.0'
6+
## Data used to populate the tutorial summary page
7+
##
8+
summary:
9+
## The title of your tutorial. Required.
10+
##
11+
title: ''
12+
## A description of your tutorial. Required.
13+
##
14+
description: ''
15+
## Data used to configure and setup the tutorial
16+
##
17+
config:
18+
## Test runner setup.
19+
testRunner:
20+
## The command called to run the test runner. For example "npm run test", or a path to the test runner binary. Required.
21+
command: ./node_modules/.bin/mocha
22+
## Standard arguments used by a given test runner
23+
args:
24+
## The command arg used to filter tests. Used by "subtasks"
25+
filter: --grep
26+
## The command arg used to convert test runner output to TAP format. See https://testanything.org/ for more. Required.
27+
tap: --reporter=mocha-tap-reporter
28+
## The directory where to run the test runner from. If not specified, tests will run from the root of the project. Optional.
29+
directory: coderoad
30+
## Commits to load to setup the test runner. Optional.
31+
##
32+
setup:
33+
## A list of commits to load to setup the tutorial
34+
commits: []
35+
# - commit1
36+
# - commit2
37+
## A list of commands to run to configure the tutorial
38+
commands: []
39+
# - npm install
40+
## App versions helps to ensure compatability with the Extension
41+
appVersions: {}
42+
## Ensure compatability with a minimal VSCode CodeRoad version
43+
# vscode: '>=0.7.0'
44+
## Repo information to load code from
45+
##
46+
repo:
47+
## The uri path to the repo containing the code commits. Required.
48+
##
49+
uri: ''
50+
## The branch on the repo uri that contains the code commits. Required.
51+
branch: ''
52+
53+
## A list of tutorial dependencies to ensure the environment is setup for the tutorial. Optional.
54+
## The dependencies will be checked by running `dependency.name` --version and comparing it to the version provided.
55+
##
56+
dependencies: []
57+
## The name of the dependency
58+
# - name: node
59+
# ## The version requirement. See https://github.com/npm/node-semver for options.
60+
# version: '>=10'
61+
62+
## A level is made up of
63+
levels:
64+
- id: L1
65+
steps:
66+
## Example 1: Opening files
67+
- id: L1S1
68+
## Setup for the first task. Required.
69+
setup:
70+
## Files to open in a text editor when the task loads. Optional.
71+
files: []
72+
# - package.json
73+
## Commits to load when the task loads. These should include failing tests. Required.
74+
## The list will be filled by the parser
75+
commits: []
76+
# - a commit hash
77+
## Solution for the first task. Required.
78+
solution:
79+
## Files to open when the solution loads. Optional.
80+
files: []
81+
# - package.json
82+
## Commits that complete the task. All tests should pass when the commits load. These commits will not be loaded by the tutorial user in normal tutorial activity.
83+
## The list will be filled by the parser
84+
commits: []
85+
## Example Two: Running commands
86+
- id: L1S2
87+
setup:
88+
commits: []
89+
## CLI commands that are run when the task loads. Optional.
90+
commands:
91+
- npm install
92+
solution:
93+
commits:
94+
- commit6
95+
commands:
96+
- npm install
97+
## Example Three: Watchers
98+
- id: L1S3
99+
setup:
100+
files:
101+
- package.json
102+
commits:
103+
- commit7
104+
## Listeners that run tests when a file or directory changes.
105+
watchers:
106+
- package.json
107+
- node_modules/some-package
108+
solution:
109+
files:
110+
- package.json
111+
commits:
112+
- commit8
113+
## Example Four: Subtasks
114+
- id: L1S4
115+
setup:
116+
commits:
117+
- commit8
118+
commands:
119+
## A filter is a regex that limits the test results
120+
- filter: '^Example 2'
121+
## A feature that shows subtasks: all filtered active test names and the status of the tests (pass/fail).
122+
- subtasks: true
123+
solution:
124+
commits:
125+
- commit9
126+

0 commit comments

Comments
 (0)