@@ -6,10 +6,19 @@ import openFiles from './utils/openFiles'
6
6
import runCommands from './utils/runCommands'
7
7
import onError from '../services/sentry/onError'
8
8
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 > => {
13
22
const { commands, commits, files, watchers } = actions
14
23
15
24
// 1. run commits
@@ -26,8 +35,13 @@ const setupActions = async (
26
35
// 3. start file watchers
27
36
loadWatchers ( watchers || [ ] )
28
37
38
+ await wait ( 1000 )
39
+
29
40
// 4. run command
30
- await runCommands ( commands || [ ] , send ) . catch ( onError )
41
+ await runCommands ( { commands : commands || [ ] , send, path } ) . catch ( onError )
31
42
}
32
43
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