fix: update order of yarn install & build commands and split yarn install & build targets

This commit is contained in:
Jordan Knott 2020-07-18 15:34:33 -05:00
parent e5bfe9b9ab
commit de03fd9ef7
2 changed files with 9 additions and 4 deletions

View File

@ -34,6 +34,7 @@ git clone https://github.com/JordanKnott/project-citadel && cd project-citadel
Next we need to build the binary. This project uses [Mage](https://magefile.org/) for its build tool.
``` bash
go run cmd/mage/main.go install
go run cmd/mage/main.go build
```

View File

@ -21,11 +21,11 @@ var Aliases = map[string]interface{}{
type Frontend mg.Namespace
func (Frontend) Install() error {
return sh.Run("yarn", "install", "--cwd", "frontend")
return sh.RunV("yarn", "--cwd", "frontend", "install")
}
func (Frontend) Build() error {
return sh.Run("yarn", "build", "--cwd", "frontend")
return sh.RunV("yarn", "--cwd", "frontend", "build")
}
type Backend mg.Namespace
@ -44,6 +44,7 @@ func (Backend) GenFrontend() error {
}
func (Backend) Build() error {
fmt.Println("compiling binary dist/citadel")
return sh.Run("go", "build", "-o", "dist/citadel", "cmd/citadel/main.go")
}
@ -73,6 +74,9 @@ func (Backend) Schema() error {
return sh.Run("gqlgen")
}
func Build() {
mg.SerialDeps(Frontend.Install, Frontend.Build, Backend.GenFrontend, Backend.Build)
func Install() {
mg.SerialDeps(Frontend.Install)
}
func Build() {
mg.SerialDeps(Frontend.Build, Backend.GenFrontend, Backend.Build)
}