diff --git a/.idea/masonry.iml b/.idea/masonry.iml index 7ee078d..5e764c4 100644 --- a/.idea/masonry.iml +++ b/.idea/masonry.iml @@ -1,4 +1,9 @@ - + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..20e8d1a --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/cmd/cli/commands.go b/cmd/cli/commands.go index 1f58eb3..5ded549 100644 --- a/cmd/cli/commands.go +++ b/cmd/cli/commands.go @@ -336,15 +336,34 @@ func vueGenCmd() *cli.Command { }, }, Action: func(c *cli.Context) error { - fmt.Println("Generating vue components") input := c.String("input") output := c.String("output") - err := vue_gen.GenVueFromSwagger(input, output) + fmt.Println("Generating typescript code") + cmd := exec.Command("npx", + "openapi-typescript-codegen", + "--input", + input, + "--output", + output, + "--client", + "fetch", + ) + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + err := cmd.Run() + if err != nil { + return fmt.Errorf("error generating typescript code | %w", err) + } + + fmt.Println("Generating vue components") + err = vue_gen.GenVueFromSwagger(input, fmt.Sprintf("%s/components/", output)) if err != nil { return fmt.Errorf("error generating vue components | %w", err) } + fmt.Println("You will need to run the command:\n\nnpm install @masonitestudios/dynamic-vue\n\nin your webapp's directory to use the generated components.") + return nil }, }