Skip to content

Commit

Permalink
fix(cli): fix CLI build command perm issues
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosstrand committed Aug 2, 2021
1 parent 95d4468 commit 825da29
Show file tree
Hide file tree
Showing 9 changed files with 207 additions and 81 deletions.
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
GOPATH:=$(shell go env GOPATH)

.PHONY: update\:zepto
update\:zepto:
go get -u github.com/go-zepto/zepto && \
go mod tidy && \
cd cmd/zepto/_templates/web && \
mv go.mod_ go.mod && \
go get -u github.com/go-zepto/zepto && \
go mod tidy && \
mv go.mod go.mod_ && \
cd -

.PHONY: install
install:
go get ./cmd/zepto
4 changes: 2 additions & 2 deletions cmd/zepto/_templates/web/go.mod_
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ module github.com/go-zepto/templates/default
go 1.13

require (
github.com/flosch/pongo2 v0.0.0-20200529170236-5abacdfa4915 // indirect
github.com/go-zepto/zepto v1.0.0-beta.8
github.com/flosch/pongo2 v0.0.0-20200913210552-0d938eb266f3 // indirect
github.com/go-zepto/zepto v1.0.0
)
176 changes: 156 additions & 20 deletions cmd/zepto/_templates/web/go.sum

Large diffs are not rendered by default.

12 changes: 11 additions & 1 deletion commands/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ func NpmBuild() {
}

func GoBuild() {
cmd := []string{"build", "-o", "build/app"}
cmd := []string{
"build",
"-ldflags",
"-X github.com/go-zepto/zepto/flags.BuildMode=production",
"-o",
"build/app",
}
matches, err := filepath.Glob("*.go")
if err != nil {
panic(err)
Expand All @@ -50,6 +56,10 @@ func CopyResources() {
if err != nil {
panic(err)
}
err = copy.Copy("config", "build/config")
if err != nil {
panic(err)
}
}

func ExecuteBuild(args []string) {
Expand Down
2 changes: 1 addition & 1 deletion commands/db/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func NewMigrationCmd() *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {
m, err := migrate.NewMigrate(migrate.Options{})
if err != nil {
return nil
return err
}
return m.CreateMigrationFiles(migrate.CreateMigrationFilesOptions{
Name: args[0],
Expand Down
3 changes: 3 additions & 0 deletions commands/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ func ExecuteWeb(templates embed.FS, args []string) {
if err != nil {
panic(err)
}
if err = os.MkdirAll(projectDir+"/db/migrate", 0755); err != nil {
panic(err)
}
replaceFunc := func(c string) string {
return strings.Replace(c, DEFAULT_TMPL_MODULE_PATH, projectName, -1)
}
Expand Down
17 changes: 4 additions & 13 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,14 @@ module github.com/go-zepto/zepto-cli
go 1.16

require (
github.com/briandowns/spinner v1.11.1
github.com/creack/pty v1.1.13
github.com/briandowns/spinner v1.16.0
github.com/creack/pty v1.1.14
github.com/fatih/color v1.12.0
github.com/fsnotify/fsnotify v1.4.9
github.com/go-zepto/zepto v1.0.0-beta.14
github.com/go-zepto/zepto v1.0.0
github.com/golang-migrate/migrate/v4 v4.14.1
github.com/hashicorp/go-version v1.2.1 // indirect
github.com/mattn/go-isatty v0.0.13 // indirect
github.com/mattn/go-sqlite3 v1.14.8 // indirect
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
github.com/otiai10/copy v1.6.0
github.com/pelletier/go-toml v1.9.3
github.com/spf13/cast v1.4.0 // indirect
github.com/spf13/cobra v1.0.0
github.com/spf13/cobra v1.2.1
github.com/tcnksm/go-latest v0.0.0-20170313132115-e3007ae9052e
golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985 // indirect
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c // indirect
google.golang.org/genproto v0.0.0-20210729151513-df9385d47c1b // indirect
gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b // indirect
)
56 changes: 13 additions & 43 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion utils/embed.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func CopyDirFromEmbed(embedFs embed.FS, src string, dest string) error {

}

err = ioutil.WriteFile(dest+"/"+f.Name(), content, 0755)
err = ioutil.WriteFile(dest+"/"+f.Name(), content, 0644)
if err != nil {
return err

Expand Down

0 comments on commit 825da29

Please sign in to comment.