-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtutorial.ts
235 lines (231 loc) · 7.47 KB
/
tutorial.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
import meta from "./meta";
export default {
title: "Tutorial Schema",
description:
"A CodeRoad tutorial schema data. This JSON data is converted into a tutorial with the CodeRoad editor extension",
...meta,
type: "object",
properties: {
version: {
$ref: "#/definitions/semantic_version",
description: "The tutorial version. Must be unique for the tutorial.",
examples: ["0.1.0", "1.0.0"],
},
// summary
summary: {
type: "object",
properties: {
title: {
$ref: "#/definitions/title",
description: "The title of tutorial",
},
description: {
type: "string",
description: "A summary of the the tutorial",
minLength: 10,
maxLength: 400,
},
},
additionalProperties: false,
required: ["title", "description"],
},
// config
config: {
type: "object",
properties: {
testRunner: {
type: "object",
description: "The test runner configuration",
properties: {
command: {
type: "string",
description: "Command line to start the test runner",
examples: ["./node_modules/.bin/mocha"],
},
args: {
type: "object",
description:
"A configuration of command line args for your test runner",
properties: {
filter: {
type: "string",
description:
"the command line arg for filtering tests with a regex pattern",
examples: ["--grep"],
},
tap: {
type: "string",
description:
"The command line arg for configuring a TAP reporter. See https://github.com/sindresorhus/awesome-tap for examples.",
examples: ["--reporter=mocha-tap-reporter"],
},
},
additionalProperties: false,
required: ["tap"],
},
directory: {
type: "string",
description: "An optional folder for the test runner",
examples: ["coderoad"],
},
setup: {
$ref: "#/definitions/setup_action",
description:
"Setup commits or commands used for setting up the test runner on tutorial launch",
},
},
required: ["command", "args"],
},
repo: {
type: "object",
description: "The repo holding the git commits for the tutorial",
properties: {
uri: {
type: "string",
description: "The uri source of the tutorial",
format: "uri",
examples: ["https://github.com/name/tutorial-name.git"],
},
branch: {
description:
"The branch of the repo where the tutorial config file exists",
type: "string",
examples: ["master"],
},
},
additionalProperties: false,
required: ["uri", "branch"],
},
reset: {
type: "object",
description: "Configuration options for resetting a tutorial",
properties: {
command: {
type: "string",
description: "An optional command to run on reset",
examples: ["npm install"],
},
},
additionalProperties: false,
},
dependencies: {
type: "array",
description: "A list of tutorial dependencies",
items: {
type: "object",
properties: {
name: {
type: "string",
description:
"The command line process name of the dependency. It will be checked by running `name --version`",
examples: ["node", "python"],
},
version: {
type: "string",
description:
"The version requirement. See https://github.com/npm/node-semver for options",
examples: [">=10"],
},
},
required: ["name", "version"],
},
},
appVersions: {
type: "object",
description:
"A list of compatable coderoad versions. Currently only a VSCode extension.",
properties: {
vscode: {
type: "string",
description:
"The version range for coderoad-vscode that this tutorial is compatable with",
examples: [">=0.7.0"],
},
},
},
},
additionalProperties: false,
required: ["testRunner", "repo"],
},
// levels
levels: {
type: "array",
description:
'Levels are the stages a user goes through in the tutorial. A level may contain a group of tasks called "steps" that must be completed to proceed',
items: {
type: "object",
properties: {
title: {
$ref: "#/definitions/title",
description: "A title for the level",
},
summary: {
type: "string",
description: "A high-level summary of the level",
maxLength: 250,
},
content: {
type: "string",
description: "Content for a tutorial written as Markdown",
},
setup: {
$ref: "#/definitions/setup_action",
description:
"An optional point for loading commits, running commands or opening files",
},
steps: {
type: "array",
items: {
type: "object",
properties: {
content: {
type: "string",
description:
"The text displayed explaining information about the current task, written as markdown",
},
setup: {
allOf: [
{
$ref: "#/definitions/setup_action",
description:
"A point for loading commits. It can also run commands and/or open files",
},
{
required: ["commits"],
},
],
},
solution: {
allOf: [
{
$ref: "#/definitions/setup_action",
description:
"The solution commits that can be loaded if the user gets stuck. It can also run commands and/or open files",
},
{
required: [],
},
],
},
},
hints: {
type: "array",
description:
"An optional array of hints to provide helpful feedback to users",
items: {
type: "string",
description: "A hint to provide to the user",
examples: ["Have you tried doing X?"],
},
},
required: ["content", "setup"],
},
},
},
required: ["title", "summary", "content"],
},
},
},
additionalProperties: false,
required: ["version", "summary", "config", "levels"],
};