Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit48ac4e7

Browse files
committed
add docs on hooks/actions
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
1 parentea9d4d4 commit48ac4e7

File tree

2 files changed

+34
-3
lines changed

2 files changed

+34
-3
lines changed

‎docs/docs/how-it-works.md

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,19 @@ title: How CodeRoad Works
44
sidebar_label:How CodeRoad Works
55
---
66

7-
###Running Tests
7+
There are really a few major pieces to understand how CodeRoad works.
88

9-
In CodeRoad, the user is given a set of directions for a**task**.
9+
1.[How Tests Work](#how-tests-work)
10+
11+
2.[How CodeRoad is Built on Git](#built-on-git)
12+
13+
3.[How CodeRoad Hooks & Actions work](#how-hooks-and-actions-work)
14+
15+
###How Tests Work
16+
17+
In CodeRoad, the user is given a set of**levels** composed of one more**tasks**.
18+
19+
![Level / Task Flow](../images/level-task-flow.png)
1020

1121
Each task is judged to pass (✔) or fail (✘) by the result of code tests that runs in the background. Tests can be triggered by saving a file, or by a trigger that listens to specific files for changes.
1222

@@ -50,8 +60,29 @@ Git provides a number of benefits:
5060

5161
####Reset
5262

53-
If at some point the user is a bit too “off-road”of the solution,they callalways return to the “golden path” by pressing the"reset" button. The reset button reloads the commits up to that point entirely from the tutorial.
63+
If at some point the user is a bit too “off-road”from the solution,the user canalways return to the “golden path” by pressing the**reset** button. The reset button reloads the commits up to that point entirely from the tutorial.
5464

5565
![Tutorial commits reset example](../images/tutorial-commits-reset.png)
5666

5767
In the example above you can see the user is “reset” back to the original tutorial answers, and back to the second task.
68+
69+
###How Hooks and Actions Work
70+
71+
To make a functional tutorial, tutorial creators need a bit more control over what can be run and when. For example, a test runner wouldn't really work if the package dependencies for that test runner weren't installed.
72+
73+
An**action** is a piece of functionality that can be run. These include:
74+
75+
-`commands` - a list of cli commands to run. For example, "npm install"
76+
-`vscodeCommands` - a list of vscode API commands to run. For example, "setLayout" to change the layout of windows
77+
-`watchers` - a list of files to listen to. If a file changes, the test runner will run automatically
78+
-`files` - a list of files to open in the users workspace to drive the users attention.
79+
-`subtasks` - a task made up of multiple other tests where all must pass to continue
80+
-`filter` - a regex passed into the test runner to limit the tests returned
81+
82+
A**hook** in CodeRoad is a place where a tutorial creator can tap in to run an action. Hooks include:
83+
84+
-`config.setup` - when the tutorial setup. This is a great place to setup your test runner.
85+
-`task.setup` - when a task is started
86+
-`task.solution` - when a solution is loaded from a[reset](#reset)
87+
88+
Hooks and actions combined provide a flexible environment for tutorial development.

‎docs/images/level-task-flow.png

21 KB
Loading

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp