@@ -11,25 +11,20 @@ interface ErrorMessageFilter {
1111}
1212
1313// TODO: should be loaded on startup based on language
14- const errorMessageFilter :ErrorMessageFilter = {
15- js :{
14+ const commandErrorMessageFilter :ErrorMessageFilter = {
15+ JAVASCRIPT :{
1616'node-gyp' :'Error running npm setup command'
1717}
1818}
1919
20- const setupActions = async ( { commands, commits, files} :G . StepActions ) :Promise < void > => {
21- // run commits
22- for ( const commit of commits ) {
23- await git . loadCommit ( commit )
24- }
25-
26- // run command
20+ const runCommands = async ( commands :string [ ] , language :string ) => {
2721for ( const command of commands ) {
2822const { stdout, stderr} = await node . exec ( command )
2923if ( stderr ) {
3024console . error ( stderr )
3125// language specific error messages from running commands
32- for ( const message of Object . keys ( errorMessageFilter . js ) ) {
26+ const filteredMessages = Object . keys ( commandErrorMessageFilter [ language ] )
27+ for ( const message of filteredMessages ) {
3328if ( stderr . match ( message ) ) {
3429// ignored error
3530throw new Error ( 'Error running setup command' )
@@ -38,6 +33,17 @@ const setupActions = async ({commands, commits, files}: G.StepActions): Promise<
3833}
3934console . log ( `run command:${ command } ` , stdout )
4035}
36+ }
37+
38+
39+ const setupActions = async ( { commands, commits, files} :G . StepActions ) :Promise < void > => {
40+ // run commits
41+ for ( const commit of commits ) {
42+ await git . loadCommit ( commit )
43+ }
44+
45+ // run command
46+
4147
4248// open files
4349for ( const filePath of files ) {