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

prevent commands on reset tutorial#439

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ShMcK merged 2 commits intomasterfromfix/tasks-run-on-reset
Aug 8, 2020
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletionsCHANGELOG.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -248,3 +248,8 @@ Adds a review page for viewing tutorial content. The review page should be espec
- Supports commands on reset
- Supports running vscode commands anywhere that command line commands can be run
- Admin mode to allow creators to jump between tutorial levels/steps during development

### [0.13.1]

- Add logo
- Fix issue with watcher tests running on reset
4 changes: 2 additions & 2 deletionssrc/services/hooks/index.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
import * as T from 'typings'
import * as TT from 'typings/tutorial'
import * as git from '../git'
import loadCommits from './utils/loadCommits'
import loadWatchersfrom './utils/loadWatchers'
import{loadWatchers, resetWatchers }from './utils/watchers'
import openFiles from './utils/openFiles'
import runCommands from './utils/runCommands'
import runVSCodeCommands from './utils/runVSCodeCommands'
Expand DownExpand Up@@ -39,6 +38,7 @@ export const onSolutionEnter = async (actions: TT.StepActions): Promise<void> =>
}

export const onReset = async (actions: TT.StepActions): Promise<void> => {
await resetWatchers()
await runCommands(actions?.commands)
await runVSCodeCommands(actions?.vscodeCommands)
}
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,7 +14,7 @@ const disposeWatcher = (watcher: string) => {
delete watcherObject[watcher]
}

const loadWatchers = (watchers: string[] = []): void => {
exportconst loadWatchers = (watchers: string[] = []): void => {
if (!watchers.length) {
// remove all watchers
for (const watcher of Object.keys(watcherObject)) {
Expand DownExpand Up@@ -55,4 +55,8 @@ const loadWatchers = (watchers: string[] = []): void => {
}
}

export default loadWatchers
export const resetWatchers = (): void => {
for (const watcher of Object.keys(watcherObject)) {
disposeWatcher(watcher)
}
}
27 changes: 14 additions & 13 deletionstypings/index.d.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -89,27 +89,28 @@ export interface MachineStateSchema {
states: {
Setup: {
states: {
Startup:{}
ValidateSetup:{}
Start:{}
SelectTutorial:{}
SetupNewTutorial:{}
StartTutorial:{}
Startup:Record<string, unknown>
ValidateSetup:Record<string, unknown>
Start:Record<string, unknown>
SelectTutorial:Record<string, unknown>
SetupNewTutorial:Record<string, unknown>
StartTutorial:Record<string, unknown>
}
}
Tutorial: {
states: {
Level: {
states: {
Load:{}
Normal:{}
TestRunning:{}
StepNext:{}
LevelComplete:{}
LoadNext:{}
Load:Record<string, unknown>
Normal:Record<string, unknown>
TestRunning:Record<string, unknown>
StepNext:Record<string, unknown>
LevelComplete:Record<string, unknown>
LoadNext:Record<string, unknown>
}
}
Completed: {}
Reset: Record<string, unknown>
Completed: Record<string, unknown>
}
}
}
Expand Down
3 changes: 3 additions & 0 deletionsweb-app/src/Routes.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,6 +42,9 @@ const Routes = () => {
<Route paths={{ Tutorial: { Level: { Load: true } } }}>
<LoadingPage text="Loading Level..." processes={context.processes} />
</Route>
<Route paths={{ Tutorial: { Reset: true } }}>
<LoadingPage text="Resetting tutorial..." processes={context.processes} />
</Route>
<Route paths={{ Tutorial: { Level: true, Completed: true } }}>
<TutorialPage send={send} context={context} state={route.replace('Tutorial.', '')} />
</Route>
Expand Down
13 changes: 9 additions & 4 deletionsweb-app/src/services/state/machine.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -69,7 +69,6 @@ export const createMachine = (options: any) => {
target: 'SetupNewTutorial',
actions: ['setTutorialContext'],
},
// TODO: handle completed tutorial differently
TUTORIAL_ALREADY_COMPLETE: {
target: 'Start',
actions: ['setStart'],
Expand DownExpand Up@@ -168,9 +167,7 @@ export const createMachine = (options: any) => {
RUN_TEST: {
actions: ['runTest'],
},
RUN_RESET: {
actions: ['runReset'],
},
RUN_RESET: '#reset-tutorial',
KEY_PRESS_ENTER: {
actions: ['runTest'],
},
Expand DownExpand Up@@ -234,6 +231,14 @@ export const createMachine = (options: any) => {
},
},
},
Reset: {
id: 'reset-tutorial',
onEntry: ['runReset'],
onExit: ['testClear'],
after: {
3000: '#tutorial',
},
},
Completed: {
id: 'completed-tutorial',
on: {
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp