@@ -6,10 +6,19 @@ import openFiles from './utils/openFiles'
66import runCommands from './utils/runCommands'
77import onError from '../services/sentry/onError'
88
9- const setupActions = async (
10- actions : TT . StepActions ,
11- send : ( action : T . Action ) => void , // send messages to client
12- ) : Promise < void > => {
9+ async function wait ( ms : number ) {
10+ return new Promise ( ( resolve ) => {
11+ setTimeout ( resolve , ms )
12+ } )
13+ }
14+
15+ interface SetupActions {
16+ actions : TT . StepActions
17+ send : ( action : T . Action ) => void // send messages to client
18+ path ?: string
19+ }
20+
21+ export const setupActions = async ( { actions, send, path } : SetupActions ) : Promise < void > => {
1322 const { commands, commits, files, watchers } = actions
1423
1524 // 1. run commits
@@ -26,8 +35,13 @@ const setupActions = async (
2635 // 3. start file watchers
2736 loadWatchers ( watchers || [ ] )
2837
38+ await wait ( 1000 )
39+
2940 // 4. run command
30- await runCommands ( commands || [ ] , send ) . catch ( onError )
41+ await runCommands ( { commands : commands || [ ] , send, path } ) . catch ( onError )
3142}
3243
33- export default setupActions
44+ export const solutionActions = async ( params : SetupActions ) : Promise < void > => {
45+ await git . clear ( )
46+ return setupActions ( params ) . catch ( onError )
47+ }
0 commit comments