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

Commit1a9ccf9

Browse files
committed
refactor setupActions
1 parentd1d5384 commit1a9ccf9

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

‎src/actions/setupActions.ts

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,20 @@ interface ErrorMessageFilter {
1111
}
1212

1313
// TODO: should be loaded on startup based on language
14-
consterrorMessageFilter:ErrorMessageFilter={
15-
js:{
14+
constcommandErrorMessageFilter:ErrorMessageFilter={
15+
JAVASCRIPT:{
1616
'node-gyp':'Error running npm setup command'
1717
}
1818
}
1919

20-
constsetupActions=async({commands, commits, files}:G.StepActions):Promise<void>=>{
21-
// run commits
22-
for(constcommitofcommits){
23-
awaitgit.loadCommit(commit)
24-
}
25-
26-
// run command
20+
construnCommands=async(commands:string[],language:string)=>{
2721
for(constcommandofcommands){
2822
const{stdout, stderr}=awaitnode.exec(command)
2923
if(stderr){
3024
console.error(stderr)
3125
// language specific error messages from running commands
32-
for(constmessageofObject.keys(errorMessageFilter.js)){
26+
constfilteredMessages=Object.keys(commandErrorMessageFilter[language])
27+
for(constmessageoffilteredMessages){
3328
if(stderr.match(message)){
3429
// ignored error
3530
thrownewError('Error running setup command')
@@ -38,6 +33,17 @@ const setupActions = async ({commands, commits, files}: G.StepActions): Promise<
3833
}
3934
console.log(`run command:${command}`,stdout)
4035
}
36+
}
37+
38+
39+
constsetupActions=async({commands, commits, files}:G.StepActions):Promise<void>=>{
40+
// run commits
41+
for(constcommitofcommits){
42+
awaitgit.loadCommit(commit)
43+
}
44+
45+
// run command
46+
4147

4248
// open files
4349
for(constfilePathoffiles){

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp