Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

Commit

Permalink
Merge pull request #50 from gobuffalo/development
Browse files Browse the repository at this point in the history
v0.17.8
  • Loading branch information
paganotoni authored Nov 25, 2021
2 parents 575ec66 + 56701c6 commit bbfae2d
Show file tree
Hide file tree
Showing 198 changed files with 2,111 additions and 3,544 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
id: go

- name: Checkout Code
uses: actions/checkout@master
uses: actions/checkout@v2

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
bin/
dist/
*-packr.go
7 changes: 7 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
linters-settings:
errcheck:
exclude-functions:
- events.Emit
- events.EmitPayload
- events.EmitError
- events.NamedListen
2 changes: 1 addition & 1 deletion Dockerfile.build
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ ADD . .
RUN go install ./cmd/buffalo

WORKDIR /
RUN go install github.com/gobuffalo/buffalo-pop/v2@latest
RUN go install github.com/gobuffalo/buffalo-pop/v3@latest

RUN mkdir /src
WORKDIR /src
2 changes: 1 addition & 1 deletion Dockerfile.slim.build
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ADD . .
RUN go install ./cmd/buffalo

WORKDIR /
RUN go install github.com/gobuffalo/buffalo-pop/v2@latest
RUN go install github.com/gobuffalo/buffalo-pop/v3@latest

RUN mkdir /src
WORKDIR /src
13 changes: 5 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,17 @@ require (
github.com/BurntSushi/toml v0.4.1
github.com/fatih/color v1.13.0
github.com/gobuffalo/attrs v1.0.1
github.com/gobuffalo/buffalo-pop/v2 v2.3.0
github.com/gobuffalo/clara/v2 v2.0.2
github.com/gobuffalo/buffalo-pop/v3 v3.0.1
github.com/gobuffalo/clara/v2 v2.0.5
github.com/gobuffalo/envy v1.10.1
github.com/gobuffalo/events v1.4.2
github.com/gobuffalo/flect v0.2.4
github.com/gobuffalo/genny/v2 v2.0.6
github.com/gobuffalo/genny/v2 v2.0.8
github.com/gobuffalo/logger v1.0.6
github.com/gobuffalo/meta v0.3.1
github.com/gobuffalo/packd v1.0.1
github.com/gobuffalo/packr/v2 v2.8.1
github.com/gobuffalo/plush/v4 v4.1.8
github.com/gobuffalo/pop/v5 v5.3.4
github.com/gobuffalo/plush/v4 v4.1.9
github.com/gobuffalo/pop/v6 v6.0.0
github.com/google/go-cmp v0.5.6
github.com/karrick/godirwalk v1.16.1
github.com/markbates/grift v1.5.0
github.com/markbates/oncer v1.0.0
github.com/markbates/refresh v1.12.0
Expand Down
1,130 changes: 68 additions & 1,062 deletions go.sum

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions internal/cmd/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"time"

"github.com/gobuffalo/cli/internal/genny/build"

"github.com/gobuffalo/genny/v2"
"github.com/gobuffalo/logger"
"github.com/gobuffalo/meta"
Expand All @@ -37,7 +36,7 @@ var buildOptions = struct {
var xbuildCmd = &cobra.Command{
Use: "build",
Aliases: []string{"b", "bill", "install"},
Short: "Build the application binary, including bundling of assets (packr & webpack)",
Short: "Build the application binary, including bundling of webpack assets",
RunE: func(cmd *cobra.Command, args []string) error {
ctx, cancel := sigtx.WithCancel(context.Background(), os.Interrupt)
defer cancel()
Expand All @@ -63,7 +62,6 @@ var xbuildCmd = &cobra.Command{
if buildOptions.Verbose || buildOptions.Debug {
lg := logger.New(logger.DebugLevel)
run.Logger = lg
// plog.Logger = lg
buildOptions.BuildFlags = append(buildOptions.BuildFlags, "-v")
}

Expand All @@ -85,7 +83,7 @@ var xbuildCmd = &cobra.Command{
// defer clean(run)
defer func() {
if err := clean(run); err != nil {
log.Fatal("build:clean", err)
log.Fatalf("build:clean %s", err)
}
}()
if err := run.WithNew(build.New(opts)); err != nil {
Expand Down
8 changes: 3 additions & 5 deletions internal/cmd/destroy/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
//ActionCmd destroys passed action file
var ActionCmd = &cobra.Command{
Use: "action [name]",
//Example: "resource cars",
// Example: "resource cars",
Aliases: []string{"a"},
Short: "Destroy action files",
RunE: func(cmd *cobra.Command, args []string) error {
Expand All @@ -20,10 +20,8 @@ var ActionCmd = &cobra.Command{

name := args[0]

//Generated actions keep the same name (not plural).
// Generated actions keep the same name (not plural).
fileName := flect.Underscore(name)

removeActions(fileName)
return nil
return removeActions(fileName)
},
}
3 changes: 1 addition & 2 deletions internal/cmd/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ import (
"runtime"
"strings"

"github.com/fatih/color"
"github.com/gobuffalo/cli/internal/genny/assets/webpack"
rg "github.com/gobuffalo/cli/internal/genny/refresh"

"github.com/fatih/color"
"github.com/gobuffalo/events"
"github.com/gobuffalo/genny/v2"
"github.com/gobuffalo/meta"
Expand Down
4 changes: 1 addition & 3 deletions internal/cmd/fix/deprecations.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ func DeprecrationsCheck(r *Runner) error {
if bytes.Contains(b, []byte("T.LanguageFinder=")) || bytes.Contains(b, []byte("T.LanguageFinder ")) {
r.Warnings = append(r.Warnings, fmt.Sprintf("i18n.Translator#LanguageFinder has been deprecated in v0.11.1, and has been removed in v0.12.0. Use i18n.Translator#LanguageExtractors instead. [%s]", path))
}
ioutil.WriteFile(path, b, 0664)

return nil
return ioutil.WriteFile(path, b, 0664)
})
}
14 changes: 8 additions & 6 deletions internal/cmd/fix/fix.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var YesToAll bool
var replace = map[string]string{
"github.com/gobuffalo/buffalo-plugins": "github.com/gobuffalo/cli/internal/plugins",
"github.com/gobuffalo/genny": "github.com/gobuffalo/genny/v2",
"github.com/gobuffalo/pop": "github.com/gobuffalo/pop/v5",
"github.com/gobuffalo/pop": "github.com/gobuffalo/pop/v6",
"github.com/gobuffalo/pop/nulls": "github.com/gobuffalo/nulls",
"github.com/gobuffalo/uuid": "github.com/gofrs/uuid",
"github.com/markbates/pop": "github.com/gobuffalo/pop/v5",
Expand All @@ -26,10 +26,11 @@ var replace = map[string]string{
"github.com/shurcooL/github_flavored_markdown": "github.com/gobuffalo/github_flavored_markdown",
"github.com/gobuffalo/validate": "github.com/gobuffalo/validate/v3",
"github.com/gobuffalo/validate/validators": "github.com/gobuffalo/validate/v3/validators",
"github.com/gobuffalo/suite": "github.com/gobuffalo/suite/v3",
"github.com/gobuffalo/buffalo-pop/": "github.com/gobuffalo/buffalo-pop/v2",
"github.com/gobuffalo/buffalo-pop/pop/popmw": "github.com/gobuffalo/buffalo-pop/v2/pop/popmw",
"github.com/gobuffalo/suite": "github.com/gobuffalo/suite/v4",
"github.com/gobuffalo/buffalo-pop/": "github.com/gobuffalo/buffalo-pop/v3",
"github.com/gobuffalo/buffalo-pop/pop/popmw": "github.com/gobuffalo/buffalo-pop/v3/pop/popmw",
"github.com/gobuffalo/plush": "github.com/gobuffalo/plush/v4",
"github.com/gobuffalo/mw-i18n": "github.com/gobuffalo/mw-i18n/v2",
}

var ic = ImportConverter{
Expand Down Expand Up @@ -57,7 +58,6 @@ var mr = MiddlewareTransformer{
}

var checks = []Check{
PackrClean,
ic.Process,
mr.transformPackages,
WebpackCheck,
Expand All @@ -78,7 +78,9 @@ func encodeApp(r *Runner) error {
if _, err := os.Stat(p); err == nil {
return nil
}
os.MkdirAll(filepath.Dir(p), 0755)
if err := os.MkdirAll(filepath.Dir(p), 0755); err != nil {
return err
}
f, err := os.Create(p)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/fix/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (mw MiddlewareTransformer) addMissingRootMiddlewareImports(fset *token.File
}

if strings.Contains(content, "popmw.Transaction") {
astutil.AddImport(fset, f, "github.com/gobuffalo/buffalo-pop/v2/pop/popmw")
astutil.AddImport(fset, f, "github.com/gobuffalo/buffalo-pop/v3/pop/popmw")
}

if strings.Contains(content, "contenttype.Add") || strings.Contains(content, "contenttype.Set") {
Expand Down
12 changes: 6 additions & 6 deletions internal/cmd/fix/npm.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,12 @@ func AddPackageJSONScripts(r *Runner) error {
if needRewrite {
b, err = json.MarshalIndent(packageJSON, "", " ")
if err != nil {
return fmt.Errorf("could not rewrite package.json: %s", err.Error())
return fmt.Errorf("could not rewrite package.json: %w", err)
}

ioutil.WriteFile("package.json", b, 0644)
if err := ioutil.WriteFile("package.json", b, 0644); err != nil {
return fmt.Errorf("could not rewrite package.json: %w", err)
}
} else {
fmt.Println("~~~ package.json doesn't need to be patched, skipping. ~~~")
}
Expand All @@ -81,14 +83,12 @@ func PackageJSONCheck(r *Runner) error {
return nil
}

box := webpack.Templates

f, err := box.FindString("package.json.tmpl")
templates, err := webpack.Templates()
if err != nil {
return err
}

tmpl, err := template.New("package.json").Parse(f)
tmpl, err := template.New("package.json").ParseFS(templates, "package.json.tmpl")
if err != nil {
return err
}
Expand Down
9 changes: 0 additions & 9 deletions internal/cmd/fix/packr.go

This file was deleted.

6 changes: 3 additions & 3 deletions internal/cmd/fix/plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package fix

import (
"context"
"errors"
"fmt"
"os"
"path"
Expand All @@ -12,7 +13,6 @@ import (
cmdPlugins "github.com/gobuffalo/cli/internal/cmd/plugins"
"github.com/gobuffalo/cli/internal/plugins"
"github.com/gobuffalo/cli/internal/plugins/plugdeps"
"github.com/gobuffalo/cli/internal/takeon/github.com/markbates/errx"
"github.com/gobuffalo/genny/v2"
"github.com/gobuffalo/meta"
)
Expand All @@ -31,7 +31,7 @@ func (pf Plugins) CleanCache(r *Runner) error {
//Reinstall installs latest versions of the plugins
func (pf Plugins) Reinstall(r *Runner) error {
plugs, err := plugdeps.List(r.App)
if err != nil && (errx.Unwrap(err) != plugdeps.ErrMissingConfig) {
if err != nil && !errors.Is(err, plugdeps.ErrMissingConfig) {
return err
}

Expand All @@ -57,7 +57,7 @@ func (pf Plugins) RemoveOld(r *Runner) error {
run := genny.WetRunner(context.Background())
app := meta.New(".")
plugs, err := plugdeps.List(app)
if err != nil && (errx.Unwrap(err) != plugdeps.ErrMissingConfig) {
if err != nil && !errors.Is(err, plugdeps.ErrMissingConfig) {
return err
}

Expand Down
6 changes: 4 additions & 2 deletions internal/cmd/fix/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ func installTools(r *Runner) error {
g := genny.New()
app := r.App
if app.WithPop {
rTools = append(rTools, "github.com/gobuffalo/buffalo-pop/v2")
rTools = append(rTools, "github.com/gobuffalo/buffalo-pop/v3")
}
for _, t := range rTools {
g.Command(exec.Command("go", "get", t))
}
run.With(g)
if err := run.With(g); err != nil {
return err
}
return run.Run()
}
6 changes: 2 additions & 4 deletions internal/cmd/fix/webpack.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@ func WebpackCheck(r *Runner) error {
return nil
}

box := webpack.Templates

f, err := box.FindString("webpack.config.js.tmpl")
templates, err := webpack.Templates()
if err != nil {
return err
}

tmpl, err := template.New("webpack").Parse(f)
tmpl, err := template.New("webpack").ParseFS(templates, "webpack.config.js.tmpl")
if err != nil {
return err
}
Expand Down
4 changes: 3 additions & 1 deletion internal/cmd/generate/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ var ActionCmd = &cobra.Command{
}

opts := actionOptions.Options
run.WithNew(actions.New(opts))
if err := run.WithNew(actions.New(opts)); err != nil {
return err
}
return run.Run()
},
}
Expand Down
4 changes: 3 additions & 1 deletion internal/cmd/generate/mailer.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ var MailCmd = &cobra.Command{
if err != nil {
return err
}
run.With(g)
if err := run.With(g); err != nil {
return err
}

gg.With(run)
return run.Run()
Expand Down
3 changes: 1 addition & 2 deletions internal/cmd/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import (
"os/exec"
"time"

"github.com/gobuffalo/cli/internal/genny/info"

"github.com/gobuffalo/clara/v2/genny/rx"
"github.com/gobuffalo/cli/internal/genny/info"
"github.com/gobuffalo/genny/v2"
"github.com/gobuffalo/meta"
"github.com/spf13/cobra"
Expand Down
Loading

0 comments on commit bbfae2d

Please sign in to comment.