@@ -17,16 +17,15 @@ package cli
17
17
18
18
import (
19
19
"os"
20
- "path/filepath"
21
20
22
21
"github.com/spf13/cobra"
23
22
"github.com/yomorun/yomo/pkg/log"
24
23
25
24
// serverless registrations
26
25
"github.com/yomorun/yomo/cli/serverless"
27
- _ "github.com/yomorun/yomo/cli/serverless/deno"
28
26
_ "github.com/yomorun/yomo/cli/serverless/exec"
29
27
_ "github.com/yomorun/yomo/cli/serverless/golang"
28
+ _ "github.com/yomorun/yomo/cli/serverless/nodejs"
30
29
_ "github.com/yomorun/yomo/cli/serverless/wasm"
31
30
"github.com/yomorun/yomo/cli/viper"
32
31
)
@@ -37,7 +36,7 @@ var runCmd = &cobra.Command{
37
36
Short : "Run a YoMo Stream Function" ,
38
37
Long : "Run a YoMo Stream Function" ,
39
38
Run : func (cmd * cobra.Command , args []string ) {
40
- if err := parseFileArg (args , & opts , defaultSFNCompliedFile , defaultSFNWASIFile , defaultSFNSourceFile ); err != nil {
39
+ if err := parseFileArg (args , & opts , defaultSFNCompliedFile , defaultSFNWASIFile , defaultSFNSourceFile , defaultSFNSourceTSFile ); err != nil {
41
40
log .FailureStatusEvent (os .Stdout , err .Error ())
42
41
return
43
42
}
@@ -68,24 +67,12 @@ var runCmd = &cobra.Command{
68
67
)
69
68
return
70
69
}
71
- // build if it's go file
72
- if ext := filepath .Ext (opts .Filename ); ext == ".go" {
73
- log .PendingStatusEvent (os .Stdout , "Building YoMo Stream Function instance..." )
74
- if err := s .Build (true ); err != nil {
75
- log .FailureStatusEvent (os .Stdout , err .Error ())
76
- os .Exit (127 )
77
- }
78
- log .SuccessStatusEvent (os .Stdout , "YoMo Stream Function build successful!" )
79
- }
80
- // run
81
- // wasi
82
- if ext := filepath .Ext (opts .Filename ); ext == ".wasm" {
83
- wasmRuntime := opts .Runtime
84
- if wasmRuntime == "" {
85
- wasmRuntime = "wazero"
86
- }
87
- log .InfoStatusEvent (os .Stdout , "WASM runtime: %s" , wasmRuntime )
70
+
71
+ if err := s .Build (true ); err != nil {
72
+ log .FailureStatusEvent (os .Stdout , err .Error ())
73
+ os .Exit (127 )
88
74
}
75
+
89
76
log .InfoStatusEvent (
90
77
os .Stdout ,
91
78
"Starting YoMo Stream Function instance, connecting to zipper: %v" ,
@@ -103,7 +90,7 @@ func init() {
103
90
rootCmd .AddCommand (runCmd )
104
91
105
92
runCmd .Flags ().StringVarP (& opts .ZipperAddr , "zipper" , "z" , "localhost:9000" , "YoMo-Zipper endpoint addr" )
106
- runCmd .Flags ().StringVarP (& opts .Name , "name" , "n" , "app " , "yomo stream function name." )
93
+ runCmd .Flags ().StringVarP (& opts .Name , "name" , "n" , "" , "yomo stream function name." )
107
94
runCmd .Flags ().StringVarP (& opts .ModFile , "modfile" , "m" , "" , "custom go.mod" )
108
95
runCmd .Flags ().StringVarP (& opts .Credential , "credential" , "d" , "" , "client credential payload, eg: `token:dBbBiRE7`" )
109
96
runCmd .Flags ().StringVarP (& opts .Runtime , "runtime" , "r" , "" , "serverless runtime type" )
0 commit comments