-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.go
42 lines (35 loc) · 776 Bytes
/
build.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package main
import (
"github.com/YairLevi/Coffee/cli/util"
"github.com/charmbracelet/log"
"os"
)
func Build() error {
err := os.Chdir("frontend")
if err != nil {
return err
}
log.Info("Making frontend dist folder")
buildFront := util.CommandWithLog("npm", "run", "build")
err = buildFront.Run()
if err != nil {
return err
}
err = os.Chdir("..")
if err != nil {
return err
}
log.Info("Adding frontend to resources")
err = util.MoveDirectory("frontend/dist", "src/main/resources/dist")
if err != nil {
return err
}
log.Info("Bundling to JAR")
buildApp := util.CommandWithLog("mvn", "clean", "compile", "assembly:single")
err = buildApp.Run()
if err != nil {
return err
}
log.Info("Done. your JAR is located at `./target")
return nil
}