|
1 |
| -import meta from './meta' |
| 1 | +import meta from "./meta"; |
2 | 2 |
|
3 | 3 | export default {
|
4 |
| - title: 'Skeleton Schema', |
| 4 | + title: "Skeleton Schema", |
5 | 5 | description:
|
6 |
| - 'A CodeRoad tutorial config schema. This data is paired up with the markdown to create a tutorial', |
| 6 | + "A CodeRoad tutorial config schema. This data is paired up with the markdown to create a tutorial", |
7 | 7 | ...meta,
|
8 |
| - type: 'object', |
| 8 | + type: "object", |
9 | 9 | properties: {
|
10 | 10 | version: {
|
11 |
| - $ref: '#/definitions/semantic_version', |
12 |
| - description: 'The tutorial version. Must be unique for the tutorial.', |
13 |
| - examples: ['0.1.0', '1.0.0'] |
| 11 | + $ref: "#/definitions/semantic_version", |
| 12 | + description: "The tutorial version. Must be unique for the tutorial.", |
| 13 | + examples: ["0.1.0", "1.0.0"], |
14 | 14 | },
|
15 | 15 |
|
16 | 16 | // config
|
17 | 17 | config: {
|
18 |
| - type: 'object', |
| 18 | + type: "object", |
19 | 19 | properties: {
|
20 | 20 | testRunner: {
|
21 |
| - type: 'object', |
22 |
| - description: 'The test runner configuration', |
| 21 | + type: "object", |
| 22 | + description: "The test runner configuration", |
23 | 23 | properties: {
|
24 | 24 | command: {
|
25 |
| - type: 'string', |
26 |
| - description: 'Command line to start the test runner', |
27 |
| - examples: ['./node_modules/.bin/mocha'] |
| 25 | + type: "string", |
| 26 | + description: "Command line to start the test runner", |
| 27 | + examples: ["./node_modules/.bin/mocha"], |
28 | 28 | },
|
29 | 29 | args: {
|
30 |
| - type: 'object', |
| 30 | + type: "object", |
31 | 31 | description:
|
32 |
| - 'A configuration of command line args for your test runner', |
| 32 | + "A configuration of command line args for your test runner", |
33 | 33 | properties: {
|
34 | 34 | filter: {
|
35 |
| - type: 'string', |
| 35 | + type: "string", |
36 | 36 | description:
|
37 |
| - 'the command line arg for filtering tests with a regex pattern', |
38 |
| - examples: ['--grep'] |
| 37 | + "the command line arg for filtering tests with a regex pattern", |
| 38 | + examples: ["--grep"], |
39 | 39 | },
|
40 | 40 | tap: {
|
41 |
| - type: 'string', |
| 41 | + type: "string", |
42 | 42 | description:
|
43 |
| - 'The command line arg for configuring a TAP reporter. See https://github.com/sindresorhus/awesome-tap for examples.', |
44 |
| - examples: ['--reporter=mocha-tap-reporter'] |
45 |
| - } |
| 43 | + "The command line arg for configuring a TAP reporter. See https://github.com/sindresorhus/awesome-tap for examples.", |
| 44 | + examples: ["--reporter=mocha-tap-reporter"], |
| 45 | + }, |
46 | 46 | },
|
47 | 47 | additionalProperties: false,
|
48 |
| - required: ['tap'] |
| 48 | + required: ["tap"], |
49 | 49 | },
|
50 | 50 | directory: {
|
51 |
| - type: 'string', |
52 |
| - description: 'An optional folder for the test runner', |
53 |
| - examples: ['coderoad'] |
54 |
| - } |
| 51 | + type: "string", |
| 52 | + description: "An optional folder for the test runner", |
| 53 | + examples: ["coderoad"], |
| 54 | + }, |
55 | 55 | },
|
56 |
| - required: ['command', 'args'] |
| 56 | + required: ["command", "args"], |
57 | 57 | },
|
58 | 58 | setup: {
|
59 |
| - type: 'object', |
| 59 | + type: "object", |
60 | 60 | description:
|
61 |
| - 'Setup commits or commands used for setting up the test runner on tutorial launch', |
| 61 | + "Setup commits or commands used for setting up the test runner on tutorial launch", |
62 | 62 | properties: {
|
63 | 63 | commits: {
|
64 |
| - $ref: '#/definitions/commit_array' |
| 64 | + $ref: "#/definitions/commit_array", |
65 | 65 | },
|
66 | 66 | commands: {
|
67 |
| - $ref: '#/definitions/command_array' |
| 67 | + $ref: "#/definitions/command_array", |
68 | 68 | },
|
69 | 69 | vscodeCommands: {
|
70 |
| - $ref: '#/definitions/vscode_command_array' |
71 |
| - } |
72 |
| - } |
| 70 | + $ref: "#/definitions/vscode_command_array", |
| 71 | + }, |
| 72 | + }, |
73 | 73 | },
|
74 | 74 | repo: {
|
75 |
| - type: 'object', |
76 |
| - description: 'The repo holding the git commits for the tutorial', |
| 75 | + type: "object", |
| 76 | + description: "The repo holding the git commits for the tutorial", |
77 | 77 | properties: {
|
78 | 78 | uri: {
|
79 |
| - type: 'string', |
80 |
| - description: 'The uri source of the tutorial', |
81 |
| - format: 'uri', |
82 |
| - examples: ['https://github.com/name/tutorial-name.git'] |
| 79 | + type: "string", |
| 80 | + description: "The uri source of the tutorial", |
| 81 | + format: "uri", |
| 82 | + examples: ["https://github.com/name/tutorial-name.git"], |
83 | 83 | },
|
84 | 84 | branch: {
|
85 | 85 | description:
|
86 |
| - 'The branch of the repo where the tutorial config file exists', |
87 |
| - type: 'string', |
88 |
| - examples: ['master'] |
89 |
| - } |
| 86 | + "The branch of the repo where the tutorial config file exists", |
| 87 | + type: "string", |
| 88 | + examples: ["master"], |
| 89 | + }, |
90 | 90 | },
|
91 | 91 | additionalProperties: false,
|
92 |
| - required: ['uri', 'branch'] |
| 92 | + required: ["uri", "branch"], |
93 | 93 | },
|
94 | 94 | reset: {
|
95 |
| - type: 'object', |
96 |
| - description: 'Configuration options for resetting a tutorial', |
| 95 | + type: "object", |
| 96 | + description: "Configuration options for resetting a tutorial", |
97 | 97 | properties: {
|
98 | 98 | commands: {
|
99 |
| - $ref: '#/definitions/command_array' |
| 99 | + $ref: "#/definitions/command_array", |
100 | 100 | },
|
101 | 101 | vscodeCommands: {
|
102 |
| - $ref: '#/definitions/vscode_command_array' |
103 |
| - } |
| 102 | + $ref: "#/definitions/vscode_command_array", |
| 103 | + }, |
104 | 104 | },
|
105 |
| - additionalProperties: false |
| 105 | + additionalProperties: false, |
106 | 106 | },
|
107 | 107 | dependencies: {
|
108 |
| - type: 'array', |
109 |
| - description: 'A list of tutorial dependencies', |
| 108 | + type: "array", |
| 109 | + description: "A list of tutorial dependencies", |
110 | 110 | items: {
|
111 |
| - type: 'object', |
| 111 | + type: "object", |
112 | 112 | properties: {
|
113 | 113 | name: {
|
114 |
| - type: 'string', |
| 114 | + type: "string", |
115 | 115 | description:
|
116 |
| - 'The command line process name of the dependency. It will be checked by running `name --version`', |
117 |
| - examples: ['node', 'python'] |
| 116 | + "The command line process name of the dependency. It will be checked by running `name --version`", |
| 117 | + examples: ["node", "python"], |
118 | 118 | },
|
119 | 119 | version: {
|
120 |
| - type: 'string', |
| 120 | + type: "string", |
121 | 121 | description:
|
122 |
| - 'The version requirement. See https://github.com/npm/node-semver for options', |
123 |
| - examples: ['>=10'] |
124 |
| - } |
| 122 | + "The version requirement. See https://github.com/npm/node-semver for options", |
| 123 | + examples: [">=10"], |
| 124 | + }, |
125 | 125 | },
|
126 |
| - required: ['name', 'version'] |
127 |
| - } |
| 126 | + required: ["name", "version"], |
| 127 | + }, |
128 | 128 | },
|
129 | 129 | appVersions: {
|
130 |
| - type: 'object', |
| 130 | + type: "object", |
131 | 131 | description:
|
132 |
| - 'A list of compatable coderoad versions. Currently only a VSCode extension.', |
| 132 | + "A list of compatable coderoad versions. Currently only a VSCode extension.", |
133 | 133 | properties: {
|
134 | 134 | vscode: {
|
135 |
| - type: 'string', |
| 135 | + type: "string", |
136 | 136 | description:
|
137 |
| - 'The version range for coderoad-vscode that this tutorial is compatable with', |
138 |
| - examples: ['>=0.7.0'] |
139 |
| - } |
140 |
| - } |
141 |
| - } |
| 137 | + "The version range for coderoad-vscode that this tutorial is compatable with", |
| 138 | + examples: [">=0.7.0"], |
| 139 | + }, |
| 140 | + }, |
| 141 | + }, |
| 142 | + webhook: { |
| 143 | + type: "object", |
| 144 | + description: |
| 145 | + "An optional configuration for webhooks triggered by events such as init, step/level/tutorial complete", |
| 146 | + properties: { |
| 147 | + url: { |
| 148 | + type: "string", |
| 149 | + description: "URL for POST restful webhook request", |
| 150 | + examples: ["https://example.com/webhook"], |
| 151 | + }, |
| 152 | + events: { |
| 153 | + type: "object", |
| 154 | + description: "An object of events to trigger on", |
| 155 | + properties: { |
| 156 | + init: { |
| 157 | + type: "boolean", |
| 158 | + description: |
| 159 | + "An event triggered on tutorial startup. Sends tutorialId", |
| 160 | + }, |
| 161 | + reset: { |
| 162 | + type: "boolean", |
| 163 | + description: |
| 164 | + "An event triggered on reset of a tutorial. Sends tutorialId", |
| 165 | + }, |
| 166 | + step_complete: { |
| 167 | + type: "boolean", |
| 168 | + description: |
| 169 | + "An event triggered on completion of a step. Sends tutorialId, levelId & stepId", |
| 170 | + }, |
| 171 | + level_complete: { |
| 172 | + step_complete: { |
| 173 | + type: "boolean", |
| 174 | + description: |
| 175 | + "An event triggered on completion of a level. Sends tutorialId & levelId", |
| 176 | + }, |
| 177 | + }, |
| 178 | + tutorial_complete: { |
| 179 | + step_complete: { |
| 180 | + type: "boolean", |
| 181 | + description: |
| 182 | + "An event triggered on completion of a tutorial. Sends tutorialId", |
| 183 | + }, |
| 184 | + }, |
| 185 | + }, |
| 186 | + additionalProperties: false, |
| 187 | + }, |
| 188 | + }, |
| 189 | + required: ["url", "events"], |
| 190 | + }, |
142 | 191 | },
|
143 | 192 | additionalProperties: false,
|
144 |
| - required: ['testRunner', 'repo'] |
| 193 | + required: ["testRunner", "repo"], |
145 | 194 | },
|
146 | 195 |
|
147 | 196 | // levels
|
148 | 197 | levels: {
|
149 |
| - type: 'array', |
| 198 | + type: "array", |
150 | 199 | description:
|
151 | 200 | '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',
|
152 | 201 | items: {
|
153 |
| - type: 'object', |
| 202 | + type: "object", |
154 | 203 | properties: {
|
155 | 204 | id: {
|
156 |
| - type: 'string', |
157 |
| - description: 'A level id', |
158 |
| - examples: ['1', '11'] |
| 205 | + type: "string", |
| 206 | + description: "A level id", |
| 207 | + examples: ["1", "11"], |
159 | 208 | },
|
160 | 209 | setup: {
|
161 |
| - $ref: '#/definitions/setup_action_without_commits', |
| 210 | + $ref: "#/definitions/setup_action_without_commits", |
162 | 211 | description:
|
163 |
| - 'An optional point for running actions, commands or opening files' |
| 212 | + "An optional point for running actions, commands or opening files", |
164 | 213 | },
|
165 | 214 | steps: {
|
166 |
| - type: 'array', |
| 215 | + type: "array", |
167 | 216 | items: {
|
168 |
| - type: 'object', |
| 217 | + type: "object", |
169 | 218 | properties: {
|
170 | 219 | id: {
|
171 |
| - type: 'string', |
172 |
| - description: 'A level id', |
173 |
| - examples: ['1.1', '11.12'] |
| 220 | + type: "string", |
| 221 | + description: "A level id", |
| 222 | + examples: ["1.1", "11.12"], |
174 | 223 | },
|
175 | 224 | setup: {
|
176 | 225 | allOf: [
|
177 | 226 | {
|
178 |
| - $ref: '#/definitions/setup_action_without_commits', |
| 227 | + $ref: "#/definitions/setup_action_without_commits", |
179 | 228 | description:
|
180 |
| - 'A point for running actions, commands and/or opening files' |
181 |
| - } |
182 |
| - ] |
| 229 | + "A point for running actions, commands and/or opening files", |
| 230 | + }, |
| 231 | + ], |
183 | 232 | },
|
184 | 233 | solution: {
|
185 | 234 | allOf: [
|
186 | 235 | {
|
187 |
| - $ref: '#/definitions/setup_action_without_commits', |
| 236 | + $ref: "#/definitions/setup_action_without_commits", |
188 | 237 | description:
|
189 |
| - 'The solution can be loaded if the user gets stuck. It can run actions, commands and/or open files' |
| 238 | + "The solution can be loaded if the user gets stuck. It can run actions, commands and/or open files", |
190 | 239 | },
|
191 | 240 | {
|
192 |
| - required: [] |
193 |
| - } |
194 |
| - ] |
195 |
| - } |
| 241 | + required: [], |
| 242 | + }, |
| 243 | + ], |
| 244 | + }, |
196 | 245 | },
|
197 |
| - required: ['id'] |
198 |
| - } |
199 |
| - } |
| 246 | + required: ["id"], |
| 247 | + }, |
| 248 | + }, |
200 | 249 | },
|
201 |
| - required: ['id'] |
| 250 | + required: ["id"], |
202 | 251 | },
|
203 |
| - minItems: 1 |
204 |
| - } |
| 252 | + minItems: 1, |
| 253 | + }, |
205 | 254 | },
|
206 | 255 | additionalProperties: false,
|
207 |
| - required: ['version', 'config', 'levels'] |
208 |
| -} |
| 256 | + required: ["version", "config", "levels"], |
| 257 | +}; |
0 commit comments