-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathskeleton.ts
196 lines (193 loc) · 6.24 KB
/
skeleton.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
import meta from "./meta";
export default {
title: "Skeleton Schema",
description:
"A CodeRoad tutorial config schema. This data is paired up with the markdown to create a tutorial",
...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"],
},
// 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_without_commits",
description:
"Setup actions 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: {
id: {
type: "string",
description: "A level id",
examples: ["1", "11"],
},
setup: {
$ref: "#/definitions/setup_action_without_commits",
description:
"An optional point for running actions, commands or opening files",
},
steps: {
type: "array",
items: {
type: "object",
properties: {
id: {
type: "string",
description: "A level id",
examples: ["1.1", "11.12"],
},
setup: {
allOf: [
{
$ref: "#/definitions/setup_action_without_commits",
description:
"A point for running actions, commands and/or opening files",
},
],
},
solution: {
allOf: [
{
$ref: "#/definitions/setup_action_without_commits",
description:
"The solution can be loaded if the user gets stuck. It can run actions, commands and/or open files",
},
{
required: [],
},
],
},
},
required: ["id"],
},
},
},
required: ["id"],
},
minItems: 1,
},
},
additionalProperties: false,
required: ["version", "config", "levels"],
};