We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
2 parentsada2f6a +fc38477 commitb074672Copy full SHA for b074672
src/actions/onRunReset.ts
@@ -3,6 +3,7 @@ import * as TT from 'typings/tutorial'
3
importContextfrom'../services/context/context'
4
import{exec}from'../services/node'
5
importresetfrom'../services/reset'
6
+import*ashooksfrom'../services/hooks'
7
importgetCommitHashByPositionfrom'../services/reset/lastHash'
8
9
typeResetAction={
@@ -30,8 +31,9 @@ const onRunReset = async (action: ResetAction, context: Context): Promise<void>
30
31
reset({ branch, hash})
32
33
// if tutorial.config.reset.command, run it
-if(tutorial?.config?.reset?.command){
34
-awaitexec({command:tutorial.config.reset.command})
+constresetActions=tutorial?.config?.reset
35
+if(resetActions){
36
+hooks.onReset({commands:resetActions?.commands,vscodeCommands:resetActions?.vscodeCommands})
37
}
38
39
src/commands.ts
@@ -3,8 +3,8 @@ import * as TT from 'typings/tutorial'
import*asvscodefrom'vscode'
importcreateTestRunnerfrom'./services/testRunner'
importcreateWebViewfrom'./services/webview'
-importloggerfrom'./services/logger'
import*ashooksfrom'./services/hooks'
+importloggerfrom'./services/logger'
exportconstCOMMANDS={
10
START:'coderoad.start',
src/services/hooks/index.ts
@@ -38,6 +38,11 @@ export const onSolutionEnter = async (actions: TT.StepActions): Promise<void> =>
awaitonRunTest()
40
41
+exportconstonReset=async(actions:TT.StepActions):Promise<void>=>{
42
+awaitrunCommands(actions?.commands)
43
+awaitrunVSCodeCommands(actions?.vscodeCommands)
44
+}
45
+
46
exportconstonError=async(error:Error):Promise<void>=>{
47
telemetryOnError(error)
48
src/services/hooks/utils/loadCommits.ts
@@ -1,7 +1,7 @@
1
import*asgitfrom'../../git'
2
-constloadCommits=async(commits:string[]):Promise<void>=>{
-if(commits){
+constloadCommits=async(commits:string[]=[]):Promise<void>=>{
+if(commits&&commits.length){
// load the current list of commits for validation
for(constcommitofcommits){
awaitgit.loadCommit(commit)
src/services/reset/lastHash.ts
@@ -41,7 +41,7 @@ const getLastCommitHash = (position: T.Position, tutorial: TT.Tutorial | null):
if(!step){
thrownewError(`No step found matching${stepId}`)
-constcommits=step.setup.commits
+constcommits=step.setup?.commits||[]
if(!commits.length){
thrownewError(`No commits found on step${stepId}`)
typings/tutorial.d.ts
@@ -3,7 +3,8 @@ import { ProgressStatus } from './index'
exporttypeMaybe<T>=T|null
exporttypeConfigReset={
-command?:string
+commands?:string[]
+vscodeCommands?:VSCodeCommand[]
exporttypeTutorialConfig={
@@ -57,7 +58,7 @@ export type TutorialSummary = {
57
58
59
exporttypeStepActions={
60
commands?:string[]
-commits:string[]
61
+commits?:string[]
62
files?:string[]
63
watchers?:string[]
64
filter?:string