Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions starport/cmd/scaffold.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ func NewScaffold() *cobra.Command {
}

c.AddCommand(NewScaffoldChain())
c.AddCommand(NewScaffoldVue())

return c
}
41 changes: 41 additions & 0 deletions starport/cmd/scaffold_vue.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package starportcmd

import (
"fmt"

"github.com/spf13/cobra"
"github.com/tendermint/starport/starport/pkg/clispinner"
"github.com/tendermint/starport/starport/services/scaffolder"
)

const flagPath = "path"

// NewScaffoldVue scaffolds a Vue.js app for a chain.
func NewScaffoldVue() *cobra.Command {
c := &cobra.Command{
Use: "vue",
Short: "Scaffold a Vue.JS app for a chain",
Args: cobra.NoArgs,
RunE: scaffoldVueHandler,
}

c.Flags().StringP(flagPath, "p", "./vue", "path to scaffold content of the Vue.js app")

return c
}

func scaffoldVueHandler(cmd *cobra.Command, args []string) error {
s := clispinner.New().SetText("Scaffolding...")
defer s.Stop()

path, _ := cmd.Flags().GetString(flagPath)

if err := scaffolder.Vue(path); err != nil {
return err
}

s.Stop()
fmt.Printf("\n🎉 Scaffold a Vue.js app.\n\n")

return nil
}
8 changes: 6 additions & 2 deletions starport/services/scaffolder/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,12 @@ func (s *Scaffolder) generate(
}

// generate the vue app.
vuepath := filepath.Join(absRoot, "vue")
return localfs.Save(vue.Boilerplate(), vuepath)
return Vue(filepath.Join(absRoot, "vue"))
}

// Vue scaffolds a Vue.js app for a chain.
func Vue(path string) error {
return localfs.Save(vue.Boilerplate(), path)
}

func initGit(path string) error {
Expand Down