make vue component gen reusable
This commit is contained in:
@ -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
|
||||
},
|
||||
}
|
||||
|
Reference in New Issue
Block a user