make vue component gen reusable

This commit is contained in:
2025-04-23 23:33:37 -06:00
parent 7df13b4866
commit 67d4008f7e
3 changed files with 35 additions and 3 deletions

7
.idea/masonry.iml generated
View File

@ -1,4 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<module type="WEB_MODULE" version="4">
<component name="Go" enabled="true" />
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

8
.idea/modules.xml generated Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/masonry.iml" filepath="$PROJECT_DIR$/.idea/masonry.iml" />
</modules>
</component>
</project>

View File

@ -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
},
}